Neural Machine
Блинчики могут помочь возбудить девушку.
This media is not supported in your browser
VIEW IN TELEGRAM
😁14
#prog #rust #suckassstory
github.com/rust-lang/rust/issues/164250
github.com/rust-lang/rust/issues/164250
use std::sync::Mutex;
static KEPT: Mutex<Vec<Box<dyn std::any::Any + Send>>> =
Mutex::new(Vec::new());
struct Q<T: 'static + Send>(Option<T>);
impl<T: 'static + Send> Drop for Q<T> {
fn drop(&mut self) {
if let Some(t) = self.0.take() {
KEPT.lock().unwrap().push(Box::new(t));
}
}
}
fn main() {
{
let l = String::from("hello world, this is long enough");
let mut q = Q(None);
q.0 = Some(&l);
}
let _z = String::from("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
let k = KEPT.lock().unwrap();
println!("{}", k[0].downcast_ref::<&'static String>().unwrap());
}
I expected to see this happen: program is not accepted
Instead, this happened: program compiles and prints XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. With asan, the program will crash with a AddressSanitizer: stack-use-after-scope
GitHub
struct's lifetime requirements can be bypassed via covariant field assignment · Issue #164250 · rust-lang/rust
NoteGiven that this issue has been shared online and is currently getting quite a few visitors, here's some additional context. Rust's type system is intended to prevent memory unsafety. Up...
😭11🔥1
#prog #rust #rustasync #article
Tokio Gives Progress, Not Ordering: Scheduling 1M Tasks
TL;DR:
Tokio Gives Progress, Not Ordering: Scheduling 1M Tasks
TL;DR:
Spawned early doesn't mean first-polled early. First-polled early doesn't mean completed early.
If there is an application-level unit of fairness you expect Tokio to honor, like the event in our case, the runtime doesn't know it exists. The bounds should be added by the application.
👍3🤔2
#prog #rust #suckassstory
Rust issue
Из-за небольшого смешивания стейта просто совпадения текста без сепараторов недостаточно, нужно ещё, чтобы звёзды сошлись по длине компонентов.
rustcuses thePathhash code to identify files, and thePathhash implementation is particularly weak because it ignores separators. As of PR #127297, it tries to compensate by mixing the component lengths into the hash, but it's still easy to manufacture collisions. That includes collisions where both sides look like plausible source paths, not gibberish, e.g.data/baselines/table.rswill conflict withdatabase/line/stable.rs.
When the hash codes of two paths collide,rustcsubstitutes the first file's contents when compiling the second one.
Rust issue
Из-за небольшого смешивания стейта просто совпадения текста без сепараторов недостаточно, нужно ещё, чтобы звёзды сошлись по длине компонентов.
GitHub
miscompilation via engineered StableSourceFileId hash collisions · Issue #164348 · rust-lang/rust
rustc uses the Path hash code to identify files, and the Path hash implementation is particularly weak because it ignores separators. As of PR #127297, it tries to compensate by mixing the componen...
🤯3🤣2