mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
d4175c7e4c
aka one specific change in LLVM 16 introducing UB in Rust, take 3? 4? This time, we have multiple types like: #[xpcom(implement(nsISomething))] struct Foo { foo: RefCell<Something>, } impl Foo { fn from_interface(obj: &nsISomething) -> &Self { unsafe { ::std::mem::transmute(obj) } } } At first glance, this looks innocuous. But the problem is that nsISomething, as far as LLVM is informed by Rust, is readonly, but Foo, via the RefCell, has interious mutability. LLVM ends up assuming that any mutability that happens to that returned &Foo can't happen, and removes it. This is yet another case where https://github.com/rust-lang/rust/issues/111229 would save our feet from this footgun LLVM 16 added and that the rust compiler doesn't help us prevent the least. Differential Revision: https://phabricator.services.mozilla.com/D183569 *** Bug 1831467 fix comment a=dsmith |
||
---|---|---|
.. | ||
xpidl | ||
setup.py |