3 ms·
A challenge: 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 wh
by challengerapp 3mo ago
A challenge:
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.
- pjmlp 3mo agoIn my point of view, editions do not achieve much more than a plain -std=langXY, alongside clang-tidy, or equivalent depending on the compiler, or AI based tool. Because they don't support as many language and standard library evolution scenarios, as many think they do.