about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/dangling.rs
diff options
context:
space:
mode:
authorgavincrawford <94875769+gavincrawford@users.noreply.github.com>2024-11-12 22:32:13 -0700
committergavincrawford <94875769+gavincrawford@users.noreply.github.com>2024-11-19 10:05:24 -0700
commit01fd384d5800deb1e96b0d8921e82317e9fcdb8b (patch)
treece3f859e10aa6032e276b9e7d4c7fbf1c6e5d154 /compiler/rustc_lint/src/dangling.rs
parent24cc924af35945af57462ebeeba238ebcdf5e1ba (diff)
downloadrust-01fd384d5800deb1e96b0d8921e82317e9fcdb8b.tar.gz
rust-01fd384d5800deb1e96b0d8921e82317e9fcdb8b.zip
Correct comments concerning updated dangling pointer lint
Diffstat (limited to 'compiler/rustc_lint/src/dangling.rs')
-rw-r--r--compiler/rustc_lint/src/dangling.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/compiler/rustc_lint/src/dangling.rs b/compiler/rustc_lint/src/dangling.rs
index 21966758b10..e3e51ba263d 100644
--- a/compiler/rustc_lint/src/dangling.rs
+++ b/compiler/rustc_lint/src/dangling.rs
@@ -43,13 +43,10 @@ declare_lint! {
 }
 
 /// FIXME: false negatives (i.e. the lint is not emitted when it should be)
-/// 1. Method calls that are not checked for:
-///    - [`temporary_unsafe_cell.get()`][`core::cell::UnsafeCell::get()`]
-///    - [`temporary_sync_unsafe_cell.get()`][`core::cell::SyncUnsafeCell::get()`]
-/// 2. Ways to get a temporary that are not recognized:
+/// 1. Ways to get a temporary that are not recognized:
 ///    - `owning_temporary.field`
 ///    - `owning_temporary[index]`
-/// 3. No checks for ref-to-ptr conversions:
+/// 2. No checks for ref-to-ptr conversions:
 ///    - `&raw [mut] temporary`
 ///    - `&temporary as *(const|mut) _`
 ///    - `ptr::from_ref(&temporary)` and friends
@@ -200,8 +197,8 @@ fn is_temporary_rvalue(expr: &Expr<'_>) -> bool {
     }
 }
 
-// Array, Vec, String, CString, MaybeUninit, Cell, Box<[_]>, Box<str>, Box<CStr>,
-// or any of the above in arbitrary many nested Box'es.
+// Array, Vec, String, CString, MaybeUninit, Cell, Box<[_]>, Box<str>, Box<CStr>, UnsafeCell,
+// SyncUnsafeCell, or any of the above in arbitrary many nested Box'es.
 fn owns_allocation(tcx: TyCtxt<'_>, ty: Ty<'_>) -> bool {
     if ty.is_array() {
         true
@@ -217,7 +214,7 @@ fn owns_allocation(tcx: TyCtxt<'_>, ty: Ty<'_>) -> bool {
             }
         }
         tcx.get_diagnostic_name(def.did()).is_some_and(|name| {
-            matches!(name, sym::cstring_type | sym::Vec | sym::Cell | sym::sync_unsafe_cell)
+            matches!(name, sym::cstring_type | sym::Vec | sym::Cell | sym::SyncUnsafeCell)
         })
     } else {
         false