2022-10-22 15:18:16 -05:00
|
|
|
error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds
|
2022-02-14 10:10:22 -06:00
|
|
|
--> $DIR/hidden-lifetimes.rs:29:5
|
2019-05-17 17:01:53 -05:00
|
|
|
|
|
|
|
|
LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a {
|
2023-02-20 21:58:38 -06:00
|
|
|
| -- -------------- opaque type defined here
|
|
|
|
| |
|
|
|
|
| hidden type `&'a mut &'b T` captures the lifetime `'b` as defined here
|
2022-02-14 10:10:22 -06:00
|
|
|
LL | x
|
|
|
|
| ^
|
2021-10-05 08:32:03 -05:00
|
|
|
|
|
2022-10-22 16:38:05 -05:00
|
|
|
help: to declare that `impl Swap + 'a` captures `'b`, you can add an explicit `'b` lifetime bound
|
2021-10-05 08:32:03 -05:00
|
|
|
|
|
|
|
|
LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a + 'b {
|
|
|
|
| ++++
|
2019-05-17 17:01:53 -05:00
|
|
|
|
2022-10-22 15:18:16 -05:00
|
|
|
error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds
|
2022-02-14 10:10:22 -06:00
|
|
|
--> $DIR/hidden-lifetimes.rs:46:5
|
2019-05-17 17:01:53 -05:00
|
|
|
|
|
|
|
|
LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a {
|
2023-02-20 21:58:38 -06:00
|
|
|
| -- -------------- opaque type defined here
|
|
|
|
| |
|
|
|
|
| hidden type `Rc<RefCell<&'b T>>` captures the lifetime `'b` as defined here
|
2022-02-14 10:10:22 -06:00
|
|
|
LL | x
|
|
|
|
| ^
|
2021-10-05 08:32:03 -05:00
|
|
|
|
|
2022-10-22 16:38:05 -05:00
|
|
|
help: to declare that `impl Swap + 'a` captures `'b`, you can add an explicit `'b` lifetime bound
|
2021-10-05 08:32:03 -05:00
|
|
|
|
|
|
|
|
LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a + 'b {
|
|
|
|
| ++++
|
2019-05-17 17:01:53 -05:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0700`.
|