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 shows broken anonymous lifetimes on re-exported signatures #98697

Closed
dtolnay opened this issue Jun 30, 2022 · 2 comments · Fixed by #98727
Closed

Rustdoc shows broken anonymous lifetimes on re-exported signatures #98697

dtolnay opened this issue Jun 30, 2022 · 2 comments · Fixed by #98727
Labels
C-bug Category: This is a bug. regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@dtolnay
Copy link
Member

dtolnay commented Jun 30, 2022

# Cargo.toml

[package]
name = "repro"
version = "0.0.0"
edition = "2021"
publish = false

[dependencies]
foo = { path = "foo" }
// src/lib.rs

pub use foo::repro;
# foo/Cargo.toml

[package]
name = "foo"
version = "0.0.0"
edition = "2021"
publish = false
// foo/src/lib.rs

pub fn repro<F>()
where
    F: Fn(&str),
{
    unimplemented!()
}

The correct behavior is for both crates' docs to render repro as:

However, recent versions of nightly rustdoc render foo::repro as the above, while rendering repro::repro incorrectly as:

I believe this is a bug because that is not valid syntax in Rust.

error[E0637]: `'_` cannot be used here
 --> src/lib.rs:3:12
  |
3 |     F: for<'_> Fn(&str),
  |            ^^ `'_` is a reserved lifetime name
@dtolnay dtolnay added the C-bug Category: This is a bug. label Jun 30, 2022
@dtolnay
Copy link
Member Author

dtolnay commented Jun 30, 2022

Bisect:

$ cat bisect.sh 
#!/bin/bash
cargo doc
not rg "for&lt;" $CARGO_TARGET_DIR/doc

$ cargo-bisect-rustc --start 2022-03-31 --end 2022-06-30 --script ./bisect.sh

bisects to 10f4ce3 in nightly-2022-06-23 (#98279@cjgillot @petrochenkov)

@dtolnay dtolnay added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jun 30, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jun 30, 2022
@dtolnay dtolnay added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jun 30, 2022
@dtolnay
Copy link
Member Author

dtolnay commented Jun 30, 2022

Example affecting the standard library docs:

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 30, 2022
…GuillaumeGomez

rustdoc: filter '_ lifetimes from ty::PolyTraitRef

Fixes rust-lang#98697
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 1, 2022
…GuillaumeGomez

rustdoc: filter '_ lifetimes from ty::PolyTraitRef

Fixes rust-lang#98697
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jul 1, 2022
@bors bors closed this as completed in cd7bd8b Jul 1, 2022
Mark-Simulacrum pushed a commit to Mark-Simulacrum/rust that referenced this issue Jul 9, 2022
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. regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants