Skip to content

Commit 59b8ff1

Browse files
committed
Clean up test stderr
1 parent 8bcc87f commit 59b8ff1

File tree

3 files changed

+19
-42
lines changed

3 files changed

+19
-42
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2156,7 +2156,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
21562156
.map(|(name, ty)| {
21572157
format!(
21582158
"{name}{}",
2159-
if ty.has_infer_types() { String::new() } else { format!(": {ty}") }
2159+
if ty.has_infer_types() {
2160+
String::new()
2161+
} else if ty.references_error() {
2162+
": /* type */".to_string()
2163+
} else {
2164+
format!(": {ty}")
2165+
}
21602166
)
21612167
})
21622168
.collect();

tests/ui/mismatched_types/issue-118510.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
pub enum Sexpr<'a> {
1+
pub enum Sexpr<'a, S> {
22
Ident(&'a mut S),
3-
//~^ ERROR cannot find type `S` in this scope [E0412]
43
}
54

6-
fn map<'a, F: FnOnce(&Foo<'a>) -> T>(f: F) {}
7-
//~^ ERROR cannot find type `Foo` in this scope [E0412]
8-
//~| ERROR cannot find type `T` in this scope [E0412]
5+
fn map<Foo, T, F: FnOnce(&Foo) -> T>(f: F) {}
96

107
fn main() {
118
map(Sexpr::Ident);
Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,5 @@
1-
error[E0412]: cannot find type `S` in this scope
2-
--> $DIR/issue-118510.rs:2:19
3-
|
4-
LL | Ident(&'a mut S),
5-
| ^ not found in this scope
6-
|
7-
help: you might be missing a type parameter
8-
|
9-
LL | pub enum Sexpr<'a, S> {
10-
| +++
11-
12-
error[E0412]: cannot find type `Foo` in this scope
13-
--> $DIR/issue-118510.rs:6:23
14-
|
15-
LL | fn map<'a, F: FnOnce(&Foo<'a>) -> T>(f: F) {}
16-
| ^^^ not found in this scope
17-
18-
error[E0412]: cannot find type `T` in this scope
19-
--> $DIR/issue-118510.rs:6:35
20-
|
21-
LL | fn map<'a, F: FnOnce(&Foo<'a>) -> T>(f: F) {}
22-
| - ^ help: a type parameter with a similar name exists: `F`
23-
| |
24-
| similarly named type parameter `F` defined here
25-
261
error[E0631]: type mismatch in function arguments
27-
--> $DIR/issue-118510.rs:11:9
2+
--> $DIR/issue-118510.rs:8:9
283
|
294
LL | Ident(&'a mut S),
305
| ----- found signature defined here
@@ -34,19 +9,18 @@ LL | map(Sexpr::Ident);
349
| |
3510
| required by a bound introduced by this call
3611
|
37-
= note: expected function signature `for<'a> fn(&'a {type error}) -> _`
38-
found function signature `fn(&mut {type error}) -> _`
12+
= note: expected function signature `for<'a> fn(&'a _) -> _`
13+
found function signature `fn(&mut _) -> _`
3914
note: required by a bound in `map`
40-
--> $DIR/issue-118510.rs:6:15
15+
--> $DIR/issue-118510.rs:5:19
4116
|
42-
LL | fn map<'a, F: FnOnce(&Foo<'a>) -> T>(f: F) {}
43-
| ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map`
17+
LL | fn map<Foo, T, F: FnOnce(&Foo) -> T>(f: F) {}
18+
| ^^^^^^^^^^^^^^^^^ required by this bound in `map`
4419
help: consider wrapping the function in a closure
4520
|
46-
LL | map(|arg0: &{type error}| Sexpr::Ident(&mut *arg0));
47-
| +++++++++++++++++++++ ++++++++++++
21+
LL | map(|arg0| Sexpr::Ident(&mut *arg0));
22+
| ++++++ ++++++++++++
4823

49-
error: aborting due to 4 previous errors
24+
error: aborting due to 1 previous error
5025

51-
Some errors have detailed explanations: E0412, E0631.
52-
For more information about an error, try `rustc --explain E0412`.
26+
For more information about this error, try `rustc --explain E0631`.

0 commit comments

Comments
 (0)