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 running clippy on embedded crate in release mode #59898

Closed
therealprof opened this issue Apr 12, 2019 · 7 comments
Closed

ICE running clippy on embedded crate in release mode #59898

therealprof opened this issue Apr 12, 2019 · 7 comments
Labels
E-needs-test Call for participation: Writing correctness tests. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@therealprof
Copy link
Contributor

Running clippy with cargo clippy --release --features="stm32f429" on crate stm32f4xx-hal in version 0.3.0 results in the following ICE:

    Checking cortex-m v0.5.8
    Checking cortex-m-rt v0.6.8
error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:745: Cannot create local mono-item for DefId(5/0:10 ~ r0[f593]::zero_bss[0])

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:620:9
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
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.34.0 (91856ed52 2019-04-10) running on x86_64-apple-darwin

note: compiler flags: -C opt-level=s -C debuginfo=2 -C link-arg=-Tlink.x --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `cortex-m-rt`.
warning: build failed, waiting for other jobs to finish...
error: build failed

Works fine in dev mode. Also works fine with --release in beta (rustc 1.35.0-beta.1 (2bc1d40 2019-04-10)) and nightly (rustc 1.35.0-nightly (96d700f 2019-04-10)).

Meta:

rustc 1.34.0 (91856ed52 2019-04-10)
binary: rustc
commit-hash: 91856ed52c58aa5ba66a015354d1cc69e9779bdf
commit-date: 2019-04-10
host: x86_64-apple-darwin
release: 1.34.0
LLVM version: 8.0

Backtrace:

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:620:9
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: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::bug
   8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::util::bug::opt_span_bug_fmt
  13: rustc::util::bug::bug_fmt
  14: rustc_mir::monomorphize::collector::should_monomorphize_locally
  15: rustc_mir::monomorphize::collector::visit_instance_use
  16: <rustc_mir::monomorphize::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_terminator_kind
  17: rustc_mir::monomorphize::collector::collect_items_rec
  18: rustc_mir::monomorphize::collector::collect_items_rec
  19: rustc_mir::monomorphize::collector::collect_crate_mono_items::{{closure}}
  20: rustc::util::common::time
  21: rustc_mir::monomorphize::collector::collect_crate_mono_items
  22: rustc::util::common::time
  23: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  24: rustc::ty::query::__query_compute::collect_and_partition_mono_items
  25: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::collect_and_partition_mono_items<'tcx>>::compute
  26: rustc::dep_graph::graph::DepGraph::with_task_impl
  27: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  28: core::ops::function::FnOnce::call_once
  29: rustc::ty::query::__query_compute::backend_optimization_level
  30: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::backend_optimization_level<'tcx>>::compute
  31: rustc::dep_graph::graph::DepGraph::with_task_impl
  32: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  33: rustc_codegen_llvm::back::write::create_target_machine
  34: rustc_codegen_llvm::context::create_module
  35: rustc_codegen_ssa::base::codegen_crate
  36: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  37: rustc::util::common::time
  38: rustc_driver::driver::phase_4_codegen
  39: rustc_driver::driver::compile_input::{{closure}}
  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: <scoped_tls::ScopedKey<T>>::set
  47: syntax::with_globals
  48: __rust_maybe_catch_panic
  49: <F as alloc::boxed::FnBox<A>>::call_box
  50: std::sys::unix::thread::Thread::new::thread_start
  51: _pthread_body
  52: _pthread_start
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
@hellow554
Copy link
Contributor

hellow554 commented Apr 12, 2019

Can reproduce it on linux. Using the latest git version also works (stm32-rs/stm32f4xx-hal@23dd28d) as well.
cargo build ... isn't enough, it has to be cargo clippy .... Where exactly is the difference? :|
You can also use cargo check ... to provoke the error.

@hellow554
Copy link
Contributor

hellow554 commented Apr 12, 2019

This has something to do with the given opt-level=s. If I modify the Cargo.toml and add opt-level="s" to the dev profile cargo check (only cargo check without any additional arguments) will crash as well.

The opt-level either needs to be "s" or "z". Opt-levels 2 and 3 do not crash.

@pietroalbini
Copy link
Member

Confirmed this is a regression from stable to stable, which is fixed in beta/nightly. Bisecting the fix.

cc @rust-lang/compiler @rust-lang/release
@rustbot modify labels: I-ICE regression-from-stable-to-stable T-compiler I-nominated

@rustbot rustbot added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-nominated regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 12, 2019
@pietroalbini
Copy link
Member

The issue is fixed by #58605, which for whatever reason wasn't beta-nominated. stable-nominating it.

@jonas-schievink
Copy link
Contributor

This is effectively a duplicate of #58323, which just resurfaced and broke my build again :( https://travis-ci.org/jonas-schievink/rubble/builds/519713130

@pnkfelix pnkfelix added the E-needs-test Call for participation: Writing correctness tests. label Apr 18, 2019
@pnkfelix
Copy link
Member

triage: P-high due to ICE. removing nomination tag since I don't think there's much to discuss here. (PR #58605 we will discuss as part of stable-nominations discussion.)

@pnkfelix
Copy link
Member

I'm going to close this as fixed, in the sense that we've landed a fix (PR #58605) that is currently in the beta branch, and is not going to be backported to stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: Writing correctness tests. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants