Skip to content

Commit 5b8d20f

Browse files
committed
fix(upstream): drop_in_place -> drop_glue
1 parent c5c523f commit 5b8d20f

6 files changed

Lines changed: 24 additions & 24 deletions

File tree

src/binary_analysis/reconstruct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub fn recover_fn_call_span<'tcx>(
135135
ty::EarlyBinder::bind(ty),
136136
);
137137

138-
let instance = Instance::resolve_drop_in_place(tcx, ty);
138+
let instance = Instance::resolve_drop_glue(tcx, ty);
139139
if tcx.symbol_name(instance).name != callee {
140140
continue;
141141
}

src/diagnostic/use_stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<'tcx> AnalysisCtxt<'tcx> {
9393
) {
9494
for site in use_stack.iter().rev() {
9595
let def_id = site.instance.value.def_id();
96-
if self.is_lang_item(def_id, LangItem::DropInPlace) {
96+
if self.is_lang_item(def_id, LangItem::DropGlue) {
9797
let ty = site.instance.value.args[0];
9898
diag.note(format!("which is called from drop glue of `{ty}`"));
9999
continue;

src/monomorphize_collector.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ fn check_recursion_limit<'tcx>(
485485
let recursion_depth = recursion_depths.get(&def_id).cloned().unwrap_or(0);
486486
debug!(" => recursion depth={}", recursion_depth);
487487

488-
let adjusted_recursion_depth = if Some(def_id) == tcx.lang_items().drop_in_place_fn() {
489-
// HACK: drop_in_place creates tight monomorphization loops. Give
488+
let adjusted_recursion_depth = if tcx.is_lang_item(def_id, LangItem::DropGlue) {
489+
// HACK: `drop_glue` creates tight monomorphization loops. Give
490490
// it more margin.
491491
recursion_depth / 4
492492
} else {
@@ -779,7 +779,7 @@ fn visit_drop_use<'tcx>(
779779
source: Span,
780780
output: &mut MonoItems<'tcx>,
781781
) {
782-
let instance = Instance::resolve_drop_in_place(tcx, ty);
782+
let instance = Instance::resolve_drop_glue(tcx, ty);
783783
visit_instance_use(tcx, instance, is_direct_call, source, output);
784784
}
785785

@@ -1313,7 +1313,7 @@ impl<'v> RootCollector<'_, 'v> {
13131313
});
13141314

13151315
// This type is impossible to instantiate, so we should not try to
1316-
// generate a `drop_in_place` instance for it.
1316+
// generate a `drop_glue` instance for it.
13171317
if self.tcx.instantiate_and_check_impossible_predicates((
13181318
id.owner_id.to_def_id(),
13191319
id_args,

src/preempt_count/adjustment.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,10 @@ memoize!(
418418
_ => return Err(Error::TooGeneric),
419419
}
420420

421-
// Do not call `resolve_drop_in_place` because we need typing_env.
422-
let drop_in_place = cx.require_lang_item(LangItem::DropInPlace, DUMMY_SP);
421+
// Do not call `resolve_drop_glue` because we need typing_env.
422+
let drop_glue = cx.require_lang_item(LangItem::DropGlue, DUMMY_SP);
423423
let args = cx.mk_args(&[ty.into()]);
424-
let instance = ty::Instance::try_resolve(cx.tcx, typing_env, drop_in_place, args)
424+
let instance = ty::Instance::try_resolve(cx.tcx, typing_env, drop_glue, args)
425425
.unwrap()
426426
.unwrap();
427427
let poly_instance = typing_env.as_query_input(instance);
@@ -540,10 +540,10 @@ memoize!(
540540
return Ok(());
541541
}
542542

543-
// Do not call `resolve_drop_in_place` because we need typing_env.
544-
let drop_in_place = cx.require_lang_item(LangItem::DropInPlace, DUMMY_SP);
543+
// Do not call `resolve_drop_glue` because we need typing_env.
544+
let drop_glue = cx.require_lang_item(LangItem::DropGlue, DUMMY_SP);
545545
let args = cx.mk_args(&[ty.into()]);
546-
let instance = ty::Instance::try_resolve(cx.tcx, typing_env, drop_in_place, args)
546+
let instance = ty::Instance::try_resolve(cx.tcx, typing_env, drop_glue, args)
547547
.unwrap()
548548
.unwrap();
549549

src/preempt_count/check.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,10 +726,10 @@ memoize!(
726726
_ => return Err(Error::TooGeneric),
727727
}
728728

729-
// Do not call `resolve_drop_in_place` because we need typing_env.
730-
let drop_in_place = cx.require_lang_item(LangItem::DropInPlace, DUMMY_SP);
729+
// Do not call `resolve_drop_glue` because we need typing_env.
730+
let drop_glue = cx.require_lang_item(LangItem::DropGlue, DUMMY_SP);
731731
let args = cx.mk_args(&[ty.into()]);
732-
let instance = ty::Instance::try_resolve(cx.tcx, typing_env, drop_in_place, args)
732+
let instance = ty::Instance::try_resolve(cx.tcx, typing_env, drop_glue, args)
733733
.unwrap()
734734
.unwrap();
735735
let poly_instance = typing_env.as_query_input(instance);

src/preempt_count/expectation.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,10 @@ impl<'tcx> AnalysisCtxt<'tcx> {
471471
);
472472
let span = MultiSpan::new();
473473

474-
// Do not call `resolve_drop_in_place` because we need typing_env.
475-
let drop_in_place = self.require_lang_item(LangItem::DropInPlace, DUMMY_SP);
474+
// Do not call `resolve_drop_glue` because we need typing_env.
475+
let drop_glue = self.require_lang_item(LangItem::DropGlue, DUMMY_SP);
476476
let args = self.mk_args(&[ty.into()]);
477-
let instance = ty::Instance::try_resolve(self.tcx, typing_env, drop_in_place, args)
477+
let instance = ty::Instance::try_resolve(self.tcx, typing_env, drop_glue, args)
478478
.unwrap()
479479
.unwrap();
480480

@@ -757,10 +757,10 @@ memoize!(
757757
_ => return Err(Error::TooGeneric),
758758
}
759759

760-
// Do not call `resolve_drop_in_place` because we need typing_env.
761-
let drop_in_place = cx.require_lang_item(LangItem::DropInPlace, DUMMY_SP);
760+
// Do not call `resolve_drop_glue` because we need typing_env.
761+
let drop_glue = cx.require_lang_item(LangItem::DropGlue, DUMMY_SP);
762762
let args = cx.mk_args(&[ty.into()]);
763-
let instance = ty::Instance::try_resolve(cx.tcx, typing_env, drop_in_place, args)
763+
let instance = ty::Instance::try_resolve(cx.tcx, typing_env, drop_glue, args)
764764
.unwrap()
765765
.unwrap();
766766
let poly_instance = typing_env.as_query_input(instance);
@@ -884,10 +884,10 @@ memoize!(
884884
return Ok(());
885885
}
886886

887-
// Do not call `resolve_drop_in_place` because we need typing_env.
888-
let drop_in_place = cx.require_lang_item(LangItem::DropInPlace, DUMMY_SP);
887+
// Do not call `resolve_drop_glue` because we need typing_env.
888+
let drop_glue = cx.require_lang_item(LangItem::DropGlue, DUMMY_SP);
889889
let args = cx.mk_args(&[ty.into()]);
890-
let instance = ty::Instance::try_resolve(cx.tcx, typing_env, drop_in_place, args)
890+
let instance = ty::Instance::try_resolve(cx.tcx, typing_env, drop_glue, args)
891891
.unwrap()
892892
.unwrap();
893893

0 commit comments

Comments
 (0)