add test for ICE: failed to resolve instance for <fn() -> impl ...> #123145

Fixes https://github.com/rust-lang/rust/issues/123145
This commit is contained in:
Matthias Krüger 2024-04-07 00:48:47 +02:00
parent 7836909402
commit 7c43bc0378
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,20 @@
// ICE failed to resolve instance for ...
// issue: rust-lang/rust#123145
//@ build-fail
//~^^^ ERROR overflow evaluating the requirement `(fn() -> impl Handler
trait Handler {
fn handle(&self) {}
}
impl<H: Handler, F: Fn() -> H> Handler for F {}
impl<L: Handler> Handler for (L,) {}
fn one() -> impl Handler {
(one,)
}
fn main() {
one.handle();
}

View File

@ -0,0 +1,15 @@
error[E0275]: overflow evaluating the requirement `(fn() -> impl Handler {one},): Handler`
|
note: required for `fn() -> impl Handler {one}` to implement `Handler`
--> $DIR/failed-to-resolve-instance-ice-123145.rs:10:32
|
LL | impl<H: Handler, F: Fn() -> H> Handler for F {}
| ------- ^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: 2 redundant requirements hidden
= note: required for `fn() -> impl Handler {one}` to implement `Handler`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0275`.