Skip to content

Commit 2aad509

Browse files
committed
Tweak output
1 parent aa13c44 commit 2aad509

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,17 @@ pub fn report_object_safety_error<'tcx>(
137137
.iter()
138138
.map(|t| {
139139
with_no_trimmed_paths!(format!(
140-
"\n - {}",
140+
" {}",
141141
tcx.type_of(*t).instantiate_identity(),
142142
))
143143
})
144144
.collect::<Vec<_>>();
145145
err.help(format!(
146146
"the following types implement the trait, consider defining an enum where each \
147147
variant holds one of these types, implementing `{}` for this new enum and using \
148-
it instead:{}",
148+
it instead:\n{}",
149149
trait_str,
150-
types.join(""),
150+
types.join("\n"),
151151
));
152152
}
153153
}

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

+2-2
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-
- Fooy
17-
- Fooer<T>
16+
Fooy
17+
Fooer<T>
1818

1919
error: aborting due to previous error
2020

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

+4-4
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-
- std::collections::BTreeMap<K, V>
33-
- Source
32+
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-
- std::collections::BTreeMap<K, V>
51-
- Source
50+
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/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ LL | trait NotObjectSafe {
1212
LL | fn foo() -> Self;
1313
| ^^^ ...because associated function `foo` has no `self` parameter
1414
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `NotObjectSafe` for this new enum and using it instead:
15-
- A
16-
- B
15+
A
16+
B
1717
help: consider turning `foo` into a method by giving it a `&self` argument
1818
|
1919
LL | fn foo(&self) -> Self;
@@ -37,8 +37,8 @@ LL | trait NotObjectSafe {
3737
LL | fn foo() -> Self;
3838
| ^^^ ...because associated function `foo` has no `self` parameter
3939
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `NotObjectSafe` for this new enum and using it instead:
40-
- A
41-
- B
40+
A
41+
B
4242
help: consider turning `foo` into a method by giving it a `&self` argument
4343
|
4444
LL | fn foo(&self) -> Self;

tests/ui/traits/test-2.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
4343
= help: consider moving `dup` to another trait
4444
= help: consider moving `blah` to another trait
4545
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
46-
- i32
47-
- u32
46+
i32
47+
u32
4848

4949
error[E0038]: the trait `bar` cannot be made into an object
5050
--> $DIR/test-2.rs:13:5
@@ -63,8 +63,8 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
6363
= help: consider moving `dup` to another trait
6464
= help: consider moving `blah` to another trait
6565
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
66-
- i32
67-
- u32
66+
i32
67+
u32
6868

6969
error[E0038]: the trait `bar` cannot be made into an object
7070
--> $DIR/test-2.rs:13:6
@@ -83,8 +83,8 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
8383
= help: consider moving `dup` to another trait
8484
= help: consider moving `blah` to another trait
8585
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
86-
- i32
87-
- u32
86+
i32
87+
u32
8888
= note: required for the cast from `Box<{integer}>` to `Box<dyn bar>`
8989

9090
error: aborting due to 5 previous errors

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

+4-4
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-
- S
34-
- R
33+
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-
- S
56-
- R
55+
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)