Skip to content

Commit

Permalink
Sort in-band generic parameter definitions from APIT
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed May 29, 2019
1 parent 7212685 commit eafa3a8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,18 @@ impl<'a> LoweringContext<'a> {
.chain(in_band_defs)
.collect();

// FIXME(const_generics): the compiler doesn't always cope with
// unsorted generic parameters at the moment, so we make sure
// that they're ordered correctly here for now. (When we chain
// the `in_band_defs`, we might make the order unsorted.)
lowered_generics.params.sort_by_key(|param| {
match param.kind {
hir::GenericParamKind::Lifetime { .. } => ParamKindOrd::Lifetime,
hir::GenericParamKind::Type { .. } => ParamKindOrd::Type,
hir::GenericParamKind::Const { .. } => ParamKindOrd::Const,
}
});

(lowered_generics, res)
}

Expand Down

0 comments on commit eafa3a8

Please sign in to comment.