Skip to content

Renaming a struct that has a function with the same name will break code: #18892

Open
@Veykril

Description

@Veykril
// This currently export both the function and the struct
pub use aligned::Aligned;

mod aligned {
    // Renaming this struct will rename the `pub use` above, breaking the use in the test
    pub struct Aligned {
        size: usize,
    }

    #[allow(non_snake_case)]
    pub fn Aligned(size: usize) -> Aligned {
        Aligned {
            size
        }
    }
}

#[test]
fn aligned_rename_failure() {
    Aligned(5);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-idegeneral IDE featuresC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions