Skip to content

rustdoc panics on broken intra-doc links if there are both inner and outer attributes #78591

Closed
@yvt

Description

@yvt

src/lib.rs:

macro_rules! m {
    () => {
        /// A
        pub mod mymodule;
    }
}

m!();

src/mymodule.rs:

//! [`long_cat`] is really long

Full source code

I expected to see this happen: cargo doc completes successfully with a "unresolved link to long_cat" warning

Instead, this happened: thread 'rustc' panicked at 'could not find markdown in source', src/librustdoc/passes/mod.rs:199:48

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (31530e5d1 2020-10-20)
binary: rustc
commit-hash: 31530e5d132ebcc3654baf2e5460599681520af0
commit-date: 2020-10-20
host: x86_64-apple-darwin
release: 1.49.0-nightly
LLVM version: 11.0
Backtrace

thread 'rustc' panicked at 'could not find markdown in source', src/librustdoc/passes/mod.rs:199:48
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::option::expect_failed
   3: rustdoc::passes::source_span_for_markdown_range
   4: core::ops::function::FnOnce::call_once{{vtable.shim}}
   5: rustc_middle::lint::struct_lint_level::struct_lint_level_impl
   6: rustc_middle::ty::context::TyCtxt::struct_span_lint_hir
   7: rustdoc::passes::collect_intra_doc_links::resolution_failure
   8: rustdoc::passes::collect_intra_doc_links::LinkCollector::resolve_link
   9: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder>::fold_item
  10: <alloc::vec::Vec<T> as alloc::vec::SpecFromIter<T,I>>::from_iter
  11: rustdoc::fold::DocFolder::fold_inner_recur
  12: rustdoc::fold::DocFolder::fold_item_recur
  13: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder>::fold_item
  14: rustdoc::passes::collect_intra_doc_links::collect_intra_doc_links
  15: rustdoc::core::run_global_ctxt
  16: rustc_interface::passes::QueryContext::enter
  17: rustc_interface::interface::create_compiler_and_run
  18: rustdoc::core::run_core
  19: rustdoc::main_options
  20: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

error: Unrecognized option: 'crate-version'

error: could not document `rust-bug-202010`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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