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

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

Closed
msullivan opened this issue Aug 13, 2012 · 0 comments
Labels
A-frontend Area: frontend (errors, parsing and HIR) A-grammar Area: The grammar of Rust

Comments

@msullivan
Copy link
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.

@ghost ghost assigned msullivan Aug 13, 2012
@msullivan msullivan removed their assignment Jun 16, 2014
RalfJung pushed a commit to RalfJung/rust that referenced this issue Nov 25, 2023
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Update Rust toolchain from nightly-2024-05-16 to nightly-2024-05-17
without any other source changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: frontend (errors, parsing and HIR) A-grammar Area: The grammar of Rust
Projects
None yet
Development

No branches or pull requests

1 participant