Skip to content

Undesired formatting with &raw (place) #6503

Closed
@antonio-hickey

Description

@antonio-hickey
pub fn some_fn(&self) -> u32 {
    unsafe { &raw (*self.as_ptr()) }
}

when formatted becomes:

pub fn some_fn(&self) -> u32 {
    unsafe { &raw(*self.as_ptr()) }
}

this makes it look like raw is a function, which doesn't exist and won't compile.

Activity

ytmimi

ytmimi commented on Mar 13, 2025

@ytmimi
Contributor

Is there a tracking issue you can link to? I'm not familiar with raw places.

Edit: I think this is the tracking issue, and it looks like this was stabilized recently.

ytmimi

ytmimi commented on Mar 13, 2025

@ytmimi
Contributor

@antonio-hickey does this compile before formatting?

Maybe you meant to write &raw const or &raw mut?

antonio-hickey

antonio-hickey commented on Mar 13, 2025

@antonio-hickey
Author

Yes, &raw const in which case works fine.

Thanks

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ytmimi@antonio-hickey

        Issue actions

          Undesired formatting with `&raw (place)` · Issue #6503 · rust-lang/rustfmt