File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1083,6 +1083,18 @@ impl<'a> LoweringContext<'a> {
10831083 . chain ( in_band_defs)
10841084 . collect ( ) ;
10851085
1086+ // FIXME(const_generics): the compiler doesn't always cope with
1087+ // unsorted generic parameters at the moment, so we make sure
1088+ // that they're ordered correctly here for now. (When we chain
1089+ // the `in_band_defs`, we might make the order unsorted.)
1090+ lowered_generics. params . sort_by_key ( |param| {
1091+ match param. kind {
1092+ hir:: GenericParamKind :: Lifetime { .. } => ParamKindOrd :: Lifetime ,
1093+ hir:: GenericParamKind :: Type { .. } => ParamKindOrd :: Type ,
1094+ hir:: GenericParamKind :: Const { .. } => ParamKindOrd :: Const ,
1095+ }
1096+ } ) ;
1097+
10861098 ( lowered_generics, res)
10871099 }
10881100
Original file line number Diff line number Diff line change 1+ // run-pass
2+
3+ #![ feature( const_generics) ]
4+ //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
5+
6+ trait Trait { }
7+
8+ fn f < const N : usize > ( _: impl Trait ) { }
9+
10+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+ --> $DIR/apit-with-const-param.rs:3:12
3+ |
4+ LL | #![feature(const_generics)]
5+ | ^^^^^^^^^^^^^^
6+
You can’t perform that action at this time.
0 commit comments