move Constness into TraitPredicate

This commit is contained in:
Deadbeef
2021-07-22 21:56:07 +08:00
parent 04c9901a08
commit 32390a0df6
49 changed files with 157 additions and 124 deletions

View File

@@ -423,7 +423,7 @@ impl Checker<'mir, 'tcx> {
ty::PredicateKind::Subtype(_) => {
bug!("subtype predicate on function: {:#?}", predicate)
}
ty::PredicateKind::Trait(pred, _constness) => {
ty::PredicateKind::Trait(pred) => {
if Some(pred.def_id()) == tcx.lang_items().sized_trait() {
continue;
}
@@ -817,7 +817,10 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> {
let obligation = Obligation::new(
ObligationCause::dummy(),
param_env,
Binder::dummy(TraitPredicate { trait_ref }),
Binder::dummy(TraitPredicate {
trait_ref,
constness: hir::Constness::Const,
}),
);
let implsrc = tcx.infer_ctxt().enter(|infcx| {

View File

@@ -132,7 +132,7 @@ impl<'a, 'tcx> FunctionItemRefChecker<'a, 'tcx> {
/// If the given predicate is the trait `fmt::Pointer`, returns the bound parameter type.
fn is_pointer_trait(&self, bound: &PredicateKind<'tcx>) -> Option<Ty<'tcx>> {
if let ty::PredicateKind::Trait(predicate, _) = bound {
if let ty::PredicateKind::Trait(predicate) = bound {
if self.tcx.is_diagnostic_item(sym::pointer_trait, predicate.def_id()) {
Some(predicate.trait_ref.self_ty())
} else {