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

'expected identifier' when 'as' keyword appears after block #17930

Closed
bnoordhuis opened this issue Oct 10, 2014 · 4 comments
Closed

'expected identifier' when 'as' keyword appears after block #17930

bnoordhuis opened this issue Oct 10, 2014 · 4 comments
Labels
A-grammar Area: The grammar of Rust C-feature-request Category: A feature request, i.e: not implemented / a PR.

Comments

@bnoordhuis
Copy link
Contributor

I'm not sure if this qualifies as bug but it's somewhat surprising to me:

fn main() {
    unsafe { 0 as int };  // ok
    unsafe { 0 } as int;  // expected identifier, found keyword `as`
    (unsafe { 0 }) as int;  // ok
}

The same happens with match true { true => 0, false => 0 } as int or if true { 0 } else { 0 } as int unless the expression is wrapped in parentheses.

@steveklabnik steveklabnik added the A-grammar Area: The grammar of Rust label Jan 27, 2015
@steveklabnik
Copy link
Member

I feel like this is a dup, but I can't find the issue.

@steveklabnik
Copy link
Member

Updated code:

fn main() {
    unsafe { 0 as i32 };  // ok
    unsafe { 0 } as i32;  // expected identifier, found keyword `as`
    (unsafe { 0 }) as i32;  // ok
}

same error.

@steveklabnik
Copy link
Member

Triage: no change

@Mark-Simulacrum
Copy link
Member


error: expected expression, found `as`
 --> src/main.rs:3:18
  |
3 |     unsafe { 0 } as i32;  // expected identifier, found keyword `as`
  |     ------------ ^^ expected expression
  |     |
  |     help: parentheses are required to parse this as an expression: `(unsafe { 0 })`

error: aborting due to previous error

lnicola pushed a commit to lnicola/rust that referenced this issue Aug 29, 2024
Remove the ability to configure the user config path

Being able to do this makes little sense as this is effectively a cyclic dependency (and we do not want to fixpoint this really).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-grammar Area: The grammar of Rust C-feature-request Category: A feature request, i.e: not implemented / a PR.
Projects
None yet
Development

No branches or pull requests

3 participants