mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-10 22:13:27 +00:00
Add a test for #92481
This commit is contained in:
parent
dc30b92cc5
commit
6844b17bbe
14
src/test/ui/typeck/issue-92481.rs
Normal file
14
src/test/ui/typeck/issue-92481.rs
Normal file
@ -0,0 +1,14 @@
|
||||
//check-fail
|
||||
|
||||
#![crate_type="lib"]
|
||||
|
||||
fn r({) {
|
||||
Ok { //~ ERROR mismatched types [E0308]
|
||||
d..||_=m
|
||||
}
|
||||
}
|
||||
//~^^^^^ ERROR expected parameter name, found `{`
|
||||
//~| ERROR expected one of `,`, `:`, or `}`, found `..`
|
||||
//~^^^^^ ERROR cannot find value `d` in this scope [E0425]
|
||||
//~| ERROR cannot find value `m` in this scope [E0425]
|
||||
//~| ERROR variant `Result<_, _>::Ok` has no field named `d` [E0559]
|
62
src/test/ui/typeck/issue-92481.stderr
Normal file
62
src/test/ui/typeck/issue-92481.stderr
Normal file
@ -0,0 +1,62 @@
|
||||
error: expected parameter name, found `{`
|
||||
--> $DIR/issue-92481.rs:5:6
|
||||
|
|
||||
LL | fn r({) {
|
||||
| ^ expected parameter name
|
||||
|
||||
error: expected one of `,`, `:`, or `}`, found `..`
|
||||
--> $DIR/issue-92481.rs:5:6
|
||||
|
|
||||
LL | fn r({) {
|
||||
| ^ unclosed delimiter
|
||||
LL | Ok {
|
||||
LL | d..||_=m
|
||||
| -^
|
||||
| |
|
||||
| help: `}` may belong here
|
||||
|
||||
error[E0425]: cannot find value `d` in this scope
|
||||
--> $DIR/issue-92481.rs:7:9
|
||||
|
|
||||
LL | d..||_=m
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `m` in this scope
|
||||
--> $DIR/issue-92481.rs:7:16
|
||||
|
|
||||
LL | d..||_=m
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0559]: variant `Result<_, _>::Ok` has no field named `d`
|
||||
--> $DIR/issue-92481.rs:7:9
|
||||
|
|
||||
LL | d..||_=m
|
||||
| ^ field does not exist
|
||||
|
|
||||
::: $SRC_DIR/core/src/result.rs:LL:COL
|
||||
|
|
||||
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
|
||||
| -- `Result<_, _>::Ok` defined here
|
||||
|
|
||||
help: `Result<_, _>::Ok` is a tuple variant, use the appropriate syntax
|
||||
|
|
||||
LL | Result<_, _>::Ok(/* fields */)
|
||||
|
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-92481.rs:6:5
|
||||
|
|
||||
LL | fn r({) {
|
||||
| - help: a return type might be missing here: `-> _`
|
||||
LL | / Ok {
|
||||
LL | | d..||_=m
|
||||
LL | | }
|
||||
| |_____^ expected `()`, found enum `Result`
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found enum `Result<_, _>`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0425, E0559.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
Loading…
Reference in New Issue
Block a user