Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enum pattern whose constructor resolves to const should be rejected #28992

Closed
sanxiyn opened this issue Oct 12, 2015 · 1 comment
Closed

Enum pattern whose constructor resolves to const should be rejected #28992

sanxiyn opened this issue Oct 12, 2015 · 1 comment
Labels
A-parser Area: The parsing of Rust source code to an AST.

Comments

@sanxiyn
Copy link
Member

sanxiyn commented Oct 12, 2015

I believe the following program should be rejected, but it is accepted (and panics) now.

const C: i32 = 0;
fn main() {
    if let C(..) = 0 {
        panic!();
    }
}
@petrochenkov
Copy link
Contributor

This issue may be related to #28692

@steveklabnik steveklabnik added the A-parser Area: The parsing of Rust source code to an AST. label Oct 29, 2015
bors added a commit that referenced this issue Nov 28, 2015
Fixes #28692
Fixes #28992
Fixes some other similar issues (see the tests)

[breaking-change], needs crater run (cc @brson or @alexcrichton )

The pattern with parens `UnitVariant(..)` for unit variants seems to be popular in rustc (see the second commit), but mostly used by one person (@nikomatsakis), according to git blame. If it causes breakage on crates.io I'll add an exceptional case for it.
critiqjo pushed a commit to critiqjo/rustdoc that referenced this issue Dec 16, 2016
Fixes rust-lang/rust#28692
Fixes rust-lang/rust#28992
Fixes some other similar issues (see the tests)

[breaking-change], needs crater run (cc @brson or @alexcrichton )

The pattern with parens `UnitVariant(..)` for unit variants seems to be popular in rustc (see the second commit), but mostly used by one person (@nikomatsakis), according to git blame. If it causes breakage on crates.io I'll add an exceptional case for it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The parsing of Rust source code to an AST.
Projects
None yet
Development

No branches or pull requests

3 participants