Skip to content
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

rustdoc renders renamed imports using the new name #81141

Closed
camelid opened this issue Jan 18, 2021 · 2 comments · Fixed by #113374
Closed

rustdoc renders renamed imports using the new name #81141

camelid opened this issue Jan 18, 2021 · 2 comments · Fixed by #113374
Assignees
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@camelid
Copy link
Member

camelid commented Jan 18, 2021

rustdoc renders renamed imports (use foo as bar;) using the new, private name
(e.g., bar in use foo as bar;). This is confusing behavior since the new
name is an implementation detail. I think it should be using the original
item's name instead.

As an example, chrono::Date::signed_duration_since returns a Duration, but
the module it's defined in renames Duration to OldDuration. I would expect
rustdoc to still show the item's definition name, but instead it shows the
private OldDuration name.

@camelid camelid added C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 18, 2021
@jyn514
Copy link
Member

jyn514 commented Jan 18, 2021

I don't think this should be changed until #42066 is fixed. Otherwise you could have two items shown with the same name and namespace in the same scope.

@GuillaumeGomez
Copy link
Member

Code to reproduce:

use core::time::Duration as Alias;

pub fn bar() -> Alias {
    Alias::new(0, 0)
}

I don't think we need to wait for #42066 to be fixed as the fix for this doesn't impact it: if the re-export is not publicly reexported, we simply show the item underneath. When we will fix #42066, it will handle it the same.

@GuillaumeGomez GuillaumeGomez self-assigned this Jul 4, 2023
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 7, 2023
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 7, 2023
…ath, r=notriddle,fmease

[rustdoc] If re-export is private, get the next item until a public one is found or expose the private item directly

Fixes rust-lang#81141.

If we have:

```rust
use Private as Something;

pub fn foo() -> Something {}
```

Then `Something` will be replaced by `Private`.

r? `@notriddle`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 7, 2023
…ath, r=notriddle,fmease

[rustdoc] If re-export is private, get the next item until a public one is found or expose the private item directly

Fixes rust-lang#81141.

If we have:

```rust
use Private as Something;

pub fn foo() -> Something {}
```

Then `Something` will be replaced by `Private`.

r? ``@notriddle``
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 7, 2023
…ath, r=notriddle,fmease

[rustdoc] If re-export is private, get the next item until a public one is found or expose the private item directly

Fixes rust-lang#81141.

If we have:

```rust
use Private as Something;

pub fn foo() -> Something {}
```

Then `Something` will be replaced by `Private`.

r? ```@notriddle```
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 8, 2023
…ath, r=notriddle,fmease

[rustdoc] If re-export is private, get the next item until a public one is found or expose the private item directly

Fixes rust-lang#81141.

If we have:

```rust
use Private as Something;

pub fn foo() -> Something {}
```

Then `Something` will be replaced by `Private`.

r? ````@notriddle````
compiler-errors added a commit to compiler-errors/rust that referenced this issue Jul 8, 2023
…ath, r=notriddle,fmease

[rustdoc] If re-export is private, get the next item until a public one is found or expose the private item directly

Fixes rust-lang#81141.

If we have:

```rust
use Private as Something;

pub fn foo() -> Something {}
```

Then `Something` will be replaced by `Private`.

r? `````@notriddle`````
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 9, 2023
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 25, 2023
@bors bors closed this as completed in 9339f44 Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
4 participants