Skip to content

range syntax doesn't work with non-literal endpoints in for statements #20241

Description

@blaenk

Range syntax doesn't work with non-literal endpoints. It seems that the parser tries to parse a structure definition or instantiation.

I don't know if this is known and just not completely implemented yet, but I figured I'd give the heads up.

fn main() {
  let x = 10;

  for z in 0u..x {
    println!("{}", z);
  }
}

:5:12: 5:13 error: expected :, found !
:5 println!("{}", z);

playpen

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: The grammar of RustA-parserArea: The lexing & parsing of Rust source code to an AST

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions