forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
visit enum init when the enum variable doesn't have any parameters
this fix rust-lang#101208
- Loading branch information
Yiming Lei
committed
Oct 25, 2022
1 parent
758f196
commit 7264b68
Showing
6 changed files
with
106 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -846,6 +846,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | |
e, | ||
false, | ||
true, | ||
false, | ||
); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
enum E { | ||
One(i32, i32) | ||
} | ||
fn main() { | ||
let var = E::One; | ||
if let E::One(var1, var2) = var { | ||
//~^ ERROR 0308 | ||
println!("{var1} {var2}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-101208.rs:6:12 | ||
| | ||
LL | if let E::One(var1, var2) = var { | ||
| ^^^^^^^^^^^^^^^^^^ --- this expression has type `fn(i32, i32) -> E {E::One}` | ||
| | | ||
| expected fn item, found enum `E` | ||
| | ||
= note: expected fn item `fn(i32, i32) -> E {E::One}` | ||
found enum `E` | ||
help: use parentheses to instantiate this tuple variant | ||
| | ||
LL | if let E::One(var1, var2) = var(_,_) { | ||
| + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |