blob: 56b43bbd7d34ce4189d7a99d57c6dab687cf0f44 [file] [log] [blame]
error: borrowed data cannot be stored outside of its closure
--> $DIR/expect-region-supply-region.rs:28:18
|
LL | let mut f: Option<&u32> = None;
| ----- borrowed data cannot be stored into here...
LL | closure_expecting_bound(|x| {
| --- ...because it cannot outlive this closure
LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure
| ^ cannot be stored outside of its closure
error: borrowed data cannot be stored outside of its closure
--> $DIR/expect-region-supply-region.rs:38:18
|
LL | let mut f: Option<&u32> = None;
| ----- borrowed data cannot be stored into here...
LL | closure_expecting_bound(|x: &u32| {
| --------- ...because it cannot outlive this closure
LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure
| ^ cannot be stored outside of its closure
error[E0308]: mismatched types
--> $DIR/expect-region-supply-region.rs:47:33
|
LL | closure_expecting_bound(|x: &'x u32| {
| ^^^^^^^ lifetime mismatch
|
= note: expected type `&u32`
found type `&'x u32`
note: the anonymous lifetime #2 defined on the body at 47:29...
--> $DIR/expect-region-supply-region.rs:47:29
|
LL | closure_expecting_bound(|x: &'x u32| {
| _____________________________^
LL | | //~^ ERROR mismatched types
LL | | //~| ERROR mismatched types
LL | |
... |
LL | | //~^ ERROR borrowed data cannot be stored outside of its closure
LL | | });
| |_____^
note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 42:30
--> $DIR/expect-region-supply-region.rs:42:30
|
LL | fn expect_bound_supply_named<'x>() {
| ^^
error[E0308]: mismatched types
--> $DIR/expect-region-supply-region.rs:47:33
|
LL | closure_expecting_bound(|x: &'x u32| {
| ^^^^^^^ lifetime mismatch
|
= note: expected type `&u32`
found type `&'x u32`
note: the lifetime 'x as defined on the function body at 42:30...
--> $DIR/expect-region-supply-region.rs:42:30
|
LL | fn expect_bound_supply_named<'x>() {
| ^^
note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 47:29
--> $DIR/expect-region-supply-region.rs:47:29
|
LL | closure_expecting_bound(|x: &'x u32| {
| _____________________________^
LL | | //~^ ERROR mismatched types
LL | | //~| ERROR mismatched types
LL | |
... |
LL | | //~^ ERROR borrowed data cannot be stored outside of its closure
LL | | });
| |_____^
error: borrowed data cannot be stored outside of its closure
--> $DIR/expect-region-supply-region.rs:52:18
|
LL | let mut f: Option<&u32> = None;
| ----- borrowed data cannot be stored into here...
...
LL | closure_expecting_bound(|x: &'x u32| {
| ------------ ...because it cannot outlive this closure
...
LL | f = Some(x);
| ^ cannot be stored outside of its closure
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0308`.