by challengerapp · 5mo ago · 0 comments
In the below code snippet, that it is assumed was gotten on GitHub or a documentation site or somewhere else, you are not allowed to figure out which edition the code is meant for. You must tell, without knowing the edition, whether the code has a deadlock or not. You may not assume a specific edition.
fn f(value: &RwLock<Option<bool>>) {
if let Some(x) = *value.read().unwrap() {
println!("value is {x}");
} else {
let mut v = value.write().unwrap();
if v.is_none() {
*v = Some(true);
}
}
}If you are not able to, you must delete all your social media accounts and never comment on any topic related to programming languages or Rust ever again.
Because they don't support as many language and standard library evolution scenarios, as many think they do.