Skip to content

Rustdoc incorrectly fires redundant_explicit_link warning #123677

New issue

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

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

Already on GitHub? # to your account

Closed
BD103 opened this issue Apr 9, 2024 · 3 comments · Fixed by #123905
Closed

Rustdoc incorrectly fires redundant_explicit_link warning #123677

BD103 opened this issue Apr 9, 2024 · 3 comments · Fixed by #123905
Assignees
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Milestone

Comments

@BD103
Copy link
Contributor

BD103 commented Apr 9, 2024

We've recently begun testing Bevy against the beta toolchain, where it has incorrectly raised an rustdoc::redundant_explicit_links lint against this lint.

/// Determines how frequently an [`App`](bevy_app::App) should update.
///
/// **Note:** This setting is independent of VSync. VSync is controlled by a window's
/// [`PresentMode`](bevy_window::PresentMode) setting. If an app can update faster than the refresh
/// rate, but VSync is enabled, the update rate will be indirectly limited by the renderer.
#[derive(Debug, Clone, Copy)]
pub enum UpdateMode {
   // ...

bevy_app::App is not imported in this file, yet rustdoc believes that it is. (See the imports here.) As a temporary workaround, I've created bevyengine/bevy#12913 to ignore the error.

Here is the job that first failed. In case it expires, here's this archive. Look at 1_check-doc.txt.

I can reproduce it on this commit using rustc 1.78.0-beta.5 by running the following command:

$ cargo doc -p bevy_winit --no-deps

The --no-deps is optional, but it makes the command finish quicker. I'll continue testing to see if I can create a minimum reproducible example.

Meta

rustc --version --verbose:

rustc 1.78.0-beta.5 (9eff51035 2024-04-06)
binary: rustc
commit-hash: 9eff5103597e0ce73244028c96c75866dbcbad1d
commit-date: 2024-04-06
host: aarch64-apple-darwin
release: 1.78.0-beta.5
LLVM version: 18.1.2
@BD103 BD103 added the C-bug Category: This is a bug. label Apr 9, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 9, 2024
@Mark-Simulacrum Mark-Simulacrum added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Apr 9, 2024
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Apr 9, 2024
@Mark-Simulacrum Mark-Simulacrum added this to the 1.78.0 milestone Apr 9, 2024
@fmease fmease added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 9, 2024
@apiraino apiraino added P-high High priority T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 10, 2024
@BD103
Copy link
Contributor Author

BD103 commented Apr 10, 2024

I've created a minimal reproduction in my 123677-repro branch of my fork. Go to the bevy_winit folder and run cargo doc --no-deps.

I've managed to squish it down to this:

// lib.rs

mod winit_config;

pub use winit_config::*;

use bevy_app::App;

/// [`App::runner`]
/// 
/// [runner](bevy_app::App::runner)
pub fn winit_runner() {}
// winit_config.rs

/// Determines how frequently an [`App`](bevy_app::App) should update.
pub enum UpdateMode {}

@BD103
Copy link
Contributor Author

BD103 commented Apr 10, 2024

I've created a reproduction that removes the dependency on Bevy here.

I've simplified it down to this:

mod bar {
    /// [`Rc`](std::rc::Rc)
    pub enum Baz {}
}

pub use bar::*;

use std::rc::Rc;

/// [`Rc::allocator`] [foo](std::rc::Rc)
pub fn winit_runner() {}

@BD103
Copy link
Contributor Author

BD103 commented Apr 10, 2024

I bisected it, and this bug appears to first be introduced in beta-2024-03-19. I could not reproduce it in beta-2024-03-17.

@notriddle notriddle self-assigned this Apr 13, 2024
@fmease fmease added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Apr 14, 2024
@bors bors closed this as completed in 4d32bc3 Apr 14, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 14, 2024
Rollup merge of rust-lang#123905 - notriddle:notriddle/redundant-explicit-link-hunks, r=GuillaumeGomez

rustdoc: check redundant explicit links with correct itemid

Fixes rust-lang#123677 (a regression caused by rust-lang#120702)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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.

6 participants