|
|
@ -310,9 +310,7 @@ thread_local! {
|
|
|
|
|
|
|
|
|
|
|
|
/// saves the input given into a thread local `Vec<&'static str>`
|
|
|
|
/// saves the input given into a thread local `Vec<&'static str>`
|
|
|
|
fn store(input: &'static str) {
|
|
|
|
fn store(input: &'static str) {
|
|
|
|
StaticVecs.with(|v| {
|
|
|
|
StaticVecs.with_borrow_mut(|v| v.push(input));
|
|
|
|
v.borrow_mut().push(input);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Calls the function with it's input (must have the same lifetime!)
|
|
|
|
/// Calls the function with it's input (must have the same lifetime!)
|
|
|
@ -332,9 +330,8 @@ fn main() {
|
|
|
|
demo(&smuggle, store);
|
|
|
|
demo(&smuggle, store);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StaticVecs.with(|v| {
|
|
|
|
// use after free 😿
|
|
|
|
println!("{:?}", v.borrow()); // use after free 😿
|
|
|
|
StaticVecs.with_borrow(|v| println!("{v:?}"));
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|