Skip to content

mut in a default method parameter list doesn't parse #7483

@huonw

Description

@huonw
#[allow(default_methods)];

trait Foo {
    fn foo(mut v: int) {}
}

fn main() {}
trait-dm-mut.rs:4:10: 4:11 error: found `mut` in ident position
trait-dm-mut.rs:4     fn foo(mut v: int) {}
                            ^
trait-dm-mut.rs:4:15: 4:16 error: expected `,` but found `v`
trait-dm-mut.rs:4     fn foo(mut v: int) {}
                                 ^

This is presumably just a parser issue; the following works:

trait Foo {
    fn foo(v: int);
}
impl Foo for int { fn foo(mut v: int) {} }

fn main() {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The lexing & parsing of Rust source code to an ASTE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions