Skip to content

Commit ff7e441

Browse files
ssbrlcnr
andcommitted
Replace manually_drop lang item with attribute.
Co-authored-by: lcnr <[email protected]>
1 parent 416d642 commit ff7e441

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

compiler/rustc_middle/src/ty/adt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ impl AdtDefData {
243243
if Some(did) == tcx.lang_items().owned_box() {
244244
flags |= AdtFlags::IS_BOX;
245245
}
246-
if Some(did) == tcx.lang_items().manually_drop() || tcx.has_attr(did, sym::manually_drop) {
246+
if tcx.has_attr(did, sym::manually_drop) {
247247
flags |= AdtFlags::IS_MANUALLY_DROP;
248248
}
249249
if Some(did) == tcx.lang_items().unsafe_cell_type() {

library/core/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
#![feature(lang_items)]
201201
#![feature(link_llvm_intrinsics)]
202202
#![feature(macro_metavar_expr)]
203+
#![cfg_attr(not(bootstrap), feature(manually_drop_attr))]
203204
#![feature(min_specialization)]
204205
#![feature(must_not_suspend)]
205206
#![feature(negative_impls)]

library/core/src/mem/manually_drop.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ use crate::ptr;
4444
/// [`mem::zeroed`]: crate::mem::zeroed
4545
/// [`MaybeUninit<T>`]: crate::mem::MaybeUninit
4646
#[stable(feature = "manually_drop", since = "1.20.0")]
47-
#[lang = "manually_drop"]
47+
#[cfg_attr(bootstrap, lang = "manually_drop")]
48+
#[cfg_attr(not(bootstrap), manually_drop)]
4849
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
4950
#[repr(transparent)]
5051
pub struct ManuallyDrop<T: ?Sized> {

0 commit comments

Comments
 (0)