Skip to content

1.46.0-nightly panics on a particular proc macro invocation #73993

Description

@drahnr

UPDATE: MCVE can be found here.


Nightly compilation error due to rustc bug

# rustup run nightly rustc --version
rustc 1.46.0-nightly (3503f565e 2020-07-02)

I tried this code:

https://github.com/paritytech/substrate/blob/master/frame/support/procedural/src/construct_runtime/mod.rs#L31-L425

I expected to see this happen: explanation

Successful compilation.

Instead, this happened:

rustc tells to report a bug, see backtrace.

Meta

rustup run nightly rustc --version --verbose:

rustc 1.46.0-nightly (3503f565e 2020-07-02)
binary: rustc
commit-hash: 3503f565e1fb7296983757d2716346f48a4a262b
commit-date: 2020-07-02
host: x86_64-unknown-linux-gnu
release: 1.46.0-nightly
LLVM version: 10.0

Reproduce with

(1st update)

git clone git@github.com:hicommonwealth/edgeware-node.git
cd edgeware-node
git checkout 893981a2f2fdff8b3e6b0dddf4cf7ad4f9a09dfe
rustup override set nightly-2020-06-28
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-06-28-x86_64-unknown-linux-gnu
cargo build --release -p edgeware-runtime
Backtrace

   Compiling edgeware-runtime v3.0.0 (/tmp/edgeware-node/node/runtime/edgeware)
   Compiling pallet-treasury v2.0.0-alpha.1 (https://github.com/hicommonwealth/substrate.git#1164dec0)
   Compiling edge-voting v1.0.0 (/tmp/edgeware-node/modules/edge-voting)
   Compiling pallet-offences v2.0.0-alpha.1 (https://github.com/hicommonwealth/substrate.git#1164dec0)
   Compiling pallet-staking v2.0.0-alpha.1 (https://github.com/hicommonwealth/substrate.git#1164dec0)
   Compiling pallet-authority-discovery v2.0.0-alpha.1 (https://github.com/hicommonwealth/substrate.git#1164dec0)
   Compiling pallet-grandpa v2.0.0-alpha.1 (https://github.com/hicommonwealth/substrate.git#1164dec0)
   Compiling pallet-im-online v2.0.0-alpha.1 (https://github.com/hicommonwealth/substrate.git#1164dec0)
   Compiling pallet-aura v2.0.0-alpha.1 (https://github.com/hicommonwealth/substrate.git#1164dec0)
   Compiling edge-signaling v1.0.0 (/tmp/edgeware-node/modules/edge-signaling)
error: failed to run custom build command for `edgeware-runtime v3.0.0 (/tmp/edgeware-node/node/runtime/edgeware)`

Caused by:
  process didn't exit successfully: `/tmp/edgeware-node/target/release/build/edgeware-runtime-a761cdbb00fdb308/build-script-build` (exit code: 1)
--- stdout
Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/tmp/edgeware-node/target/release/wbuild/edgeware-runtime/Cargo.toml" "--color=always" "--release"

--- stderr
   Compiling wasm-build-runner-impl v1.0.0 (/tmp/edgeware-node/target/release/wbuild-runner/edgeware-runtime9418046255968030554)
    Finished release [optimized] target(s) in 0.30s
     Running `/tmp/edgeware-node/target/release/wbuild-runner/edgeware-runtime9418046255968030554/target/release/wasm-build-runner-impl`
   Compiling sp-arithmetic v2.0.0-alpha.1 (https://github.com/hicommonwealth/substrate.git#1164dec0)
   Compiling parity-util-mem v0.5.1
   Compiling sp-runtime-interface v2.0.0-alpha.1 (https://github.com/hicommonwealth/substrate.git#1164dec0)
   Compiling memory-db v0.19.0
   Compiling sp-core v2.0.0-alpha.1 (https://github.com/hicommonwealth/substrate.git#1164dec0)
thread 'rustc' panicked at 'if we got here, it must be const', src/librustc_mir/transform/const_prop.rs:1006:34
stack backtrace:
   0:     0x7f93d4b76f05 - backtrace::backtrace::libunwind::trace::h34afbfad7fd770fc
                               at /cargo/registry/src/github.life-white.uk-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1:     0x7f93d4b76f05 - backtrace::backtrace::trace_unsynchronized::h460d522b1619a600
                               at /cargo/registry/src/github.life-white.uk-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2:     0x7f93d4b76f05 - std::sys_common::backtrace::_print_fmt::ha45fac10086813b4
                               at src/libstd/sys_common/backtrace.rs:78
   3:     0x7f93d4b76f05 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hde84f63fcfd0e6de
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x7f93d4bb449c - core::fmt::write::h540ac4a6a1232abc
                               at src/libcore/fmt/mod.rs:1076
   5:     0x7f93d4b68d72 - std::io::Write::write_fmt::hc344eafd6e850b4d
                               at src/libstd/io/mod.rs:1537
   6:     0x7f93d4b7be30 - std::sys_common::backtrace::_print::h4db88ff15cb5d61d
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x7f93d4b7be30 - std::sys_common::backtrace::print::h5fc39e1b1f610bd3
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x7f93d4b7be30 - std::panicking::default_hook::{{closure}}::h59e55edacb1d974a
                               at src/libstd/panicking.rs:198
   9:     0x7f93d4b7bb7c - std::panicking::default_hook::heee4c8016dfbf328
                               at src/libstd/panicking.rs:217
  10:     0x7f93d52e7a73 - rustc_driver::report_ice::h26eb523a40d729cf
  11:     0x7f93d4b7c5a8 - std::panicking::rust_panic_with_hook::h8405b6301c79fb5a
                               at src/libstd/panicking.rs:524
  12:     0x7f93d4b7c17b - rust_begin_unwind
                               at src/libstd/panicking.rs:431
  13:     0x7f93d4bb1041 - core::panicking::panic_fmt::h78830ea6a34e7206
                               at src/libcore/panicking.rs:85
  14:     0x7f93d4bb0c23 - core::option::expect_failed::hfc0519cb1ecb957f
                               at src/libcore/option.rs:1261
  15:     0x7f93d657a7ee - <rustc_mir::transform::const_prop::ConstPropagator as rustc_middle::mir::visit::MutVisitor>::visit_terminator::{{closure}}::h111e121982960fa4
  16:     0x7f93d6579dcd - <rustc_mir::transform::const_prop::ConstPropagator as rustc_middle::mir::visit::MutVisitor>::visit_terminator::h3357f94eaab13cc4
  17:     0x7f93d657746c - <rustc_mir::transform::const_prop::ConstPropagator as rustc_middle::mir::visit::MutVisitor>::visit_body::hf7f7ac5a3856927b
  18:     0x7f93d65749dc - <rustc_mir::transform::const_prop::ConstProp as rustc_mir::transform::MirPass>::run_pass::h3dc0edf24240e993
  19:     0x7f93d6923625 - rustc_mir::transform::run_passes::h86bb760e2ae9dc8f
  20:     0x7f93d6924d96 - rustc_mir::transform::run_optimization_passes::h82a31591d0f7e567
  21:     0x7f93d6924f4d - rustc_mir::transform::optimized_mir::hf2070c6a00313d2b
  22:     0x7f93d7b71aae - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::optimized_mir>::compute::h9b5a29e65b62804d
  23:     0x7f93d77e4b84 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hc628a693ce6fd227
  24:     0x7f93d7ae2153 - rustc_data_structures::stack::ensure_sufficient_stack::h8d358b20b9b8b7c0
  25:     0x7f93d792e54c - rustc_query_system::query::plumbing::get_query_impl::he219f2f8385e5bc2
  26:     0x7f93d7b5bda3 - rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::instance_mir::h5d6ca53ad36d9831
  27:     0x7f93d6758379 - rustc_mir::monomorphize::collector::collect_neighbours::hef0928587257e8a2
  28:     0x7f93d6817804 - rustc_data_structures::stack::ensure_sufficient_stack::hebec6a500266b19c
  29:     0x7f93d6753df4 - rustc_mir::monomorphize::collector::collect_items_rec::hfa900ed1c1c12a2d
  30:     0x7f93d6752c3e - rustc_mir::monomorphize::collector::collect_crate_mono_items::h461848a8e386daf1
  31:     0x7f93d69865a1 - rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items::h2b71f6797f2f9732
  32:     0x7f93d57cad92 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute::h201f681edc13e1b1
  33:     0x7f93d56da409 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hd079eb63ad0ea3ee
  34:     0x7f93d5741c18 - rustc_query_system::query::plumbing::get_query_impl::ha3b828017799e2e0
  35:     0x7f93d57cf87b - rustc_codegen_ssa::base::codegen_crate::h920a1518ebf32c58
  36:     0x7f93d579fcc5 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h1e2c511f32569447
  37:     0x7f93d5533d60 - rustc_session::utils::<impl rustc_session::session::Session>::time::hbff729d051d4d719
  38:     0x7f93d5489858 - rustc_interface::passes::start_codegen::h8c14c96f95a13c30
  39:     0x7f93d54a9e26 - rustc_middle::ty::context::tls::enter_global::h68d5e0bb51955eaf
  40:     0x7f93d54a5cee - rustc_interface::queries::Queries::ongoing_codegen::hf796af03b04bceed
  41:     0x7f93d52a2443 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hb3ecfe94ca03e6c6
  42:     0x7f93d5342343 - rustc_span::with_source_map::h21eed361cfe861de
  43:     0x7f93d52a3b16 - rustc_interface::interface::run_compiler_in_existing_thread_pool::h902d0e3e1f552acf
  44:     0x7f93d52cd1bd - scoped_tls::ScopedKey<T>::set::hbc88e7d76dd9a901
  45:     0x7f93d52f381a - std::sys_common::backtrace::__rust_begin_short_backtrace::h0f0c30d1296961bc
  46:     0x7f93d52b05be - core::ops::function::FnOnce::call_once{{vtable.shim}}::h36b2cf3218c61088
  47:     0x7f93d4b8bdaa - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h13d34828db364579
                               at /rustc/3503f565e1fb7296983757d2716346f48a4a262b/src/liballoc/boxed.rs:1081
  48:     0x7f93d4b8bdaa - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hd51b619e0f884abf
                               at /rustc/3503f565e1fb7296983757d2716346f48a4a262b/src/liballoc/boxed.rs:1081
  49:     0x7f93d4b8bdaa - std::sys::unix::thread::Thread::new::thread_start::h02c6e34c2c73f344
                               at src/libstd/sys/unix/thread.rs:87
  50:     0x7f93d4abc432 - start_thread
  51:     0x7f93d49d69d3 - __clone
  52:                0x0 - <unknown>

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.46.0-nightly (3503f565e 2020-07-02) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C panic=abort -C linker-plugin-lto -C link-arg=--export-table -C link-arg=--export=__heap_base -C link-arg=--import-memory --crate-type rlib

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

query stack during panic:
#0 [optimized_mir] optimizing MIR for `<fixed64::Fixed64 as core::ops::Div>::div`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `sp-arithmetic`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

warning: build failed, waiting for other jobs to finish...
error: build failed

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions