Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/rust-lang/rust/issues/151316>.
//@ edition: 2024
//@ compile-flags: -Znext-solver

#![feature(unboxed_closures)]
#![feature(non_lifetime_binders)]

struct S<T>(T)
//~^ ERROR expected `FnOnce(&'a mut i32)` signature, found `i32`
where
for<F> F:,
for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future + 'a;

fn wrapper<F>()
//~^ ERROR expected `FnOnce<&'a mut i32>` signature, found `i32`
where
F:,
for<'a> <i32 as FnOnce<&'a mut i32>>::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> <T as Trait<'a, 'b>>::Assoc: 'c;

fn main() {}
Original file line number Diff line number Diff line change
@@ -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>(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<F>()
LL | |
LL | | where
LL | | F:,
LL | | for<'a> <i32 as FnOnce<&'a mut i32>>::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> <T as Trait<'a, '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`.
Loading