about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-07-13 19:32:34 +0530
committerGitHub <noreply@github.com>2022-07-13 19:32:34 +0530
commit73a62403949ce3223f686bbcb7091eac05cd50c3 (patch)
treed251536c7b4a2e09785217ef9677851361534e5c
parent9e1af3fd82b8db3c2d5bea18653f620d49df4d3d (diff)
parent6293da231abe89341faf97e2042a28cadd06c918 (diff)
downloadrust-73a62403949ce3223f686bbcb7091eac05cd50c3.tar.gz
rust-73a62403949ce3223f686bbcb7091eac05cd50c3.zip
Rollup merge of #99011 - oli-obk:UnsoundCell, r=eddyb
`UnsafeCell` blocks niches inside its nested type from being available outside

fixes #87341

This implements the plan by `@eddyb` in https://github.com/rust-lang/rust/issues/87341#issuecomment-886083646

Somewhat related PR (not strictly necessary, but that cleanup made this PR simpler): #94527
-rw-r--r--clippy_lints/src/non_copy_const.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/non_copy_const.rs b/clippy_lints/src/non_copy_const.rs
index a1ef32ae608..6bce5fbd4c1 100644
--- a/clippy_lints/src/non_copy_const.rs
+++ b/clippy_lints/src/non_copy_const.rs
@@ -148,7 +148,7 @@ fn is_value_unfrozen_raw<'tcx>(
         match val.ty().kind() {
             // the fact that we have to dig into every structs to search enums
             // leads us to the point checking `UnsafeCell` directly is the only option.
-            ty::Adt(ty_def, ..) if Some(ty_def.did()) == cx.tcx.lang_items().unsafe_cell_type() => true,
+            ty::Adt(ty_def, ..) if ty_def.is_unsafe_cell() => true,
             ty::Array(..) | ty::Adt(..) | ty::Tuple(..) => {
                 let val = cx.tcx.destructure_mir_constant(cx.param_env, val);
                 val.fields.iter().any(|field| inner(cx, *field))