Skip to content

Mutable reference mode for first arg to methods ignored due to self type parsing bug #3191

Closed
@msullivan

Description

@msullivan
Contributor

The following code:

enum thing { thing(int) }
impl thing {
    fn baz(&x: int) { x = 5 }
}
fn main() {}

fails to compile with the error:

nubs/method-mutable-ref.rs:3:22: 3:23 error: assigning to argument
nubs/method-mutable-ref.rs:3     fn baz(&x: int) { x = 5 }

which is complete nonsense, since it is a mutable argument. This is because a bug in the parser code that handles explicit self types causes the '&' to get dropped.

Activity

removed their assignment
on Jun 16, 2014
added a commit that references this issue on Nov 25, 2023

Auto merge of rust-lang#3191 - RalfJung:rustup, r=RalfJung

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-frontendArea: Compiler frontend (errors, parsing and HIR)A-grammarArea: The grammar of Rust

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @msullivan

        Issue actions

          Mutable reference mode for first arg to methods ignored due to self type parsing bug · Issue #3191 · rust-lang/rust