about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-10-24 10:35:39 +0200
committerGitHub <noreply@github.com>2024-10-24 10:35:39 +0200
commit93bf791e8b94d4b5fba606bc16ed0e95df57428f (patch)
treefb80604de01e3001dceb9d5d9c81cb0ec0d50014 /compiler/rustc_pattern_analysis/src
parent8aca4bab080b2c81065645fc070acca7a060f8a3 (diff)
parent367183bc0c64d2835dbfe498d995072c3d426ffe (diff)
downloadrust-93bf791e8b94d4b5fba606bc16ed0e95df57428f.tar.gz
rust-93bf791e8b94d4b5fba606bc16ed0e95df57428f.zip
Rollup merge of #129248 - compiler-errors:raw-ref-deref, r=nnethercote
Taking a raw ref (`&raw (const|mut)`) of a deref of pointer (`*ptr`) is always safe

T-opsem decided in https://github.com/rust-lang/reference/pull/1387 that `*ptr` is only unsafe if the place is accessed. This means that taking a raw ref of a deref expr is always safe, since it doesn't constitute a read.

This also relaxes the `DEREF_NULLPTR` lint to stop warning in the case of raw ref of a deref'd nullptr, and updates its docs to reflect that change in the UB specification.

This does not change the behavior of `addr_of!((*ptr).field)`, since field projections still require the projection is in-bounds.

I'm on the fence whether this requires an FCP, since it's something that is guaranteed by the reference you could ostensibly call this a bugfix since we were counting truly safe operations as unsafe. Perhaps someone on opsem has a strong opinion? cc `@rust-lang/opsem`
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions