1.97K subscribers
4.01K photos
157 videos
15 files
4.14K links
Блог со звёздочкой.

Много репостов, немножко программирования.

Небольшое прикольное комьюнити: @decltype_chat_ptr_t
Автор: @insert_reference_here
Download Telegram
#prog #rust #suckassstory

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
😭11👍1🔥1
#game Slay the Spire 2
🤔4👍2🤷2
#prog #rust #rustasync #article

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
😁11🤮3
Блог*
Source
advanced <...> technology such as a shopping cart
😁13🤮2
Блог*
Source
r/rust (потому что написано вроде на Tauri)
😁12
🥰20
#prog #rust #suckassstory

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 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.rs will conflict with database/line/stable.rs.

When the hash codes of two paths collide, rustc substitutes the first file's contents when compiling the second one.


Rust issue

Из-за небольшого смешивания стейта просто совпадения текста без сепараторов недостаточно, нужно ещё, чтобы звёзды сошлись по длине компонентов.
🤯5🤣4
#meme про сон
🥰12💯8❤1
А всем остальным нам?!
😭9
Forwarded from Сова пишет…
Тем временем разработчики на Go

*tailscale
😁28🤣5