Skip to content

rustdoc ICE for intra links referring to builtin macros #48341

@Manishearth

Description

@Manishearth
/// [foo](format_args) struct Foo;

when passed through rustdoc gives the following crash:

thread 'rustc' panicked at 'index out of bounds: the len is 11 but the index is 4294967295', /Users/travis/build/rust-lang/rust/src/liballoc/vec.rs:1551:10 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. stack backtrace: 0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace 1: std::sys_common::backtrace::print 2: std::panicking::default_hook::{{closure}} 3: std::panicking::default_hook 4: std::panicking::rust_panic_with_hook 5: std::panicking::begin_panic 6: std::panicking::begin_panic_fmt 7: rust_begin_unwind 8: core::panicking::panic_fmt 9: core::panicking::panic_bounds_check 10: rustc::ty::maps::<impl rustc::ty::maps::queries::crate_name<'tcx>>::compute_result 11: rustc::dep_graph::graph::DepGraph::with_task_impl 12: rustc_errors::Handler::track_diagnostics 13: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check 14: rustc::ty::maps::<impl rustc::ty::maps::queries::crate_name<'tcx>>::force 15: rustc::ty::maps::<impl rustc::ty::maps::queries::crate_name<'tcx>>::try_get 16: rustc::ty::maps::TyCtxtAt::crate_name 17: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::crate_name 18: rustdoc::clean::inline::record_extern_fqn 19: rustdoc::clean::register_def 20: <[syntax::ast::Attribute] as rustdoc::clean::Clean<rustdoc::clean::Attributes>>::clean 21: <rustdoc::doctree::Struct as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean 22: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::spec_extend 23: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean 24: <rustdoc::visit_ast::RustdocVisitor<'a, 'tcx, 'rcx> as rustdoc::clean::Clean<rustdoc::clean::Crate>>::clean 25: rustdoc::core::run_core::{{closure}} 26: <std::thread::local::LocalKey<T>>::with 27: <std::thread::local::LocalKey<T>>::with 28: rustc::ty::context::TyCtxt::create_and_enter 29: rustc_driver::driver::phase_3_run_analysis_passes 30: rustdoc::core::run_core error: internal compiler error: unexpected panic note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports note: rustc 1.25.0-nightly (3d292b793 2018-02-03) running on x86_64-apple-darwin 

This is because resolve_macro returns DefIds containing CrateNum = -1 (cratenum is an unsigned integer, 🤷‍♀️) for syntax extensions

Metadata

Metadata

Assignees

Labels

C-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