Skip to content

Commit be1b758

Browse files
authored
Merge pull request #1216 from dtolnay/anglebracketedorder
Preserve ordering of associated type constraints relative to types
2 parents 3e09e3b + f855831 commit be1b758

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

src/path.rs

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,8 @@ pub(crate) mod printing {
756756
self.colon2_token.to_tokens(tokens);
757757
self.lt_token.to_tokens(tokens);
758758

759-
// Print lifetimes before types and consts, all before bindings,
760-
// regardless of their order in self.args.
761-
//
762-
// TODO: ordering rules for const arguments vs type arguments have
763-
// not been settled yet. https://github.com/rust-lang/rust/issues/44580
759+
// Print lifetimes before types/consts/bindings, regardless of their
760+
// order in self.args.
764761
let mut trailing_or_empty = true;
765762
for param in self.args.pairs() {
766763
match **param.value() {
@@ -776,30 +773,17 @@ pub(crate) mod printing {
776773
}
777774
for param in self.args.pairs() {
778775
match **param.value() {
779-
GenericArgument::Type(_) | GenericArgument::Const(_) => {
780-
if !trailing_or_empty {
781-
<Token![,]>::default().to_tokens(tokens);
782-
}
783-
param.to_tokens(tokens);
784-
trailing_or_empty = param.punct().is_some();
785-
}
786-
GenericArgument::Lifetime(_)
776+
GenericArgument::Type(_)
787777
| GenericArgument::Binding(_)
788-
| GenericArgument::Constraint(_) => {}
789-
}
790-
}
791-
for param in self.args.pairs() {
792-
match **param.value() {
793-
GenericArgument::Binding(_) | GenericArgument::Constraint(_) => {
778+
| GenericArgument::Constraint(_)
779+
| GenericArgument::Const(_) => {
794780
if !trailing_or_empty {
795781
<Token![,]>::default().to_tokens(tokens);
796782
}
797783
param.to_tokens(tokens);
798784
trailing_or_empty = param.punct().is_some();
799785
}
800-
GenericArgument::Lifetime(_)
801-
| GenericArgument::Type(_)
802-
| GenericArgument::Const(_) => {}
786+
GenericArgument::Lifetime(_) => {}
803787
}
804788
}
805789

tests/repo/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ const REVISION: &str = "98ad6a5519651af36e246c0335c964dd52c554ba";
1414

1515
#[rustfmt::skip]
1616
static EXCLUDE_FILES: &[&str] = &[
17-
// TODO: generic associated type constraint inside trait bound
18-
"src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0138_associated_type_bounds.rs",
19-
2017
// TODO: negative literal for const generic parameter default value
2118
"src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0200_const_param_default_literal.rs",
2219

0 commit comments

Comments
 (0)