Skip to content

ref mut check for mutable argument not done on methods #7621

@ironcev

Description

@ironcev

Related to #7623.

E.g., this compiles without errors;

script;

struct S {}

impl S {
    fn method(self, ref mut _x: u64) { }
} 

fn main() {
    let x = 42u64;       // <<<<<----- `x` is not mutable...
    S {}.method(x);      // <<<<<----- ...but is passed without errors.
}

The check is properly done on associated functions and module functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompilerGeneral compiler. Should eventually become more specific as the issue is triagedcompiler: frontendEverything to do with type checking, control flow analysis, and everything between parsing and IRgen

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions