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

Super weird parse error #10498

Closed
emberian opened this issue Nov 15, 2013 · 4 comments
Closed

Super weird parse error #10498

emberian opened this issue Nov 15, 2013 · 4 comments
Labels
A-parser Area: The parsing of Rust source code to an AST

Comments

@emberian
Copy link
Member

struct Bar {
    x: int,
    y: uint
}

fn main() {
    let r = &mut Bar {
        x, 12,
        y: 32
    };
}

gives

foo.rs:7:21: 7:22 error: expected `;` but found `{`
foo.rs:7     let r = &mut Bar {
                              ^
task 'rustc' failed at 'explicit failure', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:75
task '<main>' failed at 'explicit failure', /build/rust-git/src/rust/src/librustc/lib.rs:396

cc @jbclements

@jbclements
Copy link
Contributor

Looks to me like the parser sees the comma after the x and decides that the curly braces are part of a separate block, and that the semicolon is omitted. Changing the comma to a colon fixes the problem. I don't see a super-obvious fix for this.

@huonw
Copy link
Member

huonw commented Jun 16, 2014

Triage: still an issue (with &mut instead of @mut, updated code), although I idly wonder if #14885 helps (unfortunately that seems unlikely).

@jfager
Copy link
Contributor

jfager commented Jul 26, 2014

This seems to be better now:

$ rustc r10498.rs 
r10498.rs:8:10: 8:11 error: expected `:` but found `,`
r10498.rs:8         x, 12,

@steveklabnik
Copy link
Member

Yup, can confirm.

flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 30, 2023
flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 30, 2023
…ing, r=Jarcho

[`let_with_type_underscore`]: Don't emit on locals from procedural macros

closes rust-lang#10498

changelog: [`let_with_type_underscore`]: Don't emit on locals from procedural macros
flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 6, 2023
…ing, r=Jarcho

[`let_with_type_underscore`]: Don't emit on locals from procedural macros

closes rust-lang#10498

changelog: [`let_with_type_underscore`]: Don't emit on locals from procedural macros
MabezDev pushed a commit to esp-rs/rust that referenced this issue Jul 13, 2023
…ing, r=Jarcho

[`let_with_type_underscore`]: Don't emit on locals from procedural macros

closes rust-lang#10498

changelog: [`let_with_type_underscore`]: Don't emit on locals from procedural macros
xobs pushed a commit to betrusted-io/rust that referenced this issue Aug 5, 2023
…ing, r=Jarcho

[`let_with_type_underscore`]: Don't emit on locals from procedural macros

closes rust-lang#10498

changelog: [`let_with_type_underscore`]: Don't emit on locals from procedural macros
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

5 participants