Skip to content

Commit 08c81c1

Browse files
Add failing testcases
1 parent 21c580e commit 08c81c1

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn result_test() {
12+
let x = Option(1);
13+
14+
if let Option(_) = x {
15+
println!("It is OK.");
16+
}
17+
}
18+
19+
fn main() {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0423]: expected function, found enum `Option`
2+
--> $DIR/issue-43871-enum-instead-of-variant.rs:12:13
3+
|
4+
12 | let x = Option(1);
5+
| ^^^^^^ not a function
6+
= note: did you mean to use one of the following variants?
7+
- `std::prelude::v1::Option::None`
8+
- `std::prelude::v1::Option::Some`
9+
10+
error[E0532]: expected tuple struct/variant, found enum `Option`
11+
--> $DIR/issue-43871-enum-instead-of-variant.rs:14:12
12+
|
13+
14 | if let Option(_) = x {
14+
| ^^^^^^
15+
|
16+
= note: did you mean to use one of the following variants?
17+
- `std::prelude::v1::Option::None`
18+
- `std::prelude::v1::Option::Some`
19+
20+
error: aborting due to previous error
21+

0 commit comments

Comments
 (0)