Skip to content

Commit a4ef7c4

Browse files
Revert "sort suggestions for object diagnostic"
This reverts commit 540be28.
1 parent 88baa23 commit a4ef7c4

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

compiler/rustc_infer/src/traits/error_reporting/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,12 @@ pub fn report_object_safety_error<'tcx>(
177177
)));
178178
}
179179
impls => {
180-
let mut types = impls
180+
let types = impls
181181
.iter()
182182
.map(|t| {
183183
with_no_trimmed_paths!(format!(" {}", tcx.type_of(*t).instantiate_identity(),))
184184
})
185185
.collect::<Vec<_>>();
186-
types.sort();
187186
err.help(format!(
188187
"the following types implement the trait, consider defining an enum where each \
189188
variant holds one of these types, implementing `{}` for this new enum and using \

tests/ui/generic-associated-types/gat-in-trait-path.base.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ LL | type A<'a> where Self: 'a;
1313
| ^ ...because it contains the generic associated type `A`
1414
= help: consider moving `A` to another trait
1515
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Foo` for this new enum and using it instead:
16-
Fooer<T>
1716
Fooy
17+
Fooer<T>
1818

1919
error: aborting due to 1 previous error
2020

tests/ui/generic-associated-types/issue-79422.base.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
2929
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
3030
= help: consider moving `VRefCont` to another trait
3131
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `MapLike` for this new enum and using it instead:
32-
Source
3332
std::collections::BTreeMap<K, V>
33+
Source
3434

3535
error[E0038]: the trait `MapLike` cannot be made into an object
3636
--> $DIR/issue-79422.rs:44:13
@@ -47,8 +47,8 @@ LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
4747
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
4848
= help: consider moving `VRefCont` to another trait
4949
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `MapLike` for this new enum and using it instead:
50-
Source
5150
std::collections::BTreeMap<K, V>
51+
Source
5252
= note: required for the cast from `Box<BTreeMap<u8, u8>>` to `Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>`
5353

5454
error: aborting due to 3 previous errors

tests/ui/wf/wf-unsafe-trait-obj-match.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ LL | trait Trait: Sized {}
3030
| |
3131
| this trait cannot be made into an object...
3232
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Trait` for this new enum and using it instead:
33-
R
3433
S
34+
R
3535
= note: required for the cast from `&S` to `&dyn Trait`
3636

3737
error[E0038]: the trait `Trait` cannot be made into an object
@@ -52,8 +52,8 @@ LL | trait Trait: Sized {}
5252
| |
5353
| this trait cannot be made into an object...
5454
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Trait` for this new enum and using it instead:
55-
R
5655
S
56+
R
5757
= note: required for the cast from `&R` to `&dyn Trait`
5858

5959
error: aborting due to 3 previous errors

0 commit comments

Comments
 (0)