Ensure calculcate_dtor
is only ever called on local types
This commit is contained in:
parent
2b1c416da7
commit
51184c70c8
2 changed files with 4 additions and 4 deletions
|
@ -114,11 +114,11 @@ pub fn provide(providers: &mut Providers) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn adt_destructor(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::Destructor> {
|
fn adt_destructor(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::Destructor> {
|
||||||
tcx.calculate_dtor(def_id.to_def_id(), always_applicable::check_drop_impl)
|
tcx.calculate_dtor(def_id, always_applicable::check_drop_impl)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn adt_async_destructor(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::AsyncDestructor> {
|
fn adt_async_destructor(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::AsyncDestructor> {
|
||||||
tcx.calculate_async_dtor(def_id.to_def_id(), always_applicable::check_drop_impl)
|
tcx.calculate_async_dtor(def_id, always_applicable::check_drop_impl)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given a `DefId` for an opaque type in return position, find its parent item's return
|
/// Given a `DefId` for an opaque type in return position, find its parent item's return
|
||||||
|
|
|
@ -389,7 +389,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
/// Calculate the destructor of a given type.
|
/// Calculate the destructor of a given type.
|
||||||
pub fn calculate_dtor(
|
pub fn calculate_dtor(
|
||||||
self,
|
self,
|
||||||
adt_did: DefId,
|
adt_did: LocalDefId,
|
||||||
validate: impl Fn(Self, DefId) -> Result<(), ErrorGuaranteed>,
|
validate: impl Fn(Self, DefId) -> Result<(), ErrorGuaranteed>,
|
||||||
) -> Option<ty::Destructor> {
|
) -> Option<ty::Destructor> {
|
||||||
let drop_trait = self.lang_items().drop_trait()?;
|
let drop_trait = self.lang_items().drop_trait()?;
|
||||||
|
@ -426,7 +426,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
/// Calculate the async destructor of a given type.
|
/// Calculate the async destructor of a given type.
|
||||||
pub fn calculate_async_dtor(
|
pub fn calculate_async_dtor(
|
||||||
self,
|
self,
|
||||||
adt_did: DefId,
|
adt_did: LocalDefId,
|
||||||
validate: impl Fn(Self, DefId) -> Result<(), ErrorGuaranteed>,
|
validate: impl Fn(Self, DefId) -> Result<(), ErrorGuaranteed>,
|
||||||
) -> Option<ty::AsyncDestructor> {
|
) -> Option<ty::AsyncDestructor> {
|
||||||
let async_drop_trait = self.lang_items().async_drop_trait()?;
|
let async_drop_trait = self.lang_items().async_drop_trait()?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue