Skip to content

Renaming use alias renames the aliased symbol instead #5671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tracked by #14079
Veetaha opened this issue Aug 5, 2020 · 1 comment
Open
Tracked by #14079

Renaming use alias renames the aliased symbol instead #5671

Veetaha opened this issue Aug 5, 2020 · 1 comment
Labels
S-actionable Someone could pick this issue up and work on it right now

Comments

@Veetaha
Copy link
Contributor

Veetaha commented Aug 5, 2020

I'd expect that renaming the alias would rename the alias itself, but not the underlying symbol (especially if the underlying symbol comes from std or some other crate):

Code to play with:

mod foo {
    pub(crate) fn bar() {}
}

use foo::bar as baz;

pub fn run() {
    baz();
}

demo

@flodiebold flodiebold added the S-actionable Someone could pick this issue up and work on it right now label Dec 21, 2020
bors bot added a commit that referenced this issue Jun 5, 2021
Merge #9148

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
9148: minor: Prevent renaming of aliases on usages r=Veykril a=Veykril

Otherwise trying to rename a usage that goes through an alias will still rename the aliased item instead, cc #5671
bors r+

Co-authored-by: Lukas Wirth <[email protected]>
@lopopolo
Copy link

I have some code like this in lib.rs:

mod folding {
    mod ascii {
        pub fn eq() {}
    }

    pub use ascii::eq as ascii_case_eq;
}

pub use folding::ascii_case_eq;

Renaming eq function in the ascii module to case_eq leaves the alias in the folding module untouched but renames the outermost pub use folding::ascii_case_eq to pub use folding::case_eq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

3 participants