@@ -658,7 +658,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
658
658
& self ,
659
659
trait_ref : & hir:: TraitRef < ' tcx > ,
660
660
span : Span ,
661
- constness : Option < ty :: BoundConstness > ,
661
+ constness : hir :: BoundConstness ,
662
662
polarity : ty:: PredicatePolarity ,
663
663
self_ty : Ty < ' tcx > ,
664
664
bounds : & mut Bounds < ' tcx > ,
@@ -681,11 +681,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
681
681
Some ( self_ty) ,
682
682
) ;
683
683
684
- if let Some ( constness ) = constness
684
+ if let hir :: BoundConstness :: Always ( span ) | hir :: BoundConstness :: Maybe ( span ) = constness
685
685
&& !self . tcx ( ) . is_const_trait ( trait_def_id)
686
686
{
687
687
self . dcx ( ) . emit_err ( crate :: errors:: ConstBoundForNonConstTrait {
688
- span : trait_ref . path . span ,
688
+ span,
689
689
modifier : constness. as_str ( ) ,
690
690
} ) ;
691
691
}
@@ -708,7 +708,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
708
708
bounds. push_trait_bound ( tcx, poly_trait_ref, span, polarity) ;
709
709
710
710
match constness {
711
- Some ( ty :: BoundConstness :: Const ) => {
711
+ hir :: BoundConstness :: Always ( span ) => {
712
712
if polarity == ty:: PredicatePolarity :: Positive {
713
713
bounds. push_const_bound (
714
714
tcx,
@@ -718,13 +718,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
718
718
) ;
719
719
}
720
720
}
721
- Some ( ty :: BoundConstness :: ConstIfConst ) => {
721
+ hir :: BoundConstness :: Maybe ( _ ) => {
722
722
// We don't emit a const bound here, since that would mean that we
723
723
// unconditionally need to prove a `HostEffect` predicate, even when
724
724
// the predicates are being instantiated in a non-const context. This
725
725
// is instead handled in the `const_conditions` query.
726
726
}
727
- None => { }
727
+ hir :: BoundConstness :: Never => { }
728
728
}
729
729
}
730
730
// On the flip side, when filtering `ConstIfConst` bounds, we only need to convert
@@ -734,12 +734,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
734
734
// here because we only call this on self bounds, and deal with the recursive case
735
735
// in `lower_assoc_item_constraint`.
736
736
PredicateFilter :: ConstIfConst | PredicateFilter :: SelfConstIfConst => match constness {
737
- Some ( ty :: BoundConstness :: ConstIfConst ) => {
737
+ hir :: BoundConstness :: Maybe ( span ) => {
738
738
if polarity == ty:: PredicatePolarity :: Positive {
739
739
bounds. push_const_bound ( tcx, poly_trait_ref, ty:: HostPolarity :: Maybe , span) ;
740
740
}
741
741
}
742
- None | Some ( ty :: BoundConstness :: Const ) => { }
742
+ hir :: BoundConstness :: Always ( _ ) | hir :: BoundConstness :: Never => { }
743
743
} ,
744
744
}
745
745
0 commit comments