Skip to content

Commit f98366d

Browse files
committed
Ensure calculcate_dtor is only ever called on local types
1 parent a5b8193 commit f98366d

File tree

2 files changed

+4
-4
lines changed
  • compiler

2 files changed

+4
-4
lines changed

Diff for: compiler/rustc_hir_analysis/src/check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ pub fn provide(providers: &mut Providers) {
114114
}
115115

116116
fn adt_destructor(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::Destructor> {
117-
tcx.calculate_dtor(def_id.to_def_id(), always_applicable::check_drop_impl)
117+
tcx.calculate_dtor(def_id, always_applicable::check_drop_impl)
118118
}
119119

120120
fn adt_async_destructor(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::AsyncDestructor> {
121-
tcx.calculate_async_dtor(def_id.to_def_id(), always_applicable::check_drop_impl)
121+
tcx.calculate_async_dtor(def_id, always_applicable::check_drop_impl)
122122
}
123123

124124
/// Given a `DefId` for an opaque type in return position, find its parent item's return

Diff for: compiler/rustc_middle/src/ty/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl<'tcx> TyCtxt<'tcx> {
389389
/// Calculate the destructor of a given type.
390390
pub fn calculate_dtor(
391391
self,
392-
adt_did: DefId,
392+
adt_did: LocalDefId,
393393
validate: impl Fn(Self, DefId) -> Result<(), ErrorGuaranteed>,
394394
) -> Option<ty::Destructor> {
395395
let drop_trait = self.lang_items().drop_trait()?;
@@ -426,7 +426,7 @@ impl<'tcx> TyCtxt<'tcx> {
426426
/// Calculate the async destructor of a given type.
427427
pub fn calculate_async_dtor(
428428
self,
429-
adt_did: DefId,
429+
adt_did: LocalDefId,
430430
validate: impl Fn(Self, DefId) -> Result<(), ErrorGuaranteed>,
431431
) -> Option<ty::AsyncDestructor> {
432432
let async_drop_trait = self.lang_items().async_drop_trait()?;

0 commit comments

Comments
 (0)