mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Rollup merge of #130914 - compiler-errors:insignificant-dtor, r=Amanieu
Mark some more types as having insignificant dtor These were caught by https://github.com/rust-lang/rust/pull/129864#issuecomment-2376658407, which is implementing a lint for some changes in drop order for temporaries in tail expressions. Specifically, the destructors of `CString` and the bitpacked repr for `std::io::Error` are insignificant insofar as they don't have side-effects on things like locking or synchronization; they just free memory. See some discussion on #89144 for what makes a drop impl "significant"
This commit is contained in:
commit
2fe41869c9
@ -228,6 +228,7 @@ mod thin;
|
||||
#[lang = "owned_box"]
|
||||
#[fundamental]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_insignificant_dtor]
|
||||
// The declaration of the `Box` struct must be kept in sync with the
|
||||
// compiler or ICEs will happen.
|
||||
pub struct Box<
|
||||
|
@ -696,6 +696,7 @@ impl CString {
|
||||
// memory-unsafe code from working by accident. Inline
|
||||
// to prevent LLVM from optimizing it away in debug builds.
|
||||
#[stable(feature = "cstring_drop", since = "1.13.0")]
|
||||
#[rustc_insignificant_dtor]
|
||||
impl Drop for CString {
|
||||
#[inline]
|
||||
fn drop(&mut self) {
|
||||
|
@ -237,6 +237,7 @@ macro_rules! acquire {
|
||||
/// [rc_examples]: crate::rc#examples
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "Arc")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_insignificant_dtor]
|
||||
pub struct Arc<
|
||||
T: ?Sized,
|
||||
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
|
||||
|
@ -124,6 +124,7 @@ const TAG_SIMPLE: usize = 0b11;
|
||||
/// is_unwind_safe::<std::io::Error>();
|
||||
/// ```
|
||||
#[repr(transparent)]
|
||||
#[rustc_insignificant_dtor]
|
||||
pub(super) struct Repr(NonNull<()>, PhantomData<ErrorData<Box<Custom>>>);
|
||||
|
||||
// All the types `Repr` stores internally are Send + Sync, and so is it.
|
||||
|
Loading…
Reference in New Issue
Block a user