@@ -658,7 +658,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
658658 & self ,
659659 trait_ref : & hir:: TraitRef < ' tcx > ,
660660 span : Span ,
661- constness : Option < ty :: BoundConstness > ,
661+ constness : hir :: BoundConstness ,
662662 polarity : ty:: PredicatePolarity ,
663663 self_ty : Ty < ' tcx > ,
664664 bounds : & mut Bounds < ' tcx > ,
@@ -681,11 +681,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
681681 Some ( self_ty) ,
682682 ) ;
683683
684- if let Some ( constness ) = constness
684+ if let hir :: BoundConstness :: Always ( span ) | hir :: BoundConstness :: Maybe ( span ) = constness
685685 && !self . tcx ( ) . is_const_trait ( trait_def_id)
686686 {
687687 self . dcx ( ) . emit_err ( crate :: errors:: ConstBoundForNonConstTrait {
688- span : trait_ref . path . span ,
688+ span,
689689 modifier : constness. as_str ( ) ,
690690 } ) ;
691691 }
@@ -708,7 +708,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
708708 bounds. push_trait_bound ( tcx, poly_trait_ref, span, polarity) ;
709709
710710 match constness {
711- Some ( ty :: BoundConstness :: Const ) => {
711+ hir :: BoundConstness :: Always ( span ) => {
712712 if polarity == ty:: PredicatePolarity :: Positive {
713713 bounds. push_const_bound (
714714 tcx,
@@ -718,13 +718,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
718718 ) ;
719719 }
720720 }
721- Some ( ty :: BoundConstness :: ConstIfConst ) => {
721+ hir :: BoundConstness :: Maybe ( _ ) => {
722722 // We don't emit a const bound here, since that would mean that we
723723 // unconditionally need to prove a `HostEffect` predicate, even when
724724 // the predicates are being instantiated in a non-const context. This
725725 // is instead handled in the `const_conditions` query.
726726 }
727- None => { }
727+ hir :: BoundConstness :: Never => { }
728728 }
729729 }
730730 // On the flip side, when filtering `ConstIfConst` bounds, we only need to convert
@@ -734,12 +734,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
734734 // here because we only call this on self bounds, and deal with the recursive case
735735 // in `lower_assoc_item_constraint`.
736736 PredicateFilter :: ConstIfConst | PredicateFilter :: SelfConstIfConst => match constness {
737- Some ( ty :: BoundConstness :: ConstIfConst ) => {
737+ hir :: BoundConstness :: Maybe ( span ) => {
738738 if polarity == ty:: PredicatePolarity :: Positive {
739739 bounds. push_const_bound ( tcx, poly_trait_ref, ty:: HostPolarity :: Maybe , span) ;
740740 }
741741 }
742- None | Some ( ty :: BoundConstness :: Const ) => { }
742+ hir :: BoundConstness :: Always ( _ ) | hir :: BoundConstness :: Never => { }
743743 } ,
744744 }
745745
0 commit comments