Skip to content

Commit e0ba193

Browse files
Revert "sort suggestions for object diagnostic"
This reverts commit 540be28.
1 parent d325fb7 commit e0ba193

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
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

+3-3
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[E0038]: the trait `Foo` cannot be made into an object
2020
--> $DIR/gat-in-trait-path.rs:32:5
@@ -31,8 +31,8 @@ LL | type A<'a> where Self: 'a;
3131
| ^ ...because it contains the generic associated type `A`
3232
= help: consider moving `A` to another trait
3333
= 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:
34-
Fooer<T>
3534
Fooy
35+
Fooer<T>
3636

3737
error[E0038]: the trait `Foo` cannot be made into an object
3838
--> $DIR/gat-in-trait-path.rs:32:5
@@ -49,8 +49,8 @@ LL | type A<'a> where Self: 'a;
4949
| ^ ...because it contains the generic associated type `A`
5050
= help: consider moving `A` to another trait
5151
= 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:
52-
Fooer<T>
5352
Fooy
53+
Fooer<T>
5454
= note: required for the cast from `Box<Fooer<{integer}>>` to `Box<(dyn Foo<A = &'a ()> + 'static)>`
5555

5656
error: aborting due to 3 previous errors

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
@@ -26,8 +26,8 @@ LL | trait Trait: Sized {}
2626
| |
2727
| this trait cannot be made into an object...
2828
= 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:
29-
R
3029
S
30+
R
3131
= note: required for the cast from `&S` to `&dyn Trait`
3232

3333
error[E0038]: the trait `Trait` cannot be made into an object
@@ -48,8 +48,8 @@ LL | trait Trait: Sized {}
4848
| |
4949
| this trait cannot be made into an object...
5050
= 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:
51-
R
5251
S
52+
R
5353
= note: required for the cast from `&R` to `&dyn Trait`
5454

5555
error: aborting due to 3 previous errors

0 commit comments

Comments
 (0)