rename `drop_in_place` lang item to `drop_glue`
diff --git a/compiler/rustc_codegen_cranelift/example/mini_core.rs b/compiler/rustc_codegen_cranelift/example/mini_core.rs index ab9d2a7..08adec9 100644 --- a/compiler/rustc_codegen_cranelift/example/mini_core.rs +++ b/compiler/rustc_codegen_cranelift/example/mini_core.rs
@@ -575,14 +575,10 @@ fn panic_in_cleanup() -> ! { fn _Unwind_Resume(exc: *mut ()) -> !; } -#[lang = "drop_in_place"] -#[allow(unconditional_recursion)] -pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { +#[lang = "drop_glue"] +pub unsafe fn drop_glue<T: ?Sized>(_to_drop: &mut T) { // Code here does not matter - this is replaced by the // real drop glue by the compiler. - unsafe { - drop_in_place(to_drop); - } } #[lang = "unpin"]
diff --git a/compiler/rustc_codegen_cranelift/src/abi/mod.rs b/compiler/rustc_codegen_cranelift/src/abi/mod.rs index 13f5ad5..6a27b81 100644 --- a/compiler/rustc_codegen_cranelift/src/abi/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/abi/mod.rs
@@ -701,7 +701,7 @@ pub(crate) fn codegen_drop<'tcx>( unwind: UnwindAction, ) { let ty = drop_place.layout().ty; - let drop_instance = Instance::resolve_drop_in_place(fx.tcx, ty); + let drop_instance = Instance::resolve_drop_glue(fx.tcx, ty); let ret_block = fx.get_block(target); // AsyncDropGlueCtorShim can't be here @@ -734,7 +734,7 @@ pub(crate) fn codegen_drop<'tcx>( fx.bcx.switch_to_block(continued); // FIXME(eddyb) perhaps move some of this logic into - // `Instance::resolve_drop_in_place`? + // `Instance::resolve_drop_glue`? let virtual_drop = Instance { def: ty::InstanceKind::Virtual(drop_instance.def_id(), 0), args: drop_instance.args,
diff --git a/compiler/rustc_codegen_gcc/example/mini_core.rs b/compiler/rustc_codegen_gcc/example/mini_core.rs index 481fe53..2d5a29c 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core.rs +++ b/compiler/rustc_codegen_gcc/example/mini_core.rs
@@ -577,12 +577,10 @@ fn eh_personality() -> ! { loop {} } -#[lang = "drop_in_place"] -#[allow(unconditional_recursion)] -pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { +#[lang = "drop_glue"] +pub unsafe fn drop_glue<T: ?Sized>(_to_drop: &mut T) { // Code here does not matter - this is replaced by the // real drop glue by the compiler. - drop_in_place(to_drop); } #[lang = "unpin"]
diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index 2460bf1..014fd5c 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs
@@ -403,7 +403,7 @@ fn upstream_monomorphizations_provider( let mut instances: DefIdMap<UnordMap<_, _>> = Default::default(); - let drop_in_place_fn_def_id = tcx.lang_items().drop_in_place_fn(); + let drop_glue_fn_def_id = tcx.lang_items().drop_glue_fn(); let async_drop_in_place_fn_def_id = tcx.lang_items().async_drop_in_place_fn(); for &cnum in cnums.iter() { @@ -411,11 +411,10 @@ fn upstream_monomorphizations_provider( let (def_id, args) = match *exported_symbol { ExportedSymbol::Generic(def_id, args) => (def_id, args), ExportedSymbol::DropGlue(ty) => { - if let Some(drop_in_place_fn_def_id) = drop_in_place_fn_def_id { + if let Some(drop_in_place_fn_def_id) = drop_glue_fn_def_id { (drop_in_place_fn_def_id, tcx.mk_args(&[ty.into()])) } else { - // `drop_in_place` in place does not exist, don't try - // to use it. + // `drop_glue` does not exist, don't try to use it. continue; } } @@ -465,7 +464,7 @@ fn upstream_drop_glue_for_provider<'tcx>( tcx: TyCtxt<'tcx>, args: GenericArgsRef<'tcx>, ) -> Option<CrateNum> { - let def_id = tcx.lang_items().drop_in_place_fn()?; + let def_id = tcx.lang_items().drop_glue_fn()?; tcx.upstream_monomorphizations_for(def_id)?.get(&args).cloned() } @@ -587,7 +586,7 @@ pub(crate) fn symbol_name_for_instance_in_crate<'tcx>( } ExportedSymbol::DropGlue(ty) => rustc_symbol_mangling::symbol_name_for_instance_in_crate( tcx, - Instance::resolve_drop_in_place(tcx, ty), + Instance::resolve_drop_glue(tcx, ty), instantiating_crate, ), ExportedSymbol::AsyncDropGlueCtorShim(ty) => {
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index 55001d8..f4e08e0 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs
@@ -603,7 +603,7 @@ fn codegen_drop_terminator( ) -> MergingSucc { let ty = location.ty(self.mir, bx.tcx()).ty; let ty = self.monomorphize(ty); - let drop_fn = Instance::resolve_drop_in_place(bx.tcx(), ty); + let drop_fn = Instance::resolve_drop_glue(bx.tcx(), ty); if let ty::InstanceKind::DropGlue(_, None) = drop_fn.def { // we don't actually need to drop anything. @@ -621,7 +621,7 @@ fn codegen_drop_terminator( }; let (maybe_null, drop_fn, fn_abi, drop_instance) = match ty.kind() { // FIXME(eddyb) perhaps move some of this logic into - // `Instance::resolve_drop_in_place`? + // `Instance::resolve_drop_glue`? ty::Dynamic(_, _) => { // IN THIS ARM, WE HAVE: // ty = *mut (dyn Trait)
diff --git a/compiler/rustc_const_eval/src/interpret/call.rs b/compiler/rustc_const_eval/src/interpret/call.rs index 7043c56..0f93dbf 100644 --- a/compiler/rustc_const_eval/src/interpret/call.rs +++ b/compiler/rustc_const_eval/src/interpret/call.rs
@@ -895,16 +895,15 @@ pub(super) fn init_drop_in_place_call( _ => { debug_assert_eq!( instance, - ty::Instance::resolve_drop_in_place(*self.tcx, place.layout.ty) + ty::Instance::resolve_drop_glue(*self.tcx, place.layout.ty) ); place } }; let instance = { - let _trace = - enter_trace_span!(M, resolve::resolve_drop_in_place, ty = ?place.layout.ty); - ty::Instance::resolve_drop_in_place(*self.tcx, place.layout.ty) + let _trace = enter_trace_span!(M, resolve::resolve_drop_glue, ty = ?place.layout.ty); + ty::Instance::resolve_drop_glue(*self.tcx, place.layout.ty) }; let fn_abi = self.fn_abi_of_instance_no_deduced_attrs(instance, ty::List::empty())?;
diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs index bac03cf..6aa2971 100644 --- a/compiler/rustc_const_eval/src/interpret/step.rs +++ b/compiler/rustc_const_eval/src/interpret/step.rs
@@ -593,8 +593,8 @@ fn eval_terminator(&mut self, terminator: &mir::Terminator<'tcx>) -> InterpResul let place = self.eval_place(place)?; let instance = { let _trace = - enter_trace_span!(M, resolve::resolve_drop_in_place, ty = ?place.layout.ty); - Instance::resolve_drop_in_place(*self.tcx, place.layout.ty) + enter_trace_span!(M, resolve::resolve_drop_glue, ty = ?place.layout.ty); + Instance::resolve_drop_glue(*self.tcx, place.layout.ty) }; if let ty::InstanceKind::DropGlue(_, None) = instance.def { // This is the branch we enter if and only if the dropped type has no drop glue
diff --git a/compiler/rustc_hir/src/lang_items.rs b/compiler/rustc_hir/src/lang_items.rs index ea014e8..133efb7 100644 --- a/compiler/rustc_hir/src/lang_items.rs +++ b/compiler/rustc_hir/src/lang_items.rs
@@ -321,7 +321,8 @@ fn stable_hash<Hcx: StableHashCtxt>(&self, _: &mut Hcx, hasher: &mut StableHashe FormatArgument, sym::format_argument, format_argument, Target::Struct, GenericRequirement::None; FormatArguments, sym::format_arguments, format_arguments, Target::Struct, GenericRequirement::None; - DropInPlace, sym::drop_in_place, drop_in_place_fn, Target::Fn, GenericRequirement::Minimum(1); + // Compiler-generated drop glue function, aka `core::ptr::drop_glue` + DropGlue, sym::drop_glue, drop_glue_fn, Target::Fn, GenericRequirement::Exact(1); AllocLayout, sym::alloc_layout, alloc_layout, Target::Struct, GenericRequirement::None; /// For all binary crates without `#![no_main]`, Rust will generate a "main" function.
diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs index 492d21b..be2a7c2 100644 --- a/compiler/rustc_middle/src/hir/mod.rs +++ b/compiler/rustc_middle/src/hir/mod.rs
@@ -300,8 +300,8 @@ pub fn expr_guaranteed_to_constitute_read_for_never(self, expr: &Expr<'_>) -> bo Node::Expr(parent_expr) => { match parent_expr.kind { // Addr-of, field projections, and LHS of assignment don't constitute reads. - // Assignment does call `drop_in_place`, though, but its safety - // requirements are not the same. + // Assignment does call `drop_glue`, though, but its safety requirements are + // not the same. ExprKind::AddrOf(..) | ExprKind::Field(..) => false, // Place-preserving expressions only constitute reads if their
diff --git a/compiler/rustc_middle/src/middle/exported_symbols.rs b/compiler/rustc_middle/src/middle/exported_symbols.rs index fbf6d16..fb77007 100644 --- a/compiler/rustc_middle/src/middle/exported_symbols.rs +++ b/compiler/rustc_middle/src/middle/exported_symbols.rs
@@ -66,7 +66,7 @@ pub fn symbol_name_for_local_instance(&self, tcx: TyCtxt<'tcx>) -> ty::SymbolNam tcx.symbol_name(ty::Instance::new_raw(def_id, args)) } ExportedSymbol::DropGlue(ty) => { - tcx.symbol_name(ty::Instance::resolve_drop_in_place(tcx, ty)) + tcx.symbol_name(ty::Instance::resolve_drop_glue(tcx, ty)) } ExportedSymbol::AsyncDropGlueCtorShim(ty) => { tcx.symbol_name(ty::Instance::resolve_async_drop_in_place(tcx, ty))
diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs index 3d320d4..0eeefd4 100644 --- a/compiler/rustc_middle/src/mir/syntax.rs +++ b/compiler/rustc_middle/src/mir/syntax.rs
@@ -743,7 +743,7 @@ pub enum TerminatorKind<'tcx> { /// /// After drop elaboration: `Drop` terminators are a complete nop for types that have no drop /// glue. For other types, `Drop` terminators behave exactly like a call to - /// `core::mem::drop_in_place` with a pointer to the given place. + /// `core::mem::drop_glue` with a reference to the given place. /// /// `Drop` before drop elaboration is a *conditional* execution of the drop glue. Specifically, /// the `Drop` will be executed if...
diff --git a/compiler/rustc_middle/src/mono.rs b/compiler/rustc_middle/src/mono.rs index ca89ad9..cdc440d 100644 --- a/compiler/rustc_middle/src/mono.rs +++ b/compiler/rustc_middle/src/mono.rs
@@ -70,7 +70,7 @@ fn opt_incr_drop_glue_mode<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Instantiati let Some(dtor) = adt_def.destructor(tcx) else { // We use LocalCopy for drops of enums only; this code is inherited from // https://github.com/rust-lang/rust/pull/67332 and the theory is that we get to optimize - // out code like drop_in_place(Option::None) before crate-local ThinLTO, which improves + // out code like `drop_glue(&mut Option::None)` before crate-local ThinLTO, which improves // compile time. At the time of writing, simply removing this entire check does seem to // regress incr-opt compile times. But it sure seems like a more sophisticated check could // do better here. @@ -81,8 +81,8 @@ fn opt_incr_drop_glue_mode<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Instantiati } }; - // We've gotten to a drop_in_place for a type that directly implements Drop. - // The drop glue is a wrapper for the Drop::drop impl, and we are an optimized build, so in an + // We've gotten to a `drop_glue` for a type that directly implements Drop. + // The drop glue is a wrapper for the `Drop::drop` impl, and we are an optimized build, so in an // effort to coordinate with the mode that the actual impl will get, we make the glue also // LocalCopy. if tcx.cross_crate_inlinable(dtor.did) {
diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs index d425ba7..1d761c2 100644 --- a/compiler/rustc_middle/src/ty/instance.rs +++ b/compiler/rustc_middle/src/ty/instance.rs
@@ -147,11 +147,10 @@ pub enum InstanceKind<'tcx> { /// Proxy shim for async drop of future (def_id, proxy_cor_ty, impl_cor_ty) FutureDropPollShim(DefId, Ty<'tcx>, Ty<'tcx>), - /// `core::ptr::drop_in_place::<T>`. + /// `core::ptr::drop_glue::<T>`. /// - /// The `DefId` is for `core::ptr::drop_in_place`. - /// The `Option<Ty<'tcx>>` is either `Some(T)`, or `None` for empty drop - /// glue. + /// The `DefId` is for `core::ptr::drop_glue`. + /// The `Option<Ty<'tcx>>` is either `Some(T)`, or `None` for empty drop glue. DropGlue(DefId, Option<Ty<'tcx>>), /// Compiler-generated `<T as Clone>::clone` implementation. @@ -716,8 +715,8 @@ pub fn resolve_closure( } } - pub fn resolve_drop_in_place(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ty::Instance<'tcx> { - let def_id = tcx.require_lang_item(LangItem::DropInPlace, DUMMY_SP); + pub fn resolve_drop_glue(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ty::Instance<'tcx> { + let def_id = tcx.require_lang_item(LangItem::DropGlue, DUMMY_SP); let args = tcx.mk_args(&[ty.into()]); Instance::expect_resolve( tcx,
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 7155df0..e38e539 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -1221,12 +1221,12 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: ExternAbi) return false; } - // With -Z panic-in-drop=abort, drop_in_place never unwinds. + // With -Z panic-in-drop=abort, `drop_glue` never unwinds. // // This is not part of `codegen_fn_attrs` as it can differ between crates // and therefore cannot be computed in core. if !tcx.sess.opts.unstable_opts.panic_in_drop.unwinds() - && tcx.is_lang_item(did, LangItem::DropInPlace) + && tcx.is_lang_item(did, LangItem::DropGlue) { return false; }
diff --git a/compiler/rustc_middle/src/ty/vtable.rs b/compiler/rustc_middle/src/ty/vtable.rs index 26d950b..fb56bda 100644 --- a/compiler/rustc_middle/src/ty/vtable.rs +++ b/compiler/rustc_middle/src/ty/vtable.rs
@@ -122,7 +122,7 @@ pub(super) fn vtable_allocation_provider<'tcx>( let scalar = match *entry { VtblEntry::MetadataDropInPlace => { if ty.needs_drop(tcx, ty::TypingEnv::fully_monomorphized()) { - let instance = ty::Instance::resolve_drop_in_place(tcx, ty); + let instance = ty::Instance::resolve_drop_glue(tcx, ty); let fn_alloc_id = tcx.reserve_and_set_fn_alloc(instance, CTFE_ALLOC_SALT); let fn_ptr = Pointer::from(fn_alloc_id); Scalar::from_pointer(fn_ptr, &tcx)
diff --git a/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs b/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs index 2216669..46d5773 100644 --- a/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs +++ b/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs
@@ -10,6 +10,7 @@ /// they are dropped from an aligned address. /// /// For example, if we have something like +/// /// ```ignore (illustrative) /// #[repr(packed)] /// struct Foo { @@ -20,9 +21,8 @@ /// let foo = ...; /// ``` /// -/// We want to call `drop_in_place::<Vec<u8>>` on `data` from an aligned -/// address. This means we can't simply drop `foo.data` directly, because -/// its address is not aligned. +/// We want to call `drop_glue::<Vec<u8>>` with a reference to `data`, which must be aligned. +/// This means we can't simply drop `foo.data` directly, because its address is not aligned. /// /// Instead, we move `foo.data` to a local and drop that: /// ```ignore (illustrative)
diff --git a/compiler/rustc_mir_transform/src/coroutine/drop.rs b/compiler/rustc_mir_transform/src/coroutine/drop.rs index 0e2e59e..372f711 100644 --- a/compiler/rustc_mir_transform/src/coroutine/drop.rs +++ b/compiler/rustc_mir_transform/src/coroutine/drop.rs
@@ -569,7 +569,7 @@ pub(super) fn create_coroutine_drop_shim<'tcx>( // not a coroutine body itself; it just has its drop built out of it. let _ = body.coroutine.take(); // Make sure the resume argument is not included here, since we're - // building a body for `drop_in_place`. + // building a body for `drop_glue`. body.arg_count = 1; let source_info = SourceInfo::outermost(body.span); @@ -602,8 +602,8 @@ pub(super) fn create_coroutine_drop_shim<'tcx>( // Update the body's def to become the drop glue. let coroutine_instance = body.source.instance; - let drop_in_place = tcx.require_lang_item(LangItem::DropInPlace, body.span); - let drop_instance = InstanceKind::DropGlue(drop_in_place, Some(coroutine_ty)); + let drop_glue = tcx.require_lang_item(LangItem::DropGlue, body.span); + let drop_instance = InstanceKind::DropGlue(drop_glue, Some(coroutine_ty)); // Temporary change MirSource to coroutine's instance so that dump_mir produces more sensible // filename.
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index f819ee4..47c5967 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs
@@ -656,8 +656,8 @@ fn check_recursion_limit<'tcx>( let recursion_depth = recursion_depths.get(&def_id).cloned().unwrap_or(0); debug!(" => recursion depth={}", recursion_depth); - let adjusted_recursion_depth = if tcx.is_lang_item(def_id, LangItem::DropInPlace) { - // HACK: drop_in_place creates tight monomorphization loops. Give + let adjusted_recursion_depth = if tcx.is_lang_item(def_id, LangItem::DropGlue) { + // HACK: `drop_glue` creates tight monomorphization loops. Give // it more margin. recursion_depth / 4 } else { @@ -935,7 +935,7 @@ fn visit_drop_use<'tcx>( source: Span, output: &mut MonoItems<'tcx>, ) { - let instance = Instance::resolve_drop_in_place(tcx, ty); + let instance = Instance::resolve_drop_glue(tcx, ty); visit_instance_use(tcx, instance, is_direct_call, source, output); } @@ -1529,7 +1529,7 @@ fn process_item(&mut self, id: hir::ItemId) { }); // This type is impossible to instantiate, so we should not try to - // generate a `drop_in_place` instance for it. + // generate a `drop_glue` instance for it. if self.tcx.instantiate_and_check_impossible_predicates(( id.owner_id.to_def_id(), id_args,
diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index 05914f4..6058cb8 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs
@@ -663,9 +663,8 @@ fn characteristic_def_id_of_mono_item<'tcx>( && tcx.sess.opts.incremental.is_some() && tcx.is_lang_item(tcx.impl_trait_id(impl_def_id), LangItem::Drop) { - // Put `Drop::drop` into the same cgu as `drop_in_place` - // since `drop_in_place` is the only thing that can - // call it. + // Put `Drop::drop` into the same cgu as `drop_glue` + // since `drop_glue` is the only thing that can call it. return None; }
diff --git a/compiler/rustc_passes/src/lang_items.rs b/compiler/rustc_passes/src/lang_items.rs index b6fb993..527c618 100644 --- a/compiler/rustc_passes/src/lang_items.rs +++ b/compiler/rustc_passes/src/lang_items.rs
@@ -193,7 +193,7 @@ fn collect_item_extended( // one (for the RHS/index), unary operations have none, the closure // traits have one for the argument list, coroutines have one for the // resume argument, and ordering/equality relations have one for the RHS - // Some other types like Box and various functions like drop_in_place + // Some other types like Box and various unsizing-related traits // have minimum requirements. // FIXME: This still doesn't count, e.g., elided lifetimes and APITs.
diff --git a/compiler/rustc_public_bridge/src/context/impls.rs b/compiler/rustc_public_bridge/src/context/impls.rs index 260b9cd..490dcbe 100644 --- a/compiler/rustc_public_bridge/src/context/impls.rs +++ b/compiler/rustc_public_bridge/src/context/impls.rs
@@ -665,7 +665,7 @@ pub fn resolve_instance( /// Resolve an instance for drop_in_place for the given type. pub fn resolve_drop_in_place(&self, internal_ty: Ty<'tcx>) -> Instance<'tcx> { - let instance = Instance::resolve_drop_in_place(self.tcx, internal_ty); + let instance = Instance::resolve_drop_glue(self.tcx, internal_ty); instance }
diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs index 8b7d906..c5a889d 100644 --- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs +++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs
@@ -309,7 +309,7 @@ pub(crate) fn transform_instance<'tcx>( ) -> Instance<'tcx> { // FIXME: account for async-drop-glue if (matches!(instance.def, ty::InstanceKind::Virtual(..)) - && tcx.is_lang_item(instance.def_id(), LangItem::DropInPlace)) + && tcx.is_lang_item(instance.def_id(), LangItem::DropGlue)) || matches!(instance.def, ty::InstanceKind::DropGlue(..)) { // Adjust the type ids of DropGlues
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 695103a..7fba886 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs
@@ -835,6 +835,7 @@ dreg_low8, dreg_low16, drop, + drop_glue, drop_in_place, drop_types_in_const, dropck_eyepatch,
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs index b11965d..02739ef 100644 --- a/compiler/rustc_ty_utils/src/abi.rs +++ b/compiler/rustc_ty_utils/src/abi.rs
@@ -343,8 +343,7 @@ fn arg_attrs_for_rust_scalar<'tcx>( // Only pointer types handled below. let Scalar::Initialized { value: Pointer(_), valid_range } = scalar else { return attrs }; - // Set `nonnull` if the validity range excludes zero, or for the argument to `drop_in_place`, - // which must be nonnull per its documented safety requirements. + // Set `nonnull` if the validity range excludes zero. if !valid_range.contains(0) { attrs.set(ArgAttribute::NonNull); }
diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs index c6e8ae4..9c84819 100644 --- a/compiler/rustc_ty_utils/src/instance.rs +++ b/compiler/rustc_ty_utils/src/instance.rs
@@ -35,7 +35,7 @@ fn resolve_instance_raw<'tcx>( let def = if tcx.intrinsic(def_id).is_some() { debug!(" => intrinsic"); ty::InstanceKind::Intrinsic(def_id) - } else if tcx.is_lang_item(def_id, LangItem::DropInPlace) { + } else if tcx.is_lang_item(def_id, LangItem::DropGlue) { let ty = args.type_at(0); if ty.needs_drop(tcx, typing_env) {
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index a5aa92a..93cc3e2 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs
@@ -821,7 +821,7 @@ } /// Helper function for `drop_in_place`. The compiler replaces this by the actual drop glue. -#[lang = "drop_in_place"] +#[lang = "drop_glue"] const unsafe fn drop_glue<T: PointeeSized>(_: &mut T) where T: [const] Destruct,
diff --git a/library/rtstartup/rsbegin.rs b/library/rtstartup/rsbegin.rs index 6ee06cc..a8265a3 100644 --- a/library/rtstartup/rsbegin.rs +++ b/library/rtstartup/rsbegin.rs
@@ -39,12 +39,10 @@ trait Copy {} impl<T: PointeeSized> Copy for *mut T {} -#[lang = "drop_in_place"] +#[cfg_attr(not(bootstrap), lang = "drop_glue")] +#[cfg_attr(bootstrap, lang = "drop_in_place")] #[inline] -#[allow(unconditional_recursion)] -pub unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T) { - drop_in_place(to_drop); -} +pub unsafe fn drop_glue<T: PointeeSized>(_to_drop: &mut T) {} // Frame unwind info registration //
diff --git a/library/rtstartup/rsend.rs b/library/rtstartup/rsend.rs index d763971..2e69559 100644 --- a/library/rtstartup/rsend.rs +++ b/library/rtstartup/rsend.rs
@@ -27,12 +27,10 @@ trait Copy {} impl<T: PointeeSized> Copy for *mut T {} -#[lang = "drop_in_place"] +#[cfg_attr(not(bootstrap), lang = "drop_glue")] +#[cfg_attr(bootstrap, lang = "drop_in_place")] #[inline] -#[allow(unconditional_recursion)] -pub unsafe fn drop_in_place<T: PointeeSized>(to_drop: *mut T) { - drop_in_place(to_drop); -} +pub unsafe fn drop_glue<T: PointeeSized>(_to_drop: &mut T) {} #[cfg(all(target_os = "windows", target_arch = "x86", target_env = "gnu"))] pub mod eh_frames {
diff --git a/tests/assembly-llvm/large_data_threshold.rs b/tests/assembly-llvm/large_data_threshold.rs index f3b37eb..f593a2a 100644 --- a/tests/assembly-llvm/large_data_threshold.rs +++ b/tests/assembly-llvm/large_data_threshold.rs
@@ -20,8 +20,8 @@ pub trait MetaSized: PointeeSized {} #[lang = "sized"] pub trait Sized: MetaSized {} -#[lang = "drop_in_place"] -fn drop_in_place<T>(_: *mut T) {} +#[lang = "drop_glue"] +fn drop_glue<T>(_: &mut T) {} #[used] #[no_mangle]
diff --git a/tests/assembly-llvm/small_data_threshold.rs b/tests/assembly-llvm/small_data_threshold.rs index 2abe868..664f36d 100644 --- a/tests/assembly-llvm/small_data_threshold.rs +++ b/tests/assembly-llvm/small_data_threshold.rs
@@ -28,8 +28,8 @@ pub trait MetaSized: PointeeSized {} #[lang = "sized"] pub trait Sized: MetaSized {} -#[lang = "drop_in_place"] -fn drop_in_place<T>(_: *mut T) {} +#[lang = "drop_glue"] +fn drop_glue<T>(_: &mut T) {} #[used] #[no_mangle]
diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index 4830253..c949d88 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs
@@ -300,8 +300,8 @@ impl Sync for () {} impl<T, const N: usize> Sync for [T; N] {} -#[lang = "drop_in_place"] -fn drop_in_place<T>(_: *mut T) {} +#[lang = "drop_glue"] +fn drop_glue<T>(_: &mut T) {} #[lang = "fn_once"] pub trait FnOnce<Args: Tuple> {
diff --git a/tests/run-make/arm64ec-import-export-static/export.rs b/tests/run-make/arm64ec-import-export-static/export.rs index ca6ccf0..79aedaa 100644 --- a/tests/run-make/arm64ec-import-export-static/export.rs +++ b/tests/run-make/arm64ec-import-export-static/export.rs
@@ -17,8 +17,8 @@ impl Sync for i32 {} #[lang = "copy"] pub trait Copy {} impl Copy for i32 {} -#[lang = "drop_in_place"] -pub unsafe fn drop_in_place<T: ?Sized>(_: *mut T) {} +#[lang = "drop_glue"] +pub unsafe fn drop_glue<T: ?Sized>(_: &mut T) {} #[no_mangle] extern "system" fn _DllMainCRTStartup(_: *const u8, _: u32, _: *const u8) -> u32 { 1
diff --git a/tests/run-make/min-global-align/min_global_align.rs b/tests/run-make/min-global-align/min_global_align.rs index fd6f835..ee668e5 100644 --- a/tests/run-make/min-global-align/min_global_align.rs +++ b/tests/run-make/min-global-align/min_global_align.rs
@@ -34,5 +34,5 @@ trait Sync {} impl Sync for bool {} impl Sync for &'static bool {} -#[lang = "drop_in_place"] -pub unsafe fn drop_in_place<T: ?Sized>(_: *mut T) {} +#[lang = "drop_glue"] +pub unsafe fn drop_glue<T: ?Sized>(_: &mut T) {}
diff --git a/tests/ui/lang-items/issue-87573.rs b/tests/ui/lang-items/issue-87573.rs index 97146df..e16fc1f 100644 --- a/tests/ui/lang-items/issue-87573.rs +++ b/tests/ui/lang-items/issue-87573.rs
@@ -23,12 +23,12 @@ trait Copy {} trait Sync {} impl Sync for bool {} -#[lang = "drop_in_place"] -//~^ ERROR: `drop_in_place` lang item must be applied to a function with at least 1 generic argument +#[lang = "drop_glue"] +//~^ ERROR: `drop_glue` lang item must be applied to a function with 1 generic argument fn drop_fn() { while false {} } #[lang = "start"] //~^ ERROR: `start` lang item must be applied to a function with 1 generic argument -fn start(){} +fn start() {}
diff --git a/tests/ui/lang-items/issue-87573.stderr b/tests/ui/lang-items/issue-87573.stderr index 07f4f5d..08af323 100644 --- a/tests/ui/lang-items/issue-87573.stderr +++ b/tests/ui/lang-items/issue-87573.stderr
@@ -1,8 +1,8 @@ -error[E0718]: `drop_in_place` lang item must be applied to a function with at least 1 generic argument +error[E0718]: `drop_glue` lang item must be applied to a function with 1 generic argument --> $DIR/issue-87573.rs:26:1 | -LL | #[lang = "drop_in_place"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[lang = "drop_glue"] + | ^^^^^^^^^^^^^^^^^^^^^ LL | LL | fn drop_fn() { | - this function has 0 generic arguments @@ -13,7 +13,7 @@ LL | #[lang = "start"] | ^^^^^^^^^^^^^^^^^ LL | -LL | fn start(){} +LL | fn start() {} | - this function has 0 generic arguments error: aborting due to 2 previous errors
diff --git a/tests/ui/lang-items/lang-item-generic-requirements.rs b/tests/ui/lang-items/lang-item-generic-requirements.rs index 2f80567..38348c7 100644 --- a/tests/ui/lang-items/lang-item-generic-requirements.rs +++ b/tests/ui/lang-items/lang-item-generic-requirements.rs
@@ -17,8 +17,8 @@ trait MySized: MyMetaSized {} trait MyAdd<'a, T> {} //~^^ ERROR: `add` lang item must be applied to a trait with 1 generic argument [E0718] -#[lang = "drop_in_place"] -//~^ ERROR `drop_in_place` lang item must be applied to a function with at least 1 generic +#[lang = "drop_glue"] +//~^ ERROR `drop_glue` lang item must be applied to a function with 1 generic fn my_ptr_drop() {} #[lang = "index"]
diff --git a/tests/ui/lang-items/lang-item-generic-requirements.stderr b/tests/ui/lang-items/lang-item-generic-requirements.stderr index 0b3088a..4526722 100644 --- a/tests/ui/lang-items/lang-item-generic-requirements.stderr +++ b/tests/ui/lang-items/lang-item-generic-requirements.stderr
@@ -6,11 +6,11 @@ LL | trait MyAdd<'a, T> {} | ------- this trait has 2 generic arguments -error[E0718]: `drop_in_place` lang item must be applied to a function with at least 1 generic argument +error[E0718]: `drop_glue` lang item must be applied to a function with 1 generic argument --> $DIR/lang-item-generic-requirements.rs:20:1 | -LL | #[lang = "drop_in_place"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[lang = "drop_glue"] + | ^^^^^^^^^^^^^^^^^^^^^ LL | LL | fn my_ptr_drop() {} | - this function has 0 generic arguments