Skip to content

Commit f1f5709

Browse files
committed
test(delegation): Add regression tests for #153743 and #153744
1 parent 7ad5c60 commit f1f5709

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Regression test for #153743 and #153744.
2+
// Delegation to a module or crate root inside a trait impl
3+
// should emit a resolution error, not ICE.
4+
5+
#![feature(fn_delegation)]
6+
#![allow(incomplete_features)]
7+
8+
trait Trait {
9+
fn bar();
10+
fn bar2();
11+
}
12+
13+
impl Trait for () {
14+
reuse std::path::<> as bar;
15+
//~^ ERROR expected function, found module `std::path`
16+
reuse core::<> as bar2;
17+
//~^ ERROR expected function, found crate `core`
18+
}
19+
20+
fn main() {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0423]: expected function, found module `std::path`
2+
--> $DIR/ice-non-fn-target-in-trait-impl.rs:14:11
3+
|
4+
LL | reuse std::path::<> as bar;
5+
| ^^^^^^^^^^^^^ not a function
6+
7+
error[E0423]: expected function, found crate `core`
8+
--> $DIR/ice-non-fn-target-in-trait-impl.rs:16:11
9+
|
10+
LL | reuse core::<> as bar2;
11+
| ^^^^^^^^ not a function
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0423`.

0 commit comments

Comments
 (0)