Skip to content

Rustdoc nightly crash with "Cannot create local mono-item" #58978

Closed
@mattheww

Description

@mattheww

Current nightly rust is crashing for me if I try to build the documentation of
cortex-m-rt with opt-level = "s".

The reported error is:

error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:745: Cannot create local mono-item for DefId(5/0:10 ~ r0[6302]::zero_bss[0])

The version is rustdoc 1.35.0-nightly (f22dca0a1 2019-03-05).

I haven't been able to show a problem using cargo +nightly build.

Steps to reproduce:

cargo init bugreport
cd bugreport
cat >> Cargo.toml <<EOF
cortex-m-rt = "0.6.7"

[profile.dev]
opt-level = "s"
EOF

RUST_BACKTRACE=1 cargo +nightly doc

backtrace:

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:620:9
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: rustc::util::common::panic_hook
   5: core::ops::function::Fn::call
   6: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   7: std::panicking::begin_panic
   8: rustc_errors::Handler::bug
   9: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  10: rustc::ty::context::tls::with_opt::{{closure}}
  11: rustc::ty::context::tls::with_context_opt
  12: rustc::ty::context::tls::with_opt
  13: rustc::util::bug::opt_span_bug_fmt
  14: rustc::util::bug::bug_fmt
  15: rustc_mir::monomorphize::collector::should_monomorphize_locally
  22: rustc_mir::monomorphize::collector::collect_crate_mono_items
  27: rustc::dep_graph::graph::DepGraph::with_task_impl
  28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  29: core::ops::function::FnOnce::call_once
  30: rustc::ty::query::__query_compute::backend_optimization_level
  31: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::backend_optimization_level<'tcx>>::compute
  32: rustc::dep_graph::graph::DepGraph::with_task_impl
  33: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  34: rustc_codegen_llvm::back::write::create_target_machine
  35: rustc_codegen_llvm::context::create_module
  36: rustc_codegen_ssa::base::codegen_crate
  37: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  38: rustc::util::common::time
  39: rustc_driver::driver::phase_4_codegen
  40: <std::thread::local::LocalKey<T>>::with
  41: rustc::ty::context::TyCtxt::create_and_enter
  42: rustc_driver::driver::compile_input
  43: rustc_driver::run_compiler_with_pool
  44: <scoped_tls::ScopedKey<T>>::set
  45: rustc_driver::run_compiler
  46: syntax::with_globals
  47: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:87
  49: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/f22dca0a1bef4141e75326caacc3cd59f3d5be8e/src/liballoc/boxed.rs:759
             at src/libstd/sys_common/thread.rs:14
             at src/libstd/sys/unix/thread.rs:80
  50: start_thread
  51: __clone
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [backend_optimization_level] optimization level used by backend
end of query stack
error: aborting due to previous error

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.35.0-nightly (f22dca0a1 2019-03-05) running on i686-unknown-linux-gnu

note: compiler flags: -C opt-level=s -C debuginfo=2 -C debug-assertions=on --crate-type lib

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions