Re:totally_safe_transmute, Line-by-Line (2021)
by pcfwik on Monday January 08, 2024 @07:19PM
(#38920551)
Also possible to do directly in the "safe" type system, without messing around with /proc/mem: https://zyedidia.github.io/blog/posts/5-safe-transmute/
[ Parent
| on HN ]
Re:totally_safe_transmute, Line-by-Line (2021)
by juped on Monday January 08, 2024 @09:15PM
(#38921374)
in fact way safer, since it doesn't rely on the unsafe-riddled std::fs!
Re:totally_safe_transmute, Line-by-Line (2021)
by saghm on Monday January 08, 2024 @10:19PM
(#38921857)
That is certainly a strange bug! It took me several minutes to wrap my head around, but from if I'm reading correctly, `transmute_obj` shouldn't expect to be passed in a U because `<T as Object<U>>::Output` should be using `Object<U>::Output`, but instead it's using `T::Output`. I need to mess around with this later on my computer because I'd expect that `<T as Object<U>>::Output` accepting `T::Output` means that it would _not_ accept `Object<U>::Output`, and I'm super curious what error it would give if it were passed that instead...
Re:totally_safe_transmute, Line-by-Line (2021)
by zyedidia on Monday January 08, 2024 @11:18PM
(#38922255)
The Rust team did a deep dive on the bug in 2020, which has some more details that might be helpful to understanding what's going on: https://github.com/rust-lang/lang-team/blob/master/design-me....