diff options
| author | bors <bors@rust-lang.org> | 2023-09-07 00:24:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-09-07 00:24:45 +0000 |
| commit | 4e5b31c2b0023dba53a1b2827f4b7ac42aaaa18f (patch) | |
| tree | 628bbb11a517f98e33e45c1b19da882e077870ec /tests/codegen/macos/x86_64-macosx-deployment-target.rs | |
| parent | b0d45536acf8be99036c6a1261359e3cf89f9d63 (diff) | |
| parent | 89800a27fcbcd15641e06fb870b51c320a78668f (diff) | |
| download | rust-4e5b31c2b0023dba53a1b2827f4b7ac42aaaa18f.tar.gz rust-4e5b31c2b0023dba53a1b2827f4b7ac42aaaa18f.zip | |
Auto merge of #115166 - Urgau:invalid_ref_casting-invalid-unsafecell-usage, r=est31
Lint on invalid usage of `UnsafeCell::raw_get` in reference casting
This PR proposes to take into account `UnsafeCell::raw_get` method call for non-Freeze types for the `invalid_reference_casting` lint.
The goal of this is to catch those kind of invalid reference casting:
```rust
fn as_mut<T>(x: &T) -> &mut T {
unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
}
```
r? `@est31`
Diffstat (limited to 'tests/codegen/macos/x86_64-macosx-deployment-target.rs')
0 files changed, 0 insertions, 0 deletions
