Skip to content

Commit 4877756

Browse files
committed
Update tests.
1 parent b331b66 commit 4877756

9 files changed

+44
-35
lines changed

src/test/ui/did_you_mean/issue-42764.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn main() {
1010
let n: usize = 42;
1111
this_function_expects_a_double_option(n);
1212
//~^ ERROR mismatched types
13-
//~| HELP try using a variant of the expected enum
13+
//~| HELP try wrapping the expression in a variant of `DoubleOption`
1414
}
1515

1616

src/test/ui/did_you_mean/issue-42764.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ LL | this_function_expects_a_double_option(n);
66
|
77
= note: expected enum `DoubleOption<_>`
88
found type `usize`
9-
help: try using a variant of the expected enum
9+
help: try wrapping the expression in a variant of `DoubleOption`
1010
|
11-
LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
12-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1311
LL | this_function_expects_a_double_option(DoubleOption::FirstSome(n));
14-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
12+
| ++++++++++++++++++++++++ +
13+
LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
14+
| ++++++++++++++++++++++++++++++ +
1515

1616
error[E0308]: mismatched types
1717
--> $DIR/issue-42764.rs:27:33

src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ error[E0308]: mismatched types
22
--> $DIR/fully-qualified-type-name1.rs:5:9
33
|
44
LL | x = 5;
5-
| ^
6-
| |
7-
| expected enum `Option`, found integer
8-
| help: try using a variant of the expected enum: `Some(5)`
5+
| ^ expected enum `Option`, found integer
96
|
107
= note: expected enum `Option<usize>`
118
found type `{integer}`
9+
help: try wrapping the expression in `Some`
10+
|
11+
LL | x = Some(5);
12+
| +++++ +
1213

1314
error: aborting due to previous error
1415

src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ error[E0308]: mismatched types
44
LL | fn bar(x: usize) -> Option<usize> {
55
| ------------- expected `Option<usize>` because of return type
66
LL | return x;
7-
| ^
8-
| |
9-
| expected enum `Option`, found `usize`
10-
| help: try using a variant of the expected enum: `Some(x)`
7+
| ^ expected enum `Option`, found `usize`
118
|
129
= note: expected enum `Option<usize>`
1310
found type `usize`
11+
help: try wrapping the expression in `Some`
12+
|
13+
LL | return Some(x);
14+
| +++++ +
1415

1516
error: aborting due to previous error
1617

src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ help: try removing this `?`
1212
LL - missing_discourses()?
1313
LL + missing_discourses()
1414
|
15-
help: try using a variant of the expected enum
15+
help: try wrapping the expression in `Ok`
1616
|
1717
LL | Ok(missing_discourses()?)
18-
|
18+
| +++ +
1919

2020
error: aborting due to previous error
2121

src/test/ui/mismatched_types/abridged.stderr

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,29 @@ error[E0308]: mismatched types
2626
LL | fn b() -> Option<Foo> {
2727
| ----------- expected `Option<Foo>` because of return type
2828
LL | Foo { bar: 1 }
29-
| ^^^^^^^^^^^^^^
30-
| |
31-
| expected enum `Option`, found struct `Foo`
32-
| help: try using a variant of the expected enum: `Some(Foo { bar: 1 })`
29+
| ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo`
3330
|
3431
= note: expected enum `Option<Foo>`
3532
found struct `Foo`
33+
help: try wrapping the expression in `Some`
34+
|
35+
LL | Some(Foo { bar: 1 })
36+
| +++++ +
3637

3738
error[E0308]: mismatched types
3839
--> $DIR/abridged.rs:28:5
3940
|
4041
LL | fn c() -> Result<Foo, Bar> {
4142
| ---------------- expected `Result<Foo, Bar>` because of return type
4243
LL | Foo { bar: 1 }
43-
| ^^^^^^^^^^^^^^
44-
| |
45-
| expected enum `Result`, found struct `Foo`
46-
| help: try using a variant of the expected enum: `Ok(Foo { bar: 1 })`
44+
| ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo`
4745
|
4846
= note: expected enum `Result<Foo, Bar>`
4947
found struct `Foo`
48+
help: try wrapping the expression in `Ok`
49+
|
50+
LL | Ok(Foo { bar: 1 })
51+
| +++ +
5052

5153
error[E0308]: mismatched types
5254
--> $DIR/abridged.rs:39:5

src/test/ui/pattern/pat-type-err-let-stmt.stderr

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ error[E0308]: mismatched types
22
--> $DIR/pat-type-err-let-stmt.rs:6:29
33
|
44
LL | let Ok(0): Option<u8> = 42u8;
5-
| ---------- ^^^^
6-
| | |
7-
| | expected enum `Option`, found `u8`
8-
| | help: try using a variant of the expected enum: `Some(42u8)`
5+
| ---------- ^^^^ expected enum `Option`, found `u8`
6+
| |
97
| expected due to this
108
|
119
= note: expected enum `Option<u8>`
1210
found type `u8`
11+
help: try wrapping the expression in `Some`
12+
|
13+
LL | let Ok(0): Option<u8> = Some(42u8);
14+
| +++++ +
1315

1416
error[E0308]: mismatched types
1517
--> $DIR/pat-type-err-let-stmt.rs:6:9

src/test/ui/suggestions/suggest-full-enum-variant-for-local-module.stderr

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ error[E0308]: mismatched types
22
--> $DIR/suggest-full-enum-variant-for-local-module.rs:9:28
33
|
44
LL | let _: option::O<()> = ();
5-
| ------------- ^^
6-
| | |
7-
| | expected enum `O`, found `()`
8-
| | help: try using a variant of the expected enum: `option::O::Some(())`
5+
| ------------- ^^ expected enum `O`, found `()`
6+
| |
97
| expected due to this
108
|
119
= note: expected enum `O<()>`
1210
found unit type `()`
11+
help: try wrapping the expression in `option::O::Some`
12+
|
13+
LL | let _: option::O<()> = option::O::Some(());
14+
| ++++++++++++++++ +
1315

1416
error: aborting due to previous error
1517

src/test/ui/typeck/issue-46112.stderr

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ error[E0308]: mismatched types
22
--> $DIR/issue-46112.rs:9:21
33
|
44
LL | fn main() { test(Ok(())); }
5-
| ^^
6-
| |
7-
| expected enum `Option`, found `()`
8-
| help: try using a variant of the expected enum: `Some(())`
5+
| ^^ expected enum `Option`, found `()`
96
|
107
= note: expected enum `Option<()>`
118
found unit type `()`
9+
help: try wrapping the expression in `Some`
10+
|
11+
LL | fn main() { test(Ok(Some(()))); }
12+
| +++++ +
1213

1314
error: aborting due to previous error
1415

0 commit comments

Comments
 (0)