Skip to content

by value closure's span starts at || instead of at move #24986

Closed
@oli-obk

Description

@oli-obk

The related piece of code is

// libsyntax/parse/parser.rs:2104
                if try!(self.eat_keyword(keywords::Move) ){
                    return self.parse_lambda_expr(CaptureByValue);
                }

Since move got eaten, self.span.lo will point behind the move

// libsyntax/parse/parser.rs:2864
    pub fn parse_lambda_expr(&mut self, capture_clause: CaptureClause)
                             -> PResult<P<Expr>>
    {
        let lo = self.span.lo;

I don't know anything about the code in libsyntax. I'd probably make a mess of it.
My intuition says simply adding self.span.lo = lo; just before the return self.parse_lambda_expr(CaptureByValue); might not be the best idea, since other code might depend on lo not getting modified here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions