Skip to content

Commit 2c5fbe2

Browse files
committed
sort strings on output
1 parent 7fa3c8f commit 2c5fbe2

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

src/librustc_traits/lowering.rs

+16-7
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,22 @@ impl<'a, 'tcx> ClauseDumper<'a, 'tcx> {
382382
.sess
383383
.struct_span_err(attr.span, "program clause dump");
384384

385-
for clause in clauses.iter() {
386-
// Skip the top-level binder for a less verbose output
387-
let program_clause = match clause {
388-
Clause::Implies(program_clause) => program_clause,
389-
Clause::ForAll(program_clause) => program_clause.skip_binder(),
390-
};
391-
err.note(&format!("{}", program_clause));
385+
let mut strings: Vec<_> = clauses
386+
.iter()
387+
.map(|clause| {
388+
// Skip the top-level binder for a less verbose output
389+
let program_clause = match clause {
390+
Clause::Implies(program_clause) => program_clause,
391+
Clause::ForAll(program_clause) => program_clause.skip_binder(),
392+
};
393+
format!("{}", program_clause)
394+
})
395+
.collect();
396+
397+
strings.sort();
398+
399+
for string in strings {
400+
err.note(&string);
392401
}
393402

394403
err.emit();

src/test/ui/chalkify/lower_env1.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ error: program clause dump
44
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: Implemented(Self: Bar) :- FromEnv(Self: Bar).
87
= note: FromEnv(Self: Bar) :- FromEnv(Self: Bar).
98
= note: FromEnv(Self: Foo) :- FromEnv(Self: Bar).
9+
= note: Implemented(Self: Bar) :- FromEnv(Self: Bar).
1010

1111
error: program clause dump
1212
--> $DIR/lower_env1.rs:19:1
1313
|
1414
LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1616
|
17-
= note: Implemented(Self: std::marker::Sized) :- FromEnv(Self: std::marker::Sized).
18-
= note: Implemented(Self: Bar) :- FromEnv(Self: Bar).
1917
= note: FromEnv(Self: Bar) :- FromEnv(Self: Bar).
2018
= note: FromEnv(Self: Foo) :- FromEnv(Self: Bar).
19+
= note: Implemented(Self: Bar) :- FromEnv(Self: Bar).
2120
= note: Implemented(Self: Foo) :- FromEnv(Self: Foo).
21+
= note: Implemented(Self: std::marker::Sized) :- FromEnv(Self: std::marker::Sized).
2222

2323
error: aborting due to 2 previous errors
2424

src/test/ui/chalkify/lower_trait.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ error: program clause dump
44
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: Implemented(Self: Foo<S, T, U>) :- FromEnv(Self: Foo<S, T, U>).
87
= note: FromEnv(S: std::marker::Sized) :- FromEnv(Self: Foo<S, T, U>).
98
= note: FromEnv(T: std::marker::Sized) :- FromEnv(Self: Foo<S, T, U>).
109
= note: FromEnv(U: std::marker::Sized) :- FromEnv(Self: Foo<S, T, U>).
10+
= note: Implemented(Self: Foo<S, T, U>) :- FromEnv(Self: Foo<S, T, U>).
1111

1212
error: aborting due to previous error
1313

src/test/ui/chalkify/lower_trait_higher_rank.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ error: program clause dump
44
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: Implemented(Self: Foo<F>) :- FromEnv(Self: Foo<F>).
7+
= note: FromEnv(<F as std::ops::FnOnce<(&'a (u8, u16),)>>::Output == &'a u8) :- FromEnv(Self: Foo<F>).
88
= note: FromEnv(F: std::marker::Sized) :- FromEnv(Self: Foo<F>).
99
= note: FromEnv(F: std::ops::Fn<(&'a (u8, u16),)>) :- FromEnv(Self: Foo<F>).
10-
= note: FromEnv(<F as std::ops::FnOnce<(&'a (u8, u16),)>>::Output == &'a u8) :- FromEnv(Self: Foo<F>).
10+
= note: Implemented(Self: Foo<F>) :- FromEnv(Self: Foo<F>).
1111

1212
error: aborting due to previous error
1313

src/test/ui/chalkify/lower_trait_where_clause.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error: program clause dump
44
LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: Implemented(Self: Foo<'a, 'b, S, T, U>) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
8-
= note: FromEnv(S: std::marker::Sized) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
9-
= note: FromEnv(T: std::marker::Sized) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
107
= note: FromEnv(S: std::fmt::Debug) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
8+
= note: FromEnv(S: std::marker::Sized) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
119
= note: FromEnv(T: std::borrow::Borrow<U>) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
10+
= note: FromEnv(T: std::marker::Sized) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
11+
= note: Implemented(Self: Foo<'a, 'b, S, T, U>) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
1212
= note: RegionOutlives('a : 'b) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
1313
= note: TypeOutlives(U : 'b) :- FromEnv(Self: Foo<'a, 'b, S, T, U>).
1414

0 commit comments

Comments
 (0)