From 205dd6f50b02cdd32b3d8b883776d690596a9a92 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Wed, 8 Apr 2026 23:55:26 +0900 Subject: [PATCH] reduce ICE reproducer --- ...type-notation-where-clause-doesnt-apply.rs | 34 +++------ ...-notation-where-clause-doesnt-apply.stderr | 72 ++++++------------- 2 files changed, 33 insertions(+), 73 deletions(-) diff --git a/tests/ui/traits/next-solver/diagnostics/return-type-notation-where-clause-doesnt-apply.rs b/tests/ui/traits/next-solver/diagnostics/return-type-notation-where-clause-doesnt-apply.rs index ecef5bd4f11c..a12e8235662b 100644 --- a/tests/ui/traits/next-solver/diagnostics/return-type-notation-where-clause-doesnt-apply.rs +++ b/tests/ui/traits/next-solver/diagnostics/return-type-notation-where-clause-doesnt-apply.rs @@ -3,30 +3,16 @@ #![feature(return_type_notation)] -pub trait Foo { - async fn bar(); -} -trait Bar {} - -impl> Foo for T where T: Bar {} -//~^ ERROR not all trait items implemented, missing: `bar` - -fn needs_foo(_: impl Foo) {} - -trait Mirror { - type Mirror; -} -impl Mirror for T { - type Mirror = T; +pub trait Trait { + async fn func(); } -fn hello() -where - ::Mirror: Foo, -{ - needs_foo(()); - //~^ ERROR the trait bound `(): Foo` is not satisfied - //~| ERROR overflow evaluating the requirement -} +impl> Trait for T {} +//~^ ERROR not all trait items implemented, missing: `func` -fn main() {} +fn check(_: impl Trait) {} + +fn main() { + check(()); + //~^ ERROR overflow evaluating the requirement +} diff --git a/tests/ui/traits/next-solver/diagnostics/return-type-notation-where-clause-doesnt-apply.stderr b/tests/ui/traits/next-solver/diagnostics/return-type-notation-where-clause-doesnt-apply.stderr index 5a47ca1d8455..84697aecfc63 100644 --- a/tests/ui/traits/next-solver/diagnostics/return-type-notation-where-clause-doesnt-apply.stderr +++ b/tests/ui/traits/next-solver/diagnostics/return-type-notation-where-clause-doesnt-apply.stderr @@ -1,60 +1,34 @@ -error[E0046]: not all trait items implemented, missing: `bar` - --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:11:1 +error[E0046]: not all trait items implemented, missing: `func` + --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:10:1 | -LL | async fn bar(); - | --------------- `bar` from trait +LL | async fn func(); + | ---------------- `func` from trait ... -LL | impl> Foo for T where T: Bar {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation +LL | impl> Trait for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `func` in implementation -error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:27:15 +error[E0275]: overflow evaluating the requirement `impl Future { <() as Trait>::func(..) } == _` + --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:16:5 | -LL | needs_foo(()); - | --------- ^^ the trait `Bar` is not implemented for `()` - | | - | required by a bound introduced by this call +LL | check(()); + | ^^^^^^^^^ | -help: this trait has no implementations, consider adding one - --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:9:1 +note: required for `()` to implement `Trait` + --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:10:32 | -LL | trait Bar {} - | ^^^^^^^^^ -note: required for `()` to implement `Foo` - --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:11:29 - | -LL | impl> Foo for T where T: Bar {} - | ^^^ ^ --- unsatisfied trait bound introduced here +LL | impl> Trait for T {} + | ---- ^^^^^ ^ + | | + | unsatisfied trait bound introduced here = note: 1 redundant requirement hidden - = note: required for `()` to implement `Foo` -note: required by a bound in `needs_foo` - --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:14:22 + = note: required for `()` to implement `Trait` +note: required by a bound in `check` + --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:13:18 | -LL | fn needs_foo(_: impl Foo) {} - | ^^^ required by this bound in `needs_foo` +LL | fn check(_: impl Trait) {} + | ^^^^^ required by this bound in `check` -error[E0275]: overflow evaluating the requirement `impl Future { <() as Foo>::bar(..) } == _` - --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:27:5 - | -LL | needs_foo(()); - | ^^^^^^^^^^^^^ - | -note: required for `()` to implement `Foo` - --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:11:29 - | -LL | impl> Foo for T where T: Bar {} - | ---- ^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: 1 redundant requirement hidden - = note: required for `()` to implement `Foo` -note: required by a bound in `needs_foo` - --> $DIR/return-type-notation-where-clause-doesnt-apply.rs:14:22 - | -LL | fn needs_foo(_: impl Foo) {} - | ^^^ required by this bound in `needs_foo` +error: aborting due to 2 previous errors -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0046, E0275, E0277. +Some errors have detailed explanations: E0046, E0275. For more information about an error, try `rustc --explain E0046`.