diff options
Diffstat (limited to 'compiler/rustc_lint/src/dangling.rs')
| -rw-r--r-- | compiler/rustc_lint/src/dangling.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_lint/src/dangling.rs b/compiler/rustc_lint/src/dangling.rs index 09fe709e845..21966758b10 100644 --- a/compiler/rustc_lint/src/dangling.rs +++ b/compiler/rustc_lint/src/dangling.rs @@ -211,13 +211,14 @@ fn owns_allocation(tcx: TyCtxt<'_>, ty: Ty<'_>) -> bool { || inner.ty_adt_def().is_some_and(|def| tcx.is_lang_item(def.did(), LangItem::CStr)) || owns_allocation(tcx, inner) } else if let Some(def) = ty.ty_adt_def() { - for lang_item in [LangItem::String, LangItem::MaybeUninit] { + for lang_item in [LangItem::String, LangItem::MaybeUninit, LangItem::UnsafeCell] { if tcx.is_lang_item(def.did(), lang_item) { return true; } } - tcx.get_diagnostic_name(def.did()) - .is_some_and(|name| matches!(name, sym::cstring_type | sym::Vec | sym::Cell)) + tcx.get_diagnostic_name(def.did()).is_some_and(|name| { + matches!(name, sym::cstring_type | sym::Vec | sym::Cell | sym::sync_unsafe_cell) + }) } else { false } |
