1
Fork 0

Check drop is trivial before checking ty needs drop

This commit is contained in:
Michael Goulet 2024-11-21 23:20:59 +00:00
parent af0d566e76
commit 69a38de977
12 changed files with 57 additions and 180 deletions

View file

@ -4,7 +4,7 @@
pub mod tls;
use std::assert_matches::assert_matches;
use std::assert_matches::{assert_matches, debug_assert_matches};
use std::borrow::Borrow;
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
@ -377,14 +377,17 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
}
fn impl_is_const(self, def_id: DefId) -> bool {
debug_assert_matches!(self.def_kind(def_id), DefKind::Impl { of_trait: true });
self.is_conditionally_const(def_id)
}
fn fn_is_const(self, def_id: DefId) -> bool {
debug_assert_matches!(self.def_kind(def_id), DefKind::Fn | DefKind::AssocFn);
self.is_conditionally_const(def_id)
}
fn alias_has_const_conditions(self, def_id: DefId) -> bool {
debug_assert_matches!(self.def_kind(def_id), DefKind::AssocTy | DefKind::OpaqueTy);
self.is_conditionally_const(def_id)
}