test(delegation): Add regression tests for #153743 and #153744

This commit is contained in:
Tony Kan
2026-03-11 19:25:32 -07:00
parent 7ad5c60217
commit f1f5709e62
2 changed files with 35 additions and 0 deletions
@@ -0,0 +1,20 @@
// Regression test for #153743 and #153744.
// Delegation to a module or crate root inside a trait impl
// should emit a resolution error, not ICE.
#![feature(fn_delegation)]
#![allow(incomplete_features)]
trait Trait {
fn bar();
fn bar2();
}
impl Trait for () {
reuse std::path::<> as bar;
//~^ ERROR expected function, found module `std::path`
reuse core::<> as bar2;
//~^ ERROR expected function, found crate `core`
}
fn main() {}
@@ -0,0 +1,15 @@
error[E0423]: expected function, found module `std::path`
--> $DIR/ice-non-fn-target-in-trait-impl.rs:14:11
|
LL | reuse std::path::<> as bar;
| ^^^^^^^^^^^^^ not a function
error[E0423]: expected function, found crate `core`
--> $DIR/ice-non-fn-target-in-trait-impl.rs:16:11
|
LL | reuse core::<> as bar2;
| ^^^^^^^^ not a function
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0423`.