mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
19 lines
394 B
Rust
19 lines
394 B
Rust
// edition:2021
|
|
|
|
// regression test for #112056
|
|
|
|
fn extend_lifetime<'a, 'b>(x: &mut (&'a str,), y: &'b str) {
|
|
let mut closure = |input| x.0 = input;
|
|
//~^ ERROR: lifetime may not live long enough
|
|
closure(y);
|
|
}
|
|
|
|
fn main() {
|
|
let mut tuple = ("static",);
|
|
{
|
|
let x = String::from("temporary");
|
|
extend_lifetime(&mut tuple, &x);
|
|
}
|
|
println!("{}", tuple.0);
|
|
}
|