diff options
| author | gavincrawford <94875769+gavincrawford@users.noreply.github.com> | 2024-11-11 10:30:25 -0700 |
|---|---|---|
| committer | gavincrawford <94875769+gavincrawford@users.noreply.github.com> | 2024-11-11 13:36:43 -0700 |
| commit | 8ec94d30e514a794154ad467dd5275a78811efcc (patch) | |
| tree | 4bd3492165515050bec3569a8b41a4e8ff4fc0f5 /compiler/rustc_lint/src/dangling.rs | |
| parent | fdef65bf6e36fcecd3df71d3a630c306f7acc784 (diff) | |
| download | rust-8ec94d30e514a794154ad467dd5275a78811efcc.tar.gz rust-8ec94d30e514a794154ad467dd5275a78811efcc.zip | |
Update dangling pointer tests
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 } |
