diff options
| author | Michael Goulet <michael@errs.io> | 2022-07-27 05:27:45 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-07-27 05:34:29 +0000 |
| commit | 1694ea187392a4832a5d69fa008b1e5ff13fe584 (patch) | |
| tree | 185761bc268a7a3dcf49754d06ad1a21f5b315a7 /src/test | |
| parent | c9b31839b624345d59fda6e595b9abae71fcea13 (diff) | |
| download | rust-1694ea187392a4832a5d69fa008b1e5ff13fe584.tar.gz rust-1694ea187392a4832a5d69fa008b1e5ff13fe584.zip | |
use check_region_obligations_and_report_errors in more places to avoid ICEs
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/coercion/issue-53475.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/coercion/issue-53475.stderr | 14 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/coercion/issue-53475.rs b/src/test/ui/coercion/issue-53475.rs new file mode 100644 index 00000000000..3770c024fb9 --- /dev/null +++ b/src/test/ui/coercion/issue-53475.rs @@ -0,0 +1,13 @@ +#![feature(coerce_unsized)] + +use std::any::Any; +use std::ops::CoerceUnsized; + +struct Foo<T> { + data: Box<T>, +} + +impl<T> CoerceUnsized<Foo<dyn Any>> for Foo<T> {} +//~^ ERROR the parameter type `T` may not live long enough + +fn main() {} diff --git a/src/test/ui/coercion/issue-53475.stderr b/src/test/ui/coercion/issue-53475.stderr new file mode 100644 index 00000000000..522c50dca95 --- /dev/null +++ b/src/test/ui/coercion/issue-53475.stderr @@ -0,0 +1,14 @@ +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/issue-53475.rs:10:1 + | +LL | impl<T> CoerceUnsized<Foo<dyn Any>> for Foo<T> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound... + | +LL | impl<T: 'static> CoerceUnsized<Foo<dyn Any>> for Foo<T> {} + | +++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0310`. |
