mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 17:33:07 +00:00
Correct comments concerning updated dangling pointer lint
This commit is contained in:
parent
24cc924af3
commit
01fd384d58
@ -43,13 +43,10 @@ declare_lint! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// FIXME: false negatives (i.e. the lint is not emitted when it should be)
|
/// FIXME: false negatives (i.e. the lint is not emitted when it should be)
|
||||||
/// 1. Method calls that are not checked for:
|
/// 1. Ways to get a temporary that are not recognized:
|
||||||
/// - [`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:
|
|
||||||
/// - `owning_temporary.field`
|
/// - `owning_temporary.field`
|
||||||
/// - `owning_temporary[index]`
|
/// - `owning_temporary[index]`
|
||||||
/// 3. No checks for ref-to-ptr conversions:
|
/// 2. No checks for ref-to-ptr conversions:
|
||||||
/// - `&raw [mut] temporary`
|
/// - `&raw [mut] temporary`
|
||||||
/// - `&temporary as *(const|mut) _`
|
/// - `&temporary as *(const|mut) _`
|
||||||
/// - `ptr::from_ref(&temporary)` and friends
|
/// - `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>,
|
// Array, Vec, String, CString, MaybeUninit, Cell, Box<[_]>, Box<str>, Box<CStr>, UnsafeCell,
|
||||||
// or any of the above in arbitrary many nested Box'es.
|
// SyncUnsafeCell, or any of the above in arbitrary many nested Box'es.
|
||||||
fn owns_allocation(tcx: TyCtxt<'_>, ty: Ty<'_>) -> bool {
|
fn owns_allocation(tcx: TyCtxt<'_>, ty: Ty<'_>) -> bool {
|
||||||
if ty.is_array() {
|
if ty.is_array() {
|
||||||
true
|
true
|
||||||
@ -217,7 +214,7 @@ fn owns_allocation(tcx: TyCtxt<'_>, ty: Ty<'_>) -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tcx.get_diagnostic_name(def.did()).is_some_and(|name| {
|
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 {
|
} else {
|
||||||
false
|
false
|
||||||
|
@ -316,6 +316,7 @@ symbols! {
|
|||||||
SubdiagMessage,
|
SubdiagMessage,
|
||||||
Subdiagnostic,
|
Subdiagnostic,
|
||||||
Sync,
|
Sync,
|
||||||
|
SyncUnsafeCell,
|
||||||
T,
|
T,
|
||||||
Target,
|
Target,
|
||||||
ToOwned,
|
ToOwned,
|
||||||
@ -1929,7 +1930,6 @@ symbols! {
|
|||||||
surface_async_drop_in_place,
|
surface_async_drop_in_place,
|
||||||
sym,
|
sym,
|
||||||
sync,
|
sync,
|
||||||
sync_unsafe_cell,
|
|
||||||
synthetic,
|
synthetic,
|
||||||
t32,
|
t32,
|
||||||
target,
|
target,
|
||||||
|
@ -2273,7 +2273,7 @@ impl<T: DispatchFromDyn<U>, U> DispatchFromDyn<UnsafeCell<U>> for UnsafeCell<T>
|
|||||||
/// See [`UnsafeCell`] for details.
|
/// See [`UnsafeCell`] for details.
|
||||||
#[unstable(feature = "sync_unsafe_cell", issue = "95439")]
|
#[unstable(feature = "sync_unsafe_cell", issue = "95439")]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[rustc_diagnostic_item = "sync_unsafe_cell"]
|
#[rustc_diagnostic_item = "SyncUnsafeCell"]
|
||||||
#[rustc_pub_transparent]
|
#[rustc_pub_transparent]
|
||||||
pub struct SyncUnsafeCell<T: ?Sized> {
|
pub struct SyncUnsafeCell<T: ?Sized> {
|
||||||
value: UnsafeCell<T>,
|
value: UnsafeCell<T>,
|
||||||
|
Loading…
Reference in New Issue
Block a user