rust/compiler/rustc_lint/src
bors 4e5b31c2b0 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`
2023-09-07 00:24:45 +00:00
..
nonstandard_style
array_into_iter.rs
builtin.rs Emit unused doc comment warnings for pat and expr fields 2023-09-03 08:21:18 +05:30
context.rs refactor: use references to reduce unnecessary clones 2023-08-24 01:09:55 +01:00
deref_into_dyn_supertrait.rs
drop_forget_useless.rs
early.rs diagnostics: avoid wrong unused_parens on x as (T) < y 2023-08-31 20:14:49 -07:00
enum_intrinsics_non_enums.rs
errors.rs refactor: use references to reduce unnecessary clones 2023-08-24 01:09:55 +01:00
expect.rs
for_loops_over_fallibles.rs
foreign_modules.rs
hidden_unicode_codepoints.rs
internal.rs
invalid_from_utf8.rs
late.rs Use {Local}ModDefId in many queries 2023-08-14 07:22:48 +00:00
let_underscore.rs
levels.rs lint: translate RenamedOrRemovedLint 2023-08-24 01:09:46 +01:00
lib.rs Auto merge of #113126 - Bryanskiy:delete_old, r=petrochenkov 2023-09-01 12:40:01 +00:00
lints.rs lint: translate RenamedOrRemovedLint 2023-08-24 01:09:46 +01:00
map_unit_fn.rs
methods.rs
multiple_supertrait_upcastable.rs
non_ascii_idents.rs Reword confusable idents lint 2023-08-04 16:46:08 +00:00
non_fmt_panic.rs
nonstandard_style.rs
noop_method_call.rs
opaque_hidden_inferred_bound.rs
pass_by_value.rs
passes.rs diagnostics: avoid wrong unused_parens on x as (T) < y 2023-08-31 20:14:49 -07:00
ptr_nulls.rs
redundant_semicolon.rs
reference_casting.rs Lint on invalid UnsafeCell::raw_get with invalid_reference_casting lint 2023-08-24 15:00:21 +02:00
tests.rs
traits.rs make comments less cryptic 2023-09-06 12:09:29 +03:00
types.rs some more is_zst that should be is_1zst 2023-08-29 14:11:27 +02:00
unused.rs Use terminology more sensibly 2023-08-31 22:40:43 -07:00