diff --git a/tests/ui/traits/next-solver/normalize/higher-ranked-outlives-param-env-151316.rs b/tests/ui/traits/next-solver/normalize/higher-ranked-outlives-param-env-151316.rs new file mode 100644 index 0000000000000..37c0994e7e18b --- /dev/null +++ b/tests/ui/traits/next-solver/normalize/higher-ranked-outlives-param-env-151316.rs @@ -0,0 +1,34 @@ +//! Higher-ranked outlives bounds on projections in where clauses used to ICE +//! with "could not normalize" in the new solver. +//! +//! Regression test for . +//@ edition: 2024 +//@ compile-flags: -Znext-solver + +#![feature(unboxed_closures)] +#![feature(non_lifetime_binders)] + +struct S(T) +//~^ ERROR expected `FnOnce(&'a mut i32)` signature, found `i32` +where + for F:, + for<'a> >::Output: Future + 'a; + +fn wrapper() +//~^ ERROR expected `FnOnce<&'a mut i32>` signature, found `i32` +where + F:, + for<'a> >::Output: Future + 'a, +{ +} + +trait Trait<'a, 'b> { + type Assoc; +} + +struct ImpliedBound<'a, 'c, T>(T, &'a (), &'c ()) +//~^ ERROR the trait bound `for<'b> T: Trait<'a, 'b>` is not satisfied +where + for<'b> >::Assoc: 'c; + +fn main() {} diff --git a/tests/ui/traits/next-solver/normalize/higher-ranked-outlives-param-env-151316.stderr b/tests/ui/traits/next-solver/normalize/higher-ranked-outlives-param-env-151316.stderr new file mode 100644 index 0000000000000..a71aec87c8fe4 --- /dev/null +++ b/tests/ui/traits/next-solver/normalize/higher-ranked-outlives-param-env-151316.stderr @@ -0,0 +1,34 @@ +error[E0277]: expected `FnOnce(&'a mut i32)` signature, found `i32` + --> $DIR/higher-ranked-outlives-param-env-151316.rs:11:1 + | +LL | struct S(T) + | ^^^^^^^^^^^ expected `FnOnce(&'a mut i32)` signature, found `i32` + | + = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32` + +error[E0277]: expected `FnOnce<&'a mut i32>` signature, found `i32` + --> $DIR/higher-ranked-outlives-param-env-151316.rs:17:1 + | +LL | / fn wrapper() +LL | | +LL | | where +LL | | F:, +LL | | for<'a> >::Output: Future + 'a, + | |______________________________________________________________^ expected `FnOnce<&'a mut i32>` signature, found `i32` + | + = help: the trait `for<'a> FnOnce<&'a mut i32>` is not implemented for `i32` + +error[E0277]: the trait bound `for<'b> T: Trait<'a, 'b>` is not satisfied + --> $DIR/higher-ranked-outlives-param-env-151316.rs:29:1 + | +LL | struct ImpliedBound<'a, 'c, T>(T, &'a (), &'c ()) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> Trait<'a, 'b>` is not implemented for `T` + | +help: consider further restricting type parameter `T` with trait `Trait` + | +LL | for<'b> >::Assoc: 'c, T: for<'b> Trait<'a, 'b>; + | ++++++++++++++++++++++++++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`.