Skip to content

Commit

Permalink
Rollup merge of #99011 - oli-obk:UnsoundCell, r=eddyb
Browse files Browse the repository at this point in the history
`UnsafeCell` blocks niches inside its nested type from being available outside

fixes #87341

This implements the plan by `@eddyb` in rust-lang/rust#87341 (comment)

Somewhat related PR (not strictly necessary, but that cleanup made this PR simpler): #94527
  • Loading branch information
Dylan-DPC committed Jul 13, 2022
2 parents 9e1af3f + 6293da2 commit 73a6240
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/non_copy_const.rs
Expand Up @@ -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))
Expand Down

0 comments on commit 73a6240

Please sign in to comment.