Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ae24fef

Browse files
committed
Use TraitRef::to_string sorting in favor of TraitRef::ord, as the latter compares DefIds which we need to avoid
1 parent 2707ac9 commit ae24fef

File tree

48 files changed

+257
-257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+257
-257
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
21172117
})
21182118
.collect();
21192119

2120-
impl_candidates.sort();
2120+
impl_candidates.sort_by_key(|tr| tr.to_string());
21212121
impl_candidates.dedup();
21222122
return report(impl_candidates, err);
21232123
}
@@ -2143,7 +2143,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
21432143
cand
21442144
})
21452145
.collect();
2146-
impl_candidates.sort_by_key(|cand| (cand.similarity, cand.trait_ref));
2146+
impl_candidates.sort_by_key(|cand| (cand.similarity, cand.trait_ref.to_string()));
21472147
let mut impl_candidates: Vec<_> =
21482148
impl_candidates.into_iter().map(|cand| cand.trait_ref).collect();
21492149
impl_candidates.dedup();

tests/ui/binop/binary-op-suggest-deref.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,14 @@ LL | _ = &&0 == Foo;
247247
|
248248
= help: the trait `PartialEq<Foo>` is not implemented for `&&{integer}`
249249
= help: the following other types implement trait `PartialEq<Rhs>`:
250-
isize
251-
i8
250+
f32
251+
f64
252+
i128
252253
i16
253254
i32
254255
i64
255-
i128
256-
usize
257-
u8
256+
i8
257+
isize
258258
and 6 others
259259

260260
error[E0369]: binary operation `==` cannot be applied to type `Foo`
@@ -303,10 +303,10 @@ LL | let _ = FOO & (*"Sized".to_string().into_boxed_str());
303303
|
304304
= help: the trait `BitAnd<str>` is not implemented for `i32`
305305
= help: the following other types implement trait `BitAnd<Rhs>`:
306-
<i32 as BitAnd>
307-
<i32 as BitAnd<&i32>>
308306
<&'a i32 as BitAnd<i32>>
309307
<&i32 as BitAnd<&i32>>
308+
<i32 as BitAnd<&i32>>
309+
<i32 as BitAnd>
310310

311311
error[E0277]: the size for values of type `str` cannot be known at compilation time
312312
--> $DIR/binary-op-suggest-deref.rs:78:17

tests/ui/binop/binop-mul-i32-f32.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ LL | x * y
66
|
77
= help: the trait `Mul<f32>` is not implemented for `i32`
88
= help: the following other types implement trait `Mul<Rhs>`:
9-
<i32 as Mul>
10-
<i32 as Mul<&i32>>
119
<&'a i32 as Mul<i32>>
1210
<&i32 as Mul<&i32>>
11+
<i32 as Mul<&i32>>
12+
<i32 as Mul>
1313

1414
error: aborting due to 1 previous error
1515

tests/ui/binop/shift-various-bad-types.stderr

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ LL | 22 >> p.char;
66
|
77
= help: the trait `Shr<char>` is not implemented for `{integer}`
88
= help: the following other types implement trait `Shr<Rhs>`:
9-
<isize as Shr>
10-
<isize as Shr<i8>>
11-
<isize as Shr<i16>>
12-
<isize as Shr<i32>>
13-
<isize as Shr<i64>>
14-
<isize as Shr<i128>>
15-
<isize as Shr<usize>>
16-
<isize as Shr<u8>>
9+
<&'a i128 as Shr<i128>>
10+
<&'a i128 as Shr<i16>>
11+
<&'a i128 as Shr<i32>>
12+
<&'a i128 as Shr<i64>>
13+
<&'a i128 as Shr<i8>>
14+
<&'a i128 as Shr<isize>>
15+
<&'a i128 as Shr<u128>>
16+
<&'a i128 as Shr<u16>>
1717
and 568 others
1818

1919
error[E0277]: no implementation for `{integer} >> &str`
@@ -24,14 +24,14 @@ LL | 22 >> p.str;
2424
|
2525
= help: the trait `Shr<&str>` is not implemented for `{integer}`
2626
= help: the following other types implement trait `Shr<Rhs>`:
27-
<isize as Shr>
28-
<isize as Shr<i8>>
29-
<isize as Shr<i16>>
30-
<isize as Shr<i32>>
31-
<isize as Shr<i64>>
32-
<isize as Shr<i128>>
33-
<isize as Shr<usize>>
34-
<isize as Shr<u8>>
27+
<&'a i128 as Shr<i128>>
28+
<&'a i128 as Shr<i16>>
29+
<&'a i128 as Shr<i32>>
30+
<&'a i128 as Shr<i64>>
31+
<&'a i128 as Shr<i8>>
32+
<&'a i128 as Shr<isize>>
33+
<&'a i128 as Shr<u128>>
34+
<&'a i128 as Shr<u16>>
3535
and 568 others
3636

3737
error[E0277]: no implementation for `{integer} >> &Panolpy`
@@ -42,14 +42,14 @@ LL | 22 >> p;
4242
|
4343
= help: the trait `Shr<&Panolpy>` is not implemented for `{integer}`
4444
= help: the following other types implement trait `Shr<Rhs>`:
45-
<isize as Shr>
46-
<isize as Shr<i8>>
47-
<isize as Shr<i16>>
48-
<isize as Shr<i32>>
49-
<isize as Shr<i64>>
50-
<isize as Shr<i128>>
51-
<isize as Shr<usize>>
52-
<isize as Shr<u8>>
45+
<&'a i128 as Shr<i128>>
46+
<&'a i128 as Shr<i16>>
47+
<&'a i128 as Shr<i32>>
48+
<&'a i128 as Shr<i64>>
49+
<&'a i128 as Shr<i8>>
50+
<&'a i128 as Shr<isize>>
51+
<&'a i128 as Shr<u128>>
52+
<&'a i128 as Shr<u16>>
5353
and 568 others
5454

