Skip to content

redundant_explicit_links rustdoc lint should have macro guard #141553

Description

@Manishearth

On ICU4X main, with nightly, cargo doc --all-features in provider/core

error: redundant explicit link target
   --> provider/core/src/constructors.rs:106:47
    |
106 |               "provided by a [`BufferProvider`](icu_provider::buf::BufferProvider).\n\n",
    |                               ----------------  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ explicit target is redundant
    |                               |
    |                               because label contains path that resolves to same destination
    |
   ::: provider/core/src/hello_world.rs:302:5
    |
302 | /     icu_provider::gen_buffer_data_constructors!((prefs: HelloWorldFormatterPreferences) -> error: DataError,
303 | |         functions: [
304 | |             try_new: skip,
305 | |             try_new_with_buffer_provider,
306 | |             try_new_unstable,
307 | |             Self,
308 | |     ]);
    | |______- in this macro invocation
    |
    = note: when a link's destination is not specified,
            the label is used to resolve intra-doc links
    = note: `-D rustdoc::redundant-explicit-links` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(rustdoc::redundant_explicit_links)]`
    = note: this error originates in the macro `$crate::gen_buffer_data_constructors` which comes from the expansion of the macro `icu_provider::gen_buffer_data_constructors` (in Nightly builds, run with -Z macro-backtrace for more info)

These docs are macro-generated, which means even if that import is around in some contexts, it isn't around in all of them, and we can't fix that in the macro.

https://github.com/unicode-org/icu4x/blob/f47044e3de1ba0c47a43b95968bd503902328188/provider/core/src/constructors.rs#L107

Given that they are macro generated docs, it is not possible to stick an allow() statement in the macro to silence the lint (without enabling attributes-on-expressions). So this code is permabroken.

This lint should probably get a macro guard, or even be reverted until this can be figured out: the lint is mostly a cleanup lint and should not cause such problems.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions