forked from Rust-GCC/gccrs
-
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.
gccrs: [E0164] Neither tuple struct nor tuple variant used as a pattern
Checking if pattern has items, before returing solves ICE. Added error code and rich location. Also, fixes Rust-GCC#2430 gcc/rust/ChangeLog: * ast/rust-pattern.h: No need of assertion, we are handling it. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Added check which emits error instead of using assertion. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Added rich location and error code. gcc/testsuite/ChangeLog: * rust/compile/match5.rs: Updated comment for dejagnu. * rust/compile/pattern-struct.rs: New test for ICE. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
- Loading branch information
1 parent
7ca8e1b
commit f2b16e8
Showing
5 changed files
with
34 additions
and
9 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
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,18 @@ | ||
fn main() { | ||
enum A { | ||
B, | ||
C, | ||
} | ||
|
||
impl A { | ||
fn new() {} | ||
} | ||
|
||
fn bar(foo: A) { | ||
match foo { | ||
A::new() => (), | ||
// { dg-error "expected tuple struct or tuple variant, found associated function" "" { target *-*-* } .-1 } | ||
_ => {} | ||
} | ||
} | ||
} |