diff options
| author | Michael Goulet <michael@errs.io> | 2025-02-10 21:53:05 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-02-10 21:53:05 +0000 |
| commit | 95357c772c60b713f7af10d813ce4df94953431c (patch) | |
| tree | f800d49af480c4fddda69a688c66f3d4218af02f /tests | |
| parent | 4b293d99275cc63b07eec9e2de38f4b776989069 (diff) | |
| download | rust-95357c772c60b713f7af10d813ce4df94953431c.tar.gz rust-95357c772c60b713f7af10d813ce4df94953431c.zip | |
Check whole Unsize predicate for escaping bound vars
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/traits/unsize-goal-escaping-bounds.current.stderr | 19 | ||||
| -rw-r--r-- | tests/ui/traits/unsize-goal-escaping-bounds.rs | 22 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/ui/traits/unsize-goal-escaping-bounds.current.stderr b/tests/ui/traits/unsize-goal-escaping-bounds.current.stderr new file mode 100644 index 00000000000..e63a0bf50b7 --- /dev/null +++ b/tests/ui/traits/unsize-goal-escaping-bounds.current.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `for<'a> (): Unsize<(dyn Trait + 'a)>` is not satisfied + --> $DIR/unsize-goal-escaping-bounds.rs:20:5 + | +LL | foo(); + | ^^^^^ the trait `for<'a> Unsize<(dyn Trait + 'a)>` is not implemented for `()` + | + = note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information +note: required by a bound in `foo` + --> $DIR/unsize-goal-escaping-bounds.rs:15:17 + | +LL | fn foo() + | --- required by a bound in this function +LL | where +LL | for<'a> (): Unsize<dyn Trait + 'a>, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/unsize-goal-escaping-bounds.rs b/tests/ui/traits/unsize-goal-escaping-bounds.rs new file mode 100644 index 00000000000..fb25f7a4239 --- /dev/null +++ b/tests/ui/traits/unsize-goal-escaping-bounds.rs @@ -0,0 +1,22 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@[next] check-pass +//@ ignore-compare-mode-next-solver (explicit revisions) + +#![feature(unsize)] + +use std::marker::Unsize; + +trait Trait {} +impl Trait for () {} + +fn foo() +where + for<'a> (): Unsize<dyn Trait + 'a>, +{ +} + +fn main() { + foo(); + //[current]~^ ERROR the trait bound `for<'a> (): Unsize<(dyn Trait + 'a)>` is not satisfied +} |
