|
|
|
|
|
by klodolph
10 days ago
|
|
Here is your example: use std::thread;
fn main() {
let v = vec![1, 2, 3];
let handle = thread::spawn(|| {
println!("{:?}", v); // borrows `v`
});
handle.join().unwrap();
}
If lifetimes could have upper bounds then this would work. |
|
Would upper bounds prevent falling apart if you did something very questionable with cyclical Rc's? If so, how so? What kind of code would compiler REJECT that it wouldn't today?