Skip to content

Use of raw pointer as self parameter #26194

Closed
@eefriedman

Description

@eefriedman

Testcase:

struct S(String);
impl S {
    fn f(self: *mut S) -> String { self.0 } 
}
fn main() { S("".to_owned()).f(); }

This somehow compiles and runs without any errors.

I'm not sure how exactly this is getting interpreted by the compiler, but it seems dubious at best.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions