Skip to content

Commit e2c9823

Browse files
authored
Rollup merge of #105630 - albertlarsan68:test-92481, r=TaKO8Ki
Add a test for #92481 The test was copied ad-hoc from #92481, but I can't get the test to pass, because of needing to get twice the same error on the last line of the source. Closes #92481
2 parents 0e861cc + f7db4f0 commit e2c9823

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-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

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
--> $SRC_DIR/core/src/result.rs:LL:COL
36+
|
37+
= note: `Result<_, _>::Ok` defined here
38+
|
39+
help: `Result<_, _>::Ok` is a tuple variant, use the appropriate syntax
40+
|
41+
LL | Result<_, _>::Ok(/* fields */)
42+
|
43+
44+
error[E0308]: mismatched types
45+
--> $DIR/issue-92481.rs:6:5
46+
|
47+
LL | fn r({) {
48+
| - help: a return type might be missing here: `-> _`
49+
LL | / Ok {
50+
LL | | d..||_=m
51+
LL | | }
52+
| |_____^ expected `()`, found enum `Result`
53+
|
54+
= note: expected unit type `()`
55+
found enum `Result<_, _>`
56+
57+
error: aborting due to 6 previous errors
58+
59+
Some errors have detailed explanations: E0308, E0425, E0559.
60+
For more information about an error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)