rust/tests/ui/nll/ty-outlives/projection-no-regions-closu...

129 lines
4.5 KiB
Plaintext

note: external requirements
--> $DIR/projection-no-regions-closure.rs:25:23
|
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^
|
= note: defining type: no_region::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?2)>,
(),
]
= note: number of external vids: 3
= note: where <T as std::iter::Iterator>::Item: '?2
note: no external requirements
--> $DIR/projection-no-regions-closure.rs:21:1
|
LL | / fn no_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a>
LL | | where
LL | | T: Iterator,
| |________________^
|
= note: defining type: no_region::<'?1, T>
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-closure.rs:25:31
|
LL | fn no_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a>
| -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
...
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | T: Iterator, <T as Iterator>::Item: 'a
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: external requirements
--> $DIR/projection-no-regions-closure.rs:34:23
|
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^
|
= note: defining type: correct_region::<'?1, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?2)>,
(),
]
= note: number of external vids: 3
= note: where <T as std::iter::Iterator>::Item: '?2
note: no external requirements
--> $DIR/projection-no-regions-closure.rs:30:1
|
LL | / fn correct_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a>
LL | | where
LL | | T: 'a + Iterator,
| |_____________________^
|
= note: defining type: correct_region::<'?1, T>
note: external requirements
--> $DIR/projection-no-regions-closure.rs:42:23
|
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^
|
= note: defining type: wrong_region::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?3)>,
(),
]
= note: number of external vids: 4
= note: where <T as std::iter::Iterator>::Item: '?3
note: no external requirements
--> $DIR/projection-no-regions-closure.rs:38:1
|
LL | / fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a>
LL | | where
LL | | T: 'b + Iterator,
| |_____________________^
|
= note: defining type: wrong_region::<'?1, '?2, T>
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-closure.rs:42:31
|
LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a>
| -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
...
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | T: 'b + Iterator, <T as Iterator>::Item: 'a
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: external requirements
--> $DIR/projection-no-regions-closure.rs:52:23
|
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^
|
= note: defining type: outlives_region::<'?1, '?2, T>::{closure#0} with closure args [
i32,
extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?3)>,
(),
]
= note: number of external vids: 4
= note: where <T as std::iter::Iterator>::Item: '?3
note: no external requirements
--> $DIR/projection-no-regions-closure.rs:47:1
|
LL | / fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a>
LL | | where
LL | | T: 'b + Iterator,
LL | | 'b: 'a,
| |___________^
|
= note: defining type: outlives_region::<'?1, '?2, T>
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0309`.