Skip to content

do not normalize use foo::{self} to use foo #17494

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

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

harrysarson
Copy link
Contributor

It changes behaviour and can cause collisions. E.g. for the following snippet

mod foo {

    pub mod bar {}

    pub const bar: i32 = 8;
}

// transforming the below to `use foo::bar;` causes the error:
//
//   the name `bar` is defined multiple times
use foo::bar::{self};

const bar: u32 = 99;

fn main() {
    let local_bar = bar;
}

we still normalize

use foo::bar;
use foo::bar::{self};

to use foo::bar; because this cannot cause collisions.

See: #17140 (comment)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 25, 2024
@harrysarson
Copy link
Contributor Author

cc: @Veykril

It changes behaviour and can cause collisions. E.g. for the following snippet

```rs
mod foo {

    pub mod bar {}

    pub const bar: i32 = 8;
}

// tranforming the below to `use foo::bar;` causes the error:
//
//   the name `bar` is defined multiple times
use foo::bar::{self};

const bar: u32 = 99;

fn main() {
    let local_bar = bar;
}
```

we still normalize

```rs
use foo::bar;
use foo::bar::{self};
```

to `use foo::bar;` because this cannot cause collisions.

See: rust-lang#17140 (comment)
@Veykril
Copy link
Member

Veykril commented Jul 1, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Jul 1, 2024

📌 Commit 23965e4 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jul 1, 2024

⌛ Testing commit 23965e4 with merge becf5d3...

@bors
Copy link
Contributor

bors commented Jul 1, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing becf5d3 to master...

@bors bors merged commit becf5d3 into rust-lang:master Jul 1, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants