Skip to content

Commit 2315012

Browse files
Add a test for #92481
1 parent 37d7de3 commit 2315012

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

src/test/ui/typeck/issue-92481.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//check-fail
2+
3+
#![crate_type="lib"]
4+
5+
fn r({) {
6+
Ok { //~ ERROR mismatched types [E0308]
7+
d..||_=m
8+
}
9+
}
10+
//~^^^^^ ERROR expected parameter name, found `{`
11+
//~| ERROR expected one of `,`, `:`, or `}`, found `..`
12+
//~^^^^^ ERROR cannot find value `d` in this scope [E0425]
13+
//~| ERROR cannot find value `m` in this scope [E0425]
14+
//~| ERROR variant `Result<_, _>::Ok` has no field named `d` [E0559]

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

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
error: expected parameter name, found `{`
2+
--> $DIR/issue-92481.rs:5:6
3+
|
4+
LL | fn r({) {
5+
| ^ expected parameter name
6+
7+
error: expected one of `,`, `:`, or `}`, found `..`
8+
--> $DIR/issue-92481.rs:5:6
9+
|
10+
LL | fn r({) {
11+
| ^ unclosed delimiter
12+
LL | Ok {
13+
LL | d..||_=m
14+
| -^
15+
| |
16+
| help: `}` may belong here
17+
18+
error[E0425]: cannot find value `d` in this scope
19+
--> $DIR/issue-92481.rs:7:9
20+
|
21+
LL | d..||_=m
22+
| ^ not found in this scope
23+
24+
error[E0425]: cannot find value `m` in this scope
25+
--> $DIR/issue-92481.rs:7:16
26+
|
27+
LL | d..||_=m
28+
| ^ not found in this scope
29+
30+
error[E0559]: variant `Result<_, _>::Ok` has no field named `d`
31+
--> $DIR/issue-92481.rs:7:9
32+
|
33+
LL | d..||_=m
34+
| ^ field does not exist
35+
|
36+
::: $SRC_DIR/core/src/result.rs:LL:COL
37+
|
38+
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
39+
| -- `Result<_, _>::Ok` defined here
40+
|
41+
help: `Result<_, _>::Ok` is a tuple variant, use the appropriate syntax
42+
|
43+
LL | Result<_, _>::Ok(/* fields */)
44+
|
45+
46+
error[E0308]: mismatched types
47+
--> $DIR/issue-92481.rs:6:5
48+
|
49+
LL | fn r({) {
50+
| - help: a return type might be missing here: `-> _`
51+
LL | / Ok {
52+
LL | | d..||_=m
53+
LL | | }
54+
| |_____^ expected `()`, found enum `Result`
55+
|
56+
= note: expected unit type `()`
57+
found enum `Result<_, _>`
58+
59+
error: aborting due to 6 previous errors
60+
61+
Some errors have detailed explanations: E0308, E0425, E0559.
62+
For more information about an error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)