Skip to content
New issue

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

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

Already on GitHub? # to your account

Do not allow consequtive zeroes as a name of tuple struct fields #47073

Closed
matklad opened this issue Dec 30, 2017 · 1 comment
Closed

Do not allow consequtive zeroes as a name of tuple struct fields #47073

matklad opened this issue Dec 30, 2017 · 1 comment
Labels
A-parser Area: The parsing of Rust source code to an AST

Comments

@matklad
Copy link
Member

matklad commented Dec 30, 2017

The following compiles, but I think it shouldn't?

struct S(i32); 
fn lol(s: S) { s.00000; }
@petrochenkov petrochenkov added the A-parser Area: The parsing of Rust source code to an AST label Dec 30, 2017
@petrochenkov
Copy link
Contributor

The field name is converted to a number too eagerly.

This doesn't happen in struct expressions and patterns.

struct S(i32); 

fn main() {
    let s = S { 0000: 10 }; // ERROR struct `S` has no field named `0000`
    let S { 0000: x } = s; // ERROR struct `S` does not have a field named `0000`
}

zackmdavis added a commit to zackmdavis/rust that referenced this issue Dec 31, 2017
bors added a commit that referenced this issue Dec 31, 2017
…truct_indices, r=petrochenkov

in which leading zeroes on tuple-struct accesses are abjured

Resolves #47073. If accepted, a point in the compatibility section of the release notes is warranted.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-parser Area: The parsing of Rust source code to an AST
Projects
None yet
Development

No branches or pull requests

2 participants