about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/attributes.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-06-28 08:34:08 +0200
committerGitHub <noreply@github.com>2024-06-28 08:34:08 +0200
commitc4d0c0892532af122da046d6103f65255ac09690 (patch)
tree8495004090234d3453be5ae0c9da66db4d54cb02 /compiler/rustc_codegen_llvm/src/attributes.rs
parentd5ab93174929284ddd1b818b8ad1b45daeade3b0 (diff)
parent7e7d0a959d9a0450ac3596e842dc49e8e6618bc6 (diff)
downloadrust-c4d0c0892532af122da046d6103f65255ac09690.tar.gz
rust-c4d0c0892532af122da046d6103f65255ac09690.zip
Rollup merge of #126956 - joboet:fmt_no_extern_ty, r=RalfJung
core: avoid `extern type`s in formatting infrastructure

```@RalfJung``` [said](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Use.20of.20.60extern.20type.60.20in.20formatting.20machinery/near/446552837):

>How attached are y'all to using `extern type` in the formatting machinery?
Seems like this was introduced a [long time ago](https://github.com/rust-lang/rust/commit/34ef8f5441d5335c4177abd622383ed34a6e9315). However, it's also [not really compatible with Stacked Borrows](https://github.com/rust-lang/unsafe-code-guidelines/issues/256), and only works currently because we effectively treat references-to-extern-type almost like raw pointers in Stacked Borrows -- which of course is unsound, it's not how LLVM works. I was planning to make Miri emit a warning when this happens to avoid cases like [this](https://github.com/rust-lang/rust/issues/126814#issuecomment-2183816373) where people use extern type specifically to silence Miri without realizing what happens. but with the formatting machinery using  extern type, this warning would just show up everywhere...
>
> The "proper" way to do this in Stacked Borrows is to use raw pointers (or `NonNull`).

This PR does just that.

r? ```@RalfJung```
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/attributes.rs')
0 files changed, 0 insertions, 0 deletions