diff options
| author | Michael Goulet <michael@errs.io> | 2024-06-08 14:02:14 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-06-12 20:57:23 -0400 |
| commit | 93d83c8f6957e30e6985e9f133afac74423ea65a (patch) | |
| tree | fbeb53d02a65a19f698f1d73422a7a531663a8c3 | |
| parent | c453c82de4868aee46563ec908dab218153d46eb (diff) | |
| download | rust-93d83c8f6957e30e6985e9f133afac74423ea65a.tar.gz rust-93d83c8f6957e30e6985e9f133afac74423ea65a.zip | |
Bless and add ICE regression test
| -rw-r--r-- | tests/ui/typeck/suggest-similar-impls-for-root-obligation.rs | 16 | ||||
| -rw-r--r-- | tests/ui/typeck/suggest-similar-impls-for-root-obligation.stderr | 20 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/typeck/suggest-similar-impls-for-root-obligation.rs b/tests/ui/typeck/suggest-similar-impls-for-root-obligation.rs new file mode 100644 index 00000000000..243a3218359 --- /dev/null +++ b/tests/ui/typeck/suggest-similar-impls-for-root-obligation.rs @@ -0,0 +1,16 @@ +trait Foo<'s> {} + +impl<'s> Foo<'s> for () {} + +struct Bar; + +impl<'s, T: Foo<'s>> From<T> for Bar { + fn from(_: T) -> Self { + Bar + } +} + +fn main() { + let _: Bar = ((),).into(); + //~^ ERROR he trait bound `((),): Into<Bar>` is not satisfied +} \ No newline at end of file diff --git a/tests/ui/typeck/suggest-similar-impls-for-root-obligation.stderr b/tests/ui/typeck/suggest-similar-impls-for-root-obligation.stderr new file mode 100644 index 00000000000..8410574e311 --- /dev/null +++ b/tests/ui/typeck/suggest-similar-impls-for-root-obligation.stderr @@ -0,0 +1,20 @@ +error[E0277]: the trait bound `((),): Into<Bar>` is not satisfied + --> $DIR/suggest-similar-impls-for-root-obligation.rs:14:24 + | +LL | let _: Bar = ((),).into(); + | ^^^^ the trait `Foo<'_>` is not implemented for `((),)`, which is required by `((),): Into<_>` + | + = help: the trait `Foo<'_>` is implemented for `()` + = help: for that trait implementation, expected `()`, found `((),)` +note: required for `Bar` to implement `From<((),)>` + --> $DIR/suggest-similar-impls-for-root-obligation.rs:7:22 + | +LL | impl<'s, T: Foo<'s>> From<T> for Bar { + | ------- ^^^^^^^ ^^^ + | | + | unsatisfied trait bound introduced here + = note: required for `((),)` to implement `Into<Bar>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. |
