Skip to content

#[doc = $expr] in macro silently fails to generate docs #44730

Closed

Description

@Manishearth
#![warn(missing_docs)]

//! la la la

macro_rules! make_enum {
    ($(($name:ident, $string:expr)),+) => {
        /// la la la
        pub enum Foo {
            $(
                #[doc = $string]
                $name,
            )+
        }
    }
}

make_enum!{(A, "a"), (B, "b"), (C, "c")}

This will not generate docs for the generated enum, and will warn about missing docs on the enum variant. (missing_docs is off by default, so normally you wouldn't notice this)

This is a rustc bug, not a rustdoc bug, since the lint fails too (so we're somehow losing the doc attribute entirely). This works fine on beta.

cc @eddyb

Activity

  1. Manishearth commented on Sep 21, 2017

    @Manishearth
    MemberAuthor

    This is a regression introduced in today's nightly (rustc 1.22.0-nightly (325ba23 2017-09-19))

    Details 325ba23 Auto merge of #44620 - zackmdavis:rfc_1940_housekeeping, r=nikomatsakis

    5d5dcae Auto merge of #44601 - alexcrichton:lower-attributes-in-hir, r=nrc

    9a00f3c Auto merge of #44026 - QuietMisdreavus:trimmed-std, r=steveklabnik

    0694e4f rustc: Forbid interpolated tokens in the HIR

    06bb0e0 Auto merge of #44680 - infinity0:master, r=Mark-Simulacrum

    8f25497 rustbuild: with --no-fail-fast, report the specific commands that failed

    0701b37 Auto merge of #44678 - alexcrichton:rollup, r=alexcrichton

    929215d Rollup merge of #44671 - GuillaumeGomez:run-button, r=steveklabnik

    4af3073 Rollup merge of #44668 - iwillspeak:into-iterator-docs, r=steveklabnik

    3bbe153 Rollup merge of #44661 - GuillaumeGomez:more-links, r=QuietMisdreavus

    64c9fd6 Rollup merge of #44657 - Ixrec:patch-1, r=eddyb

    d5b0cbb Rollup merge of #44651 - bluss:document-thread-name-no-nuls, r=steveklabnik

    fa9dd27 Rollup merge of #44640 - budziq:stabilize_splice, r=dtolnay

    156698e Rollup merge of #44548 - oyvindln:rustc_help_fix, r=arielb1

    8dae2b0 Rollup merge of #44537 - oli-obk:memchr, r=alexcrichton

    fbf3b8a Rollup merge of #44466 - clarcharr:cow_error, r=alexcrichton

    9ad5473 Rollup merge of #44364 - michaelwoerister:hash-all-the-things2, r=nikomatsakis

    90ce24a Fix run button

    4961a8e incr.comp.: Fix ICE caused by trying to hash INVALID_CRATE_NUM.

    74d6b85 incr.comp.: Fix rebase fallout.

    d5b1fee incr.comp.: Remove tcx from StableHashingContext.

    ba6f93c incr.comp.: Make the StableHashingContext mostly independent of the tcx.

    e567afb incr.comp.: Initialize IGNORED_ATTRS in StableHashingContext lazily.

    dd50173 incr.comp.: Initialize the CachingCodemapView in StableHashingContext lazily.

    67c84e0 incr.comp.: Use StableHash impls instead of functions for hashing most maps.

    b9816c5 incr.comp.: Already hash HIR bodies during metadata export so they don't have to be hashed in downstream crates.

    e3f9131 Fix issues uncovered by rebasing:

    3cc3ae2 incr.comp.: Move result fingerprinting to DepGraph::with_task().

    e6c9a53 incr.comp.: Compute hashes of all query results.

    3cf28f3 Use DefId instead of NodeId as identifier in resolve_lifetime::Region.

    3a7b960 Auto merge of #44441 - tamird:cargo-bitflags, r=alexcrichton

    ebd0e4f Add Example of IntoIterator as Trait Bound to Docs

    caad256 Auto merge of #43628 - oli-obk:orbital_standard_library, r=alexcrichton

    e8a76d8 Auto merge of #44529 - alexcrichton:trans-query, r=michaelwoerister

    e47279f Add more links and put the link character to the left

    01555b1 Rebase fallout

    a9df19b Update miri submodule

    68fc65e Prevent distribution if miri is enabled

    13921da -Zmir-emit-validate is in stage 0

    ab018c7 Add a file to trivially disable tool building or testing

    f0b5402 Improve documentation

    f381744 Get the miri test suite to run inside the rustc dev environment

    2787a28 Add <*const T>::align_offset and use it in memchr

    231d9e7 Remove rustc_bitflags; use the bitflags crate

    6d614dd rustc: Move codegen to a query

    e788fa7 bootstrap: plumb verbosity into submodule ops

    4a8933f Use double quotes to appease some TOML parsers

    3021c1d rustc: Attach an mpsc channel to TyCtxt

    2eada58 rustc: Remove another global map from trans

    19727c8 rustc: Move a comment to the right spot in trans

    afb85cf rustc: Mostly remove ExportedSymbols

    8821aff rustc: Move some attr methods to queries

    132bde7 rustc: Make trans collect/partition a query

    dba3ddd rustc: Calculate ExportedSymbols in a query

    baca9a6 rustc: Use reachablility through a query

    a97ad6a rustc: Refactor trans paritioning to use tcx

    c72240a rustc_trans: Refactor collection to use tcx

    38fa340 missed a 'mut'

    2633b85 Replace str's transmute() calls with pointer casts

    6b167f9 Updated tracking issue for String::splice and its unstable-book entry

    7b932d2 stabilized vec_splice (fixes #32310)

    7859c9e std: Document thread builder panics for nul bytes in thread names

    d09db63 unstable book section for fn_must_use

    e9569d9 RFC 1940 UI test in own directory, exercise must_use trait methods

    e89748e Remove the other period and start with lowercase for more consistency

    edf1622 Add proper help line for inline threshold

    778d5f2 Add Cow -> Box impls.

    64f6111 remove tests for doc(masked)

    db09332 update doc_masked docs and tracking issue

    bb6de3c add feature gate doc_masked and tests

    c491e19 new attribute #[doc(masked)] to hide internal crates from std docs

  2. kennytm commented on Sep 21, 2017

    @kennytm
    Member

    I suspect #44601 (very likely) or #44026 (less likely).

  3. Manishearth commented on Sep 21, 2017

    @Manishearth
    MemberAuthor

    This seems to apply to any kind of attribute, not just doc attributes (and not just the #[doc = "string"] form:

    macro_rules! never {
        ($inline:ident) => {
            #[inline($inline)]
            pub fn foo(x: u8) -> u8 { x * x}
        }
    }
    never!{never}
    

    does not generate noinline in the LLVM IR

    Similarly, doing something like this with #[repr(nonsense)] will not trigger the repr error. Seems like these attributes get discarded early.

  4. Manishearth commented on Sep 21, 2017

    @Manishearth
    MemberAuthor

    Looks like early lint passes do detect these attributes, it is late lint passes which have trouble here. So it's on the HIR side.

  5. Manishearth commented on Sep 21, 2017

    @Manishearth
    MemberAuthor

    Yep, it was regressed by #44601

  6. eddyb commented on Sep 21, 2017

    @eddyb
    Contributor

    Well, cc-ing @alexcrichton (and/or @rust-lang/compiler) seems more appropriate.

  7. self-assigned this
    on Sep 21, 2017
  8. alexcrichton commented on Sep 21, 2017

    @alexcrichton
    Member

    I'm working on a fix for this

  9. alexcrichton commented on Sep 21, 2017

    @alexcrichton
    Member

    I've posted a fix at #44745

  10. added a commit that references this issue on Sep 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.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