Skip to content

rustdoc fails at 'not a doc-comment' #15976

Closed
@SimonSapin

Description

@SimonSapin

Apparently, desugar_doc tries to call strip_doc_comment_decoration to convert to "desugar" a comment that was not "sugared" in the first place.

Test case:

This bug is not triggered if the comment is moved to the crate top-level (rather than a module), or when running rustdoc on a.rs directly

a.rs

pub mod a { #![doc = "Test"] }

b.rs

extern crate a;

Build commands and output:

$ rustc --crate-type lib a.rs
$ RUST_BACKTRACE=1 rustdoc b.rs -L .
task '<unnamed>' failed at 'not a doc-comment: Test', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/ast_util.rs:784
stack backtrace:
   1:     0x7f698a7645f0 - rt::backtrace::imp::write::h196d0788fd5af7e2J7p
   2:     0x7f698a7678f0 - failure::on_fail::h19a8129d7de62dbfYsq
   3:     0x7f698f60b3f0 - unwind::begin_unwind_inner::h7290ff1071e375d5VTd
   4:     0x7f698f60b070 - unwind::begin_unwind_fmt::hf1eab6137b01c57f4Qd
   5:     0x7f698b2f4bc0 - parse::lexer::comments::strip_doc_comment_decoration::h52bebd21516a3103KnF
   6:     0x7f698b2f4560 - attr::Attribute.AttributeMethods::desugar_doc::h7a442bdc81fe475ah5z
   7:     0x7f698fbbb160 - clean::ast..Attribute.Clean<Attribute>::clean::hd76d78f14d0f290auLb
   8:     0x7f698fbbafa0 - clean::inline::load_attrs::closure.$x22closure$x22$LP$20267$RP$
   9:     0x7f698fbb97b0 - clean::inline::load_attrs::closure.$x22closure$x22$LP$20195$RP$
  10:     0x7f698e764110 - metadata::decoder::get_item_attrs::h77c4d1d788ecba74Ucs
  11:     0x7f698e34c5e0 - metadata::csearch::get_item_attrs::hb646accdef04951coju
  12:     0x7f698fbdad10 - clean::cstore..crate_metadata.Clean<ExternalCrate>::clean::closure.$x22closure$x22$LP$22274$RP$
  13:     0x7f698e75a480 - metadata::decoder::each_child_of_item_or_crate::closure.$x22closure$x22$LP$132187$RP$
  14:     0x7f698af4acf0 - ebml::reader::tagged_docs::h21531a795db2c3e7Bif
  15:     0x7f698e75a160 - metadata::decoder::each_child_of_item_or_crate::h1c9197ded6464680IFr
  16:     0x7f698e75bf00 - metadata::decoder::each_top_level_item_of_crate::hfac63c9cf5ae2ee3PNr
  17:     0x7f698e20db70 - metadata::csearch::each_top_level_item_of_crate::hc7c15deef877aab6Nau
  18:     0x7f698fbd7cf0 - clean::cstore..crate_metadata.Clean<ExternalCrate>::clean::heb2e784f535b3f79YMa
  19:     0x7f698fbd7a50 - clean::visit_ast..RustdocVisitor<'a>.Clean<Crate>::clean::closure.$x22closure$x22$LP$22227$RP$
  20:     0x7f698e164a20 - metadata::cstore::CStore::iter_crate_data::h3d5af457708f90c8TUt
  21:     0x7f698fbd6870 - clean::visit_ast..RustdocVisitor<'a>.Clean<Crate>::clean::h70c51df18eff4f69HEa
  22:     0x7f698fc27190 - core::run_core::hebd872ca8878a181wJh
  23:     0x7f698fcf7250 - rust_input::closure.$x22closure$x22$LP$29353$RP$
  24:     0x7f698fcee460 - task::TaskBuilder<S>::try_future::closure.$x22closure$x22$LP$29159$RP$
  25:     0x7f698f95d750 - task::spawn_opts::closure.$x22closure$x22$LP$8216$RP$
  26:     0x7f698f6622c0 - rust_try
  27:     0x7f698f6086d0 - unwind::try::hc5b79cf0d453a48a0Hd
  28:     0x7f698f608430 - task::Task::run::h573b47a3c64dd74bQSc
  29:     0x7f698f95d540 - task::spawn_opts::closure.$x22closure$x22$LP$8162$RP$
  30:     0x7f698f60a4a0 - thread::thread_start::hcb4d88eeb2fea24bUfd
  31:     0x7f698a208060 - start_thread
  32:     0x7f698f2e0489 - __clone
  33:                0x0 - <unknown>
task '<main>' failed at 'called `Result::unwrap()` on an `Err` value: Box<core::any::Any:Send>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libcore/result.rs:548
stack backtrace:
   1:     0x7f698a7645f0 - rt::backtrace::imp::write::h196d0788fd5af7e2J7p
   2:     0x7f698a7678f0 - failure::on_fail::h19a8129d7de62dbfYsq
   3:     0x7f698f60b3f0 - unwind::begin_unwind_inner::h7290ff1071e375d5VTd
   4:     0x7f698f60b070 - unwind::begin_unwind_fmt::hf1eab6137b01c57f4Qd
   5:     0x7f698f60b030 - rust_begin_unwind
   6:     0x7f698f64ead0 - failure::begin_unwind::h39adb6de70d2239e5Wj
   7:     0x7f698fcdd810 - rust_input::h265dda0f703d2e9cxxt
   8:     0x7f698fcd24b0 - main_args::h70b9b0a493223a01o7s
   9:     0x7f698fcd2390 - main::h5520cb0cd7bfd3c851s
  10:     0x7f698f95de50 - start::closure.$x22closure$x22$LP$8280$RP$
  11:     0x7f698f6622c0 - rust_try
  12:     0x7f698f6086d0 - unwind::try::hc5b79cf0d453a48a0Hd
  13:     0x7f698f608430 - task::Task::run::h573b47a3c64dd74bQSc
  14:     0x7f698f95db00 - start::h9f770763fd166b762ke
  15:     0x7f698f95da70 - lang_start::hcbacf09ceac44709mke
  16:     0x7f698f216f10 - __libc_start_main
  17:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions