@@ -19,7 +19,9 @@ use crate::ty::error::ExpectedFound;
1919use crate :: ty:: fast_reject;
2020use crate :: ty:: fold:: TypeFolder ;
2121use crate :: ty:: SubtypePredicate ;
22- use crate :: ty:: { self , AdtKind , ToPolyTraitRef , ToPredicate , Ty , TyCtxt , TypeFoldable } ;
22+ use crate :: ty:: {
23+ self , AdtKind , ToPolyTraitRef , ToPredicate , Ty , TyCtxt , TypeFoldable , WithConstness ,
24+ } ;
2325
2426use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
2527use rustc_errors:: { struct_span_err, Applicability , DiagnosticBuilder } ;
@@ -130,15 +132,15 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
130132 }
131133
132134 let ( cond, error) = match ( cond, error) {
133- ( & ty:: Predicate :: Trait ( ..) , & ty:: Predicate :: Trait ( ref error) ) => ( cond, error) ,
135+ ( & ty:: Predicate :: Trait ( ..) , & ty:: Predicate :: Trait ( ref error, _ ) ) => ( cond, error) ,
134136 _ => {
135137 // FIXME: make this work in other cases too.
136138 return false ;
137139 }
138140 } ;
139141
140142 for implication in super :: elaborate_predicates ( self . tcx , vec ! [ cond. clone( ) ] ) {
141- if let ty:: Predicate :: Trait ( implication) = implication {
143+ if let ty:: Predicate :: Trait ( implication, _ ) = implication {
142144 let error = error. to_poly_trait_ref ( ) ;
143145 let implication = implication. to_poly_trait_ref ( ) ;
144146 // FIXME: I'm just not taking associated types at all here.
@@ -530,7 +532,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
530532 return ;
531533 }
532534 match obligation. predicate {
533- ty:: Predicate :: Trait ( ref trait_predicate) => {
535+ ty:: Predicate :: Trait ( ref trait_predicate, _ ) => {
534536 let trait_predicate = self . resolve_vars_if_possible ( trait_predicate) ;
535537
536538 if self . tcx . sess . has_errors ( ) && trait_predicate. references_error ( ) {
@@ -583,7 +585,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
583585 "{}" ,
584586 message. unwrap_or_else( || format!(
585587 "the trait bound `{}` is not satisfied{}" ,
586- trait_ref. to_predicate( ) ,
588+ trait_ref. without_const ( ) . to_predicate( ) ,
587589 post_message,
588590 ) )
589591 ) ;
@@ -695,7 +697,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
695697 trait_pred
696698 } ) ;
697699 let unit_obligation = Obligation {
698- predicate : ty:: Predicate :: Trait ( predicate) ,
700+ predicate : ty:: Predicate :: Trait (
701+ predicate,
702+ ast:: Constness :: NotConst ,
703+ ) ,
699704 ..obligation. clone ( )
700705 } ;
701706 if self . predicate_may_hold ( & unit_obligation) {
@@ -988,7 +993,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
988993 ) -> PredicateObligation < ' tcx > {
989994 let new_trait_ref =
990995 ty:: TraitRef { def_id, substs : self . tcx . mk_substs_trait ( output_ty, & [ ] ) } ;
991- Obligation :: new ( cause, param_env, new_trait_ref. to_predicate ( ) )
996+ Obligation :: new ( cause, param_env, new_trait_ref. without_const ( ) . to_predicate ( ) )
992997 }
993998}
994999
@@ -1076,7 +1081,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
10761081 }
10771082
10781083 let mut err = match predicate {
1079- ty:: Predicate :: Trait ( ref data) => {
1084+ ty:: Predicate :: Trait ( ref data, _ ) => {
10801085 let trait_ref = data. to_poly_trait_ref ( ) ;
10811086 let self_ty = trait_ref. self_ty ( ) ;
10821087 debug ! ( "self_ty {:?} {:?} trait_ref {:?}" , self_ty, self_ty. kind, trait_ref) ;
@@ -1269,8 +1274,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
12691274 )
12701275 . value ;
12711276
1272- let obligation =
1273- Obligation :: new ( ObligationCause :: dummy ( ) , param_env, cleaned_pred. to_predicate ( ) ) ;
1277+ let obligation = Obligation :: new (
1278+ ObligationCause :: dummy ( ) ,
1279+ param_env,
1280+ cleaned_pred. without_const ( ) . to_predicate ( ) ,
1281+ ) ;
12741282
12751283 self . predicate_may_hold ( & obligation)
12761284 } )
0 commit comments