5555
error[E0308]: mismatched types

tests/ui/const-generics/exhaustive-value.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ LL | <() as Foo<N>>::test()
66
|
77
= help: the following other types implement trait `Foo<N>`:
88
<() as Foo<0>>
9-
<() as Foo<1>>
10-
<() as Foo<2>>
11-
<() as Foo<3>>
12-
<() as Foo<4>>
13-
<() as Foo<5>>
14-
<() as Foo<6>>
15-
<() as Foo<7>>
9+
<() as Foo<100>>
10+
<() as Foo<101>>
11+
<() as Foo<102>>
12+
<() as Foo<103>>
13+
<() as Foo<104>>
14+
<() as Foo<105>>
15+
<() as Foo<106>>
1616
and 248 others
1717

1818
error: aborting due to 1 previous error

tests/ui/const-generics/generic_arg_infer/issue-91614.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ LL | let y = Mask::<_, _>::splat(false);
66
|
77
= note: cannot satisfy `_: MaskElement`
88
= help: the following types implement trait `MaskElement`:
9-
isize
10-
i8
119
i16
1210
i32
1311
i64
12+
i8
13+
isize
1414
note: required by a bound in `Mask::<T, N>::splat`
1515
--> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/masks.rs:LL:COL
1616
help: consider giving `y` an explicit type, where the type for type parameter `T` is specified

tests/ui/const-generics/issues/issue-67185-2.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ LL | <u8 as Baz>::Quaks: Bar,
55
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[u16; 3]`
66
|
77
= help: the following other types implement trait `Bar`:
8-
[u16; 4]
98
[[u16; 3]; 3]
9+
[u16; 4]
1010
= help: see issue #48214
1111
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
1212
|
@@ -20,8 +20,8 @@ LL | [<u8 as Baz>::Quaks; 2]: Bar,
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
2121
|
2222
= help: the following other types implement trait `Bar`:
23-
[u16; 4]
2423
[[u16; 3]; 3]
24+
[u16; 4]
2525
= help: see issue #48214
2626
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
2727
|
@@ -35,8 +35,8 @@ LL | impl Foo for FooImpl {}
3535
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`, which is required by `<u8 as Baz>::Quaks: Bar`
3636
|
3737
= help: the following other types implement trait `Bar`:
38-
[u16; 4]
3938
[[u16; 3]; 3]
39+
[u16; 4]
4040
note: required by a bound in `Foo`
4141
--> $DIR/issue-67185-2.rs:15:25
4242
|
@@ -53,8 +53,8 @@ LL | impl Foo for FooImpl {}
5353
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`, which is required by `[<u8 as Baz>::Quaks; 2]: Bar`
5454
|
5555
= help: the following other types implement trait `Bar`:
56-
[u16; 4]
5756
[[u16; 3]; 3]
57+
[u16; 4]
5858
note: required by a bound in `Foo`
5959
--> $DIR/issue-67185-2.rs:14:30
6060
|
@@ -71,8 +71,8 @@ LL | fn f(_: impl Foo) {}
7171
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
7272
|
7373
= help: the following other types implement trait `Bar`:
74-
[u16; 4]
7574
[[u16; 3]; 3]
75+
[u16; 4]
7676
note: required by a bound in `Foo`
7777
--> $DIR/issue-67185-2.rs:14:30
7878
|
@@ -89,8 +89,8 @@ LL | fn f(_: impl Foo) {}
8989
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
9090
|
9191
= help: the following other types implement trait `Bar`:
92-
[u16; 4]
9392
[[u16; 3]; 3]
93+
[u16; 4]
9494
note: required by a bound in `Foo`
9595
--> $DIR/issue-67185-2.rs:15:25
9696
|

tests/ui/consts/const-eval/const-eval-overflow-3b.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ LL | = [0; (i8::MAX + 1u8) as usize];
1212
|
1313
= help: the trait `Add<u8>` is not implemented for `i8`
1414
= help: the following other types implement trait `Add<Rhs>`:
15-
<i8 as Add>
16-
<i8 as Add<&i8>>
1715
<&'a i8 as Add<i8>>
1816
<&i8 as Add<&i8>>
17+
<i8 as Add<&i8>>
18+
<i8 as Add>
1919

2020
error: aborting due to 2 previous errors
2121

tests/ui/consts/const-eval/const-eval-overflow-4b.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
1212
|
1313
= help: the trait `Add<u8>` is not implemented for `i8`
1414
= help: the following other types implement trait `Add<Rhs>`:
15-
<i8 as Add>
16-
<i8 as Add<&i8>>
1715
<&'a i8 as Add<i8>>
1816
<&i8 as Add<&i8>>
17+
<i8 as Add<&i8>>
18+
<i8 as Add>
1919

2020
error[E0604]: only `u8` can be cast as `char`, not `i8`
2121
--> $DIR/const-eval-overflow-4b.rs:22:13

tests/ui/consts/missing-larger-array-impl.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ LL | <[X; 35] as Default>::default();
55
| ^^^^^^^ the trait `Default` is not implemented for `[X; 35]`
66
|
77
= help: the following other types implement trait `Default`:
8+
&[T]
9+
&mut [T]
810
[T; 0]
9-
[T; 1]
10-
[T; 2]
11-
[T; 3]
12-
[T; 4]
13-
[T; 5]
14-
[T; 6]
15-
[T; 7]
11+
[T; 10]
12+
[T; 11]
13+
[T; 12]
14+
[T; 13]
15+
[T; 14]
1616
and 27 others
1717

1818
error: aborting due to 1 previous error

0 commit comments

Comments
 (0)