Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE generating intra-doc link to std::primitive::i32::MAX #76693

Closed
ollie27 opened this issue Sep 14, 2020 · 0 comments · Fixed by #76955
Closed

ICE generating intra-doc link to std::primitive::i32::MAX #76693

ollie27 opened this issue Sep 14, 2020 · 0 comments · Fixed by #76955
Assignees
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@ollie27
Copy link
Member

ollie27 commented Sep 14, 2020

Code

//! [`std::primitive::i32::MAX`]

Meta

Backtrace is from a local build of a055c5a but this also reproduces on at least rustdoc 1.48.0-nightly (dbb73f8f7 2020-09-12).

Error output

thread 'rustc' panicked at 'internal error: entered unreachable code: primitives are covered above and other `Res` variants aren't possible at module scope: PrimTy(Int(I32))', src\librustdoc\passes\collect_intra_doc_links.rs:1617:34
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.48.0-dev running on x86_64-pc-windows-msvc
Backtrace

thread 'rustc' panicked at 'internal error: entered unreachable code: primitives are covered above and other `Res` variants aren't possible at module scope: PrimTy(Int(I32))', src\librustdoc\passes\collect_intra_doc_links.rs:1617:34
stack backtrace:
   0: std::panicking::begin_panic_handler
             at C:\Source\rust\library\std\src\panicking.rs:483
   1: std::panicking::begin_panic_fmt
             at C:\Source\rust\library\std\src\panicking.rs:437
   2: rustdoc::passes::collect_intra_doc_links::resolution_failure::{{closure}}
             at C:\Source\rust\src\librustdoc\passes\collect_intra_doc_links.rs:1617
   3: rustdoc::passes::collect_intra_doc_links::report_diagnostic::{{closure}}
             at C:\Source\rust\src\librustdoc\passes\collect_intra_doc_links.rs:1484
   4: core::ops::function::FnOnce::call_once<closure-0,tuple<rustc_middle::lint::LintDiagnosticBuilder>>
             at C:\Source\rust\library\core\src\ops\function.rs:227
   5: alloc::boxed::{{impl}}::call_once
             at C:\Source\rust\library\alloc\src\boxed.rs:1042
   6: rustc_middle::lint::struct_lint_level::struct_lint_level_impl
             at C:\Source\rust\compiler\rustc_middle\src\lint.rs:331
   7: rustc_middle::lint::struct_lint_level
             at C:\Source\rust\compiler\rustc_middle\src\lint.rs:333
   8: rustc_middle::ty::context::TyCtxt::struct_span_lint_hir<rustc_span::span_encoding::Span,closure-0>
             at C:\Source\rust\compiler\rustc_middle\src\ty\context.rs:2585
   9: rustdoc::passes::collect_intra_doc_links::report_diagnostic
             at C:\Source\rust\src\librustdoc\passes\collect_intra_doc_links.rs:1454
  10: rustdoc::passes::collect_intra_doc_links::resolution_failure
             at C:\Source\rust\src\librustdoc\passes\collect_intra_doc_links.rs:1499
  11: rustdoc::passes::collect_intra_doc_links::{{impl}}::fold_item
             at C:\Source\rust\src\librustdoc\passes\collect_intra_doc_links.rs:1062
  12: rustdoc::fold::DocFolder::fold_crate::{{closure}}
             at C:\Source\rust\src\librustdoc\fold.rs:93
  13: core::option::Option::and_then
             at C:\Source\rust\library\core\src\option.rs:646
  14: rustdoc::fold::DocFolder::fold_crate
             at C:\Source\rust\src\librustdoc\fold.rs:93
  15: rustdoc::passes::collect_intra_doc_links::collect_intra_doc_links
             at C:\Source\rust\src\librustdoc\passes\collect_intra_doc_links.rs:46
  16: rustdoc::core::run_global_ctxt::{{closure}}
             at C:\Source\rust\src\librustdoc\core.rs:552
  17: rustc_data_structures::profiling::VerboseTimingGuard::run
             at C:\Source\rust\compiler\rustc_data_structures\src\profiling.rs:573
  18: rustc_session::session::Session::time
             at C:\Source\rust\compiler\rustc_session\src\utils.rs:9
  19: rustdoc::core::run_global_ctxt
             at C:\Source\rust\src\librustdoc\core.rs:654
  20: rustdoc::core::run_core::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at C:\Source\rust\src\librustdoc\core.rs:469
  21: rustc_interface::passes::{{impl}}::enter::{{closure}}
             at C:\Source\rust\compiler\rustc_interface\src\passes.rs:722
  22: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at C:\Source\rust\compiler\rustc_middle\src\ty\context.rs:1725
  23: rustc_middle::ty::context::tls::set_tlv
             at C:\Source\rust\compiler\rustc_middle\src\ty\context.rs:1709
  24: rustc_middle::ty::context::tls::enter_context
             at C:\Source\rust\compiler\rustc_middle\src\ty\context.rs:1725
  25: rustc_interface::passes::QueryContext::enter<closure-0,tuple<rustdoc::clean::types::Crate, rustdoc::config::RenderInfo, rustdoc::config::RenderOptions>>
             at C:\Source\rust\compiler\rustc_interface\src\passes.rs:722
  26: rustdoc::core::run_core::{{closure}}::{{closure}}::{{closure}}
             at C:\Source\rust\src\librustdoc\core.rs:468
  27: rustc_data_structures::profiling::VerboseTimingGuard::run
             at C:\Source\rust\compiler\rustc_data_structures\src\profiling.rs:573
  28: rustc_session::session::Session::time
             at C:\Source\rust\compiler\rustc_session\src\utils.rs:9
  29: rustdoc::core::run_core::{{closure}}::{{closure}}
             at C:\Source\rust\src\librustdoc\core.rs:467
  30: rustc_interface::interface::Compiler::enter
             at C:\Source\rust\compiler\rustc_interface\src\queries.rs:385
  31: rustdoc::core::run_core::{{closure}}
             at C:\Source\rust\src\librustdoc\core.rs:426
  32: rustc_interface::interface::create_compiler_and_run::{{closure}}
             at C:\Source\rust\compiler\rustc_interface\src\interface.rs:191
  33: rustc_span::with_source_map
             at C:\Source\rust\compiler\rustc_span\src\lib.rs:750
  34: rustc_interface::interface::create_compiler_and_run<tuple<rustdoc::clean::types::Crate, rustdoc::config::RenderInfo, rustdoc::config::RenderOptions, alloc::rc::Rc<rustc_session::session::Session>>,closure-4>
             at C:\Source\rust\compiler\rustc_interface\src\interface.rs:185
  35: rustdoc::core::run_core
             at C:\Source\rust\src\librustdoc\core.rs:425
  36: rustdoc::main_options
             at C:\Source\rust\src\librustdoc\lib.rs:504
  37: rustdoc::main_args::{{closure}}
             at C:\Source\rust\src\librustdoc\lib.rs:438
  38: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}}
             at C:\Source\rust\compiler\rustc_interface\src\util.rs:149
  39: scoped_tls::ScopedKey::set
             at C:\Users\Oliver\AppData\Local\Cargo\registry\src\github.com-1ecc6299db9ec823\scoped-tls-1.0.0\src\lib.rs:137
  40: rustc_span::with_session_globals<core::result::Result<tuple<>, rustc_errors::ErrorReported>,closure-0>
             at C:\Source\rust\compiler\rustc_span\src\lib.rs:91
  41: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}
             at C:\Source\rust\compiler\rustc_interface\src\util.rs:145
  42: rustc_interface::util::scoped_thread::{{closure}}
             at C:\Source\rust\compiler\rustc_interface\src\util.rs:120
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.48.0-dev running on x86_64-pc-windows-msvc

query stack during panic:
end of query stack

@ollie27 ollie27 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name labels Sep 14, 2020
@jyn514 jyn514 self-assigned this Sep 20, 2020
RalfJung added a commit to RalfJung/rust that referenced this issue Sep 25, 2020
Refactor and fix intra-doc link diagnostics, and fix links to primitives

Closes rust-lang#76925, closes rust-lang#76693, closes rust-lang#76692.

Originally I only meant to fix rust-lang#76925. But the hack with `has_primitive` was so bad it was easier to fix the primitive issues than to try and work around it.

Note that this still has one bug: `std::primitive::i32::MAX` does not resolve. However, this fixes the ICE so I'm fine with fixing the link in a later PR.

This is part of a series of refactors to make rust-lang#76467 possible.

This is best reviewed commit-by-commit; it has detailed commit messages.

r? @euclio
@bors bors closed this as completed in 71bdb84 Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants