Skip to content

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

New issue

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

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

Already on GitHub? # to your account

Closed
drahnr opened this issue Jul 3, 2020 · 22 comments · Fixed by #74102 or #74221
Closed

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

drahnr opened this issue Jul 3, 2020 · 22 comments · Fixed by #74102 or #74221
Assignees
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@drahnr
Copy link
Contributor

drahnr commented Jul 3, 2020

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.heygears.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1:     0x7f93d4b76f05 - backtrace::backtrace::trace_unsynchronized::h460d522b1619a600
                               at /cargo/registry/src/github.heygears.com-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

@drahnr drahnr added the C-bug Category: This is a bug. label Jul 3, 2020
@drahnr drahnr changed the title 1.46.0-nightly panics 1.46.0-nightly panics on certain lang constructs Jul 3, 2020
@drahnr drahnr changed the title 1.46.0-nightly panics on certain lang constructs 1.46.0-nightly panics on a particular multi crate setup Jul 3, 2020
@drahnr drahnr changed the title 1.46.0-nightly panics on a particular multi crate setup 1.46.0-nightly panics on a particular macro_rules! invocation Jul 3, 2020
@drahnr drahnr changed the title 1.46.0-nightly panics on a particular macro_rules! invocation 1.46.0-nightly panics on a particular construct_runtime invocation Jul 3, 2020
@drahnr drahnr changed the title 1.46.0-nightly panics on a particular construct_runtime invocation 1.46.0-nightly panics on a particular proc macro invocation Jul 3, 2020
@jonas-schievink jonas-schievink added A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-mir-opt Area: MIR optimizations I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jul 3, 2020
@jonas-schievink
Copy link
Contributor

cc @wesleywiser @oli-obk

@apopiak
Copy link

apopiak commented Jul 3, 2020

$ RUST_BACKTRACE=1 cargo build --release -p edgeware-runtime
   Compiling edgeware-runtime v3.0.0 (edgeware-node/node/runtime)
   Compiling pallet-authorship v2.0.0-rc3 (https://github.com/hicommonwealth/substrate.git?branch=apopiak-migrations-extraction#6df42b9a)
   Compiling pallet-finality-tracker v2.0.0-rc3 (https://github.com/hicommonwealth/substrate.git?branch=apopiak-migrations-extraction#6df42b9a)
   Compiling pallet-utility v2.0.0-rc3 (https://github.com/hicommonwealth/substrate.git?branch=apopiak-migrations-extraction#6df42b9a)
   Compiling pallet-randomness-collective-flip v2.0.0-rc3 (https://github.com/hicommonwealth/substrate.git?branch=apopiak-migrations-extraction#6df42b9a)
   Compiling pallet-collective v2.0.0-rc3 (https://github.com/hicommonwealth/substrate.git?branch=apopiak-migrations-extraction#6df42b9a)
   Compiling pallet-multisig v2.0.0-rc3 (https://github.com/hicommonwealth/substrate.git?branch=apopiak-migrations-extraction#6df42b9a)
   Compiling pallet-indices v2.0.0-rc3 (https://github.com/hicommonwealth/substrate.git?branch=apopiak-migrations-extraction#6df42b9a)
   Compiling pallet-sudo v2.0.0-rc3 (https://github.com/hicommonwealth/substrate.git?branch=apopiak-migrations-extraction#6df42b9a)
error: failed to run custom build command for `edgeware-runtime v3.0.0 (edgeware-node/node/runtime)`

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

--- stderr
   Compiling wasm-build-runner-impl v1.0.0 (edgeware-node/target/release/wbuild-runner/edgeware-runtime16727120478097692426)
    Finished release [optimized] target(s) in 1.43s
     Running `edgeware-node/target/release/wbuild-runner/edgeware-runtime16727120478097692426/target/x86_64-unknown-linux-gnu/release/wasm-build-runner-impl`
   Compiling sp-arithmetic v2.0.0 (https://github.com/hicommonwealth/substrate.git?rev=00a400f82539e2f78e8ddbcd98aea512c87c5f3c#00a400f8)
   Compiling primitive-types v0.7.2
   Compiling primitive-types v0.6.2
   Compiling sp-npos-elections v2.0.0-rc3 (https://github.com/hicommonwealth/substrate.git?branch=apopiak-migrations-extraction#6df42b9a)
   Compiling finality-grandpa v0.12.3
thread 'rustc' panicked at 'if we got here, it must be const', src/librustc_mir/transform/const_prop.rs:1006:34
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:217
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:524
  12: rust_begin_unwind
             at src/libstd/panicking.rs:431
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  14: core::option::expect_failed
             at src/libcore/option.rs:1261
  15: <rustc_mir::transform::const_prop::ConstPropagator as rustc_middle::mir::visit::MutVisitor>::visit_terminator::{{closure}}
  16: <rustc_mir::transform::const_prop::ConstPropagator as rustc_middle::mir::visit::MutVisitor>::visit_terminator
  17: <rustc_mir::transform::const_prop::ConstPropagator as rustc_middle::mir::visit::MutVisitor>::visit_body
  18: <rustc_mir::transform::const_prop::ConstProp as rustc_mir::transform::MirPass>::run_pass
  19: rustc_mir::transform::run_passes
  20: rustc_mir::transform::run_optimization_passes
  21: rustc_mir::transform::optimized_mir
  22: 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
  23: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  24: rustc_data_structures::stack::ensure_sufficient_stack
  25: rustc_query_system::query::plumbing::get_query_impl
  26: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::instance_mir
  27: rustc_mir::monomorphize::collector::collect_neighbours
  28: rustc_data_structures::stack::ensure_sufficient_stack
  29: rustc_mir::monomorphize::collector::collect_items_rec
  30: rustc_mir::monomorphize::collector::collect_crate_mono_items
  31: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  32: 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
  33: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  34: rustc_query_system::query::plumbing::get_query_impl
  35: rustc_codegen_ssa::base::codegen_crate
  36: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  37: rustc_session::utils::<impl rustc_session::session::Session>::time
  38: rustc_interface::passes::start_codegen
  39: rustc_middle::ty::context::tls::enter_global
  40: rustc_interface::queries::Queries::ongoing_codegen
  41: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  42: rustc_span::with_source_map
  43: rustc_interface::interface::run_compiler_in_existing_thread_pool
  44: scoped_tls::ScopedKey<T>::set
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/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

@wesleywiser wesleywiser self-assigned this Jul 3, 2020
@apopiak
Copy link

apopiak commented Jul 3, 2020

Also occured with nightly-2020-06-30

@wesleywiser
Copy link
Member

I'm getting this when I try to repro:

wesley@endurance:~/code/rust/edgeware-node> cargo +nightly build --release -p edgeware-runtime
    Updating git repository `https://github.com/hicommonwealth/substrate.git`
error: failed to get `frame-support` as a dependency of package `edge-signaling v1.0.0 (/home/wesley/code/rust/edgeware-node/modules/edge-signaling)`

Caused by:
  failed to load source for dependency `frame-support`

Caused by:
  Unable to update https://github.com/hicommonwealth/substrate.git#1164dec0

Caused by:
  object not found - no match for id (1164dec08a2829de54e09ae4d8554a952d05b9a8); class=Odb (9); code=NotFound (-3)

On a side note, are there any cargo feature flags I can pass to cut down on how much stuff is being compiled? Compiling 900 crates to get a repo is quite a lot 🙂

@apopiak
Copy link

apopiak commented Jul 3, 2020

Also occured with nightly-2020-06-28-x86_64-unknown-linux-gnu unchanged - rustc 1.46.0-nightly (394e1b40d 2020-06-27) just now.

@apopiak
Copy link

apopiak commented Jul 3, 2020

mmh try with commit hash 893981a2f2fdff8b3e6b0dddf4cf7ad4f9a09dfe ? (for edgeware-node)

@apopiak
Copy link

apopiak commented Jul 3, 2020

updated script:

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

@apopiak
Copy link

apopiak commented Jul 3, 2020

On a side note, are there any cargo feature flags I can pass to cut down on how much stuff is being compiled? Compiling 900 crates to get a repo is quite a lot slightly_smiling_face

Yeah, sorry for that. One of the difficulties of working with a big framework like Substrate. I'll see if I can narrow it down more.

@wesleywiser
Copy link
Member

That did it! Thank you 🙂

@apopiak
Copy link

apopiak commented Jul 3, 2020

Some with the same issue (a different chain also using Substrate) found out that 2020-06-01 apparently works.

@JohnTitor
Copy link
Member

Seems #73513 is the cause, marking as regression-from-stable-to-nightly.

@JohnTitor JohnTitor added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Jul 3, 2020
@wesleywiser
Copy link
Member

Here's a smaller repro (at least in terms of how much code is built: 33 crates instead of a few hundred):

git clone https://github.com/hicommonwealth/substrate.git
cd substrate
git checkout 00a400f82539e2f78e8ddbcd98aea512c87c5f3c
cd ..
mkdir smaller_repo
cd smaller_repo
mkdir primitives
cp ../substrate/Cargo.lock .
cp -r ../substrate/primitives/arithmetic/ ./primitives/ 
cp -r ../substrate/primitives/debug-derive/ ./primitives/ 
cp -r ../substrate/primitives/std/ ./primitives/ 
cd primitives/arithmetic
cargo +nightly build --release --target=wasm32-unknown-unknown

@apopiak
Copy link

apopiak commented Jul 3, 2020

just confirmed that it does not occur with nightly-2020-06-25-x86_64-unknown-linux-gnu

@wesleywiser
Copy link
Member

I have a minimal repro:

pub struct Fixed64(i64);

pub fn div(f: Fixed64) {
    f.0 / 0;
}

playground

@wesleywiser wesleywiser removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Jul 4, 2020
@wesleywiser wesleywiser removed their assignment Jul 4, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jul 6, 2020
Fix const prop ICE

we used to erase the local just before we tried to read it for diagnostics

fixes rust-lang#73993

r? @wesleywiser
@bors bors closed this as completed in 38f5151 Jul 7, 2020
@Dylan-DPC-zz Dylan-DPC-zz removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. A-mir-opt Area: MIR optimizations labels Jul 7, 2020
@apopiak
Copy link

apopiak commented Jul 10, 2020

@wesleywiser I seem to be getting a similar error again on a more current nightly (2020-07-10).
Should I open a new issue or do we just reopen this one?

   Compiling sp-arithmetic v2.0.0-rc3 (https://github.com/paritytech/substrate?rev=31c3e06ded197bdf28130ac0c5310283b2d1b5b3#31c3e06d)
   Compiling primitive-types v0.7.2
   Compiling primitive-types v0.6.2
thread 'rustc' panicked at 'if we got here, it must be const', src/librustc_mir/transform/const_prop.rs:1010:34
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.heygears.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:217
  10: rustc_driver::report_ice
  11: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
             at /rustc/5db778affee7c6600c8e7a177c48282dab3f6292/src/liballoc/boxed.rs:1095
  12: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}
             at /rustc/5db778affee7c6600c8e7a177c48282dab3f6292/src/libproc_macro/bridge/client.rs:318
  13: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:530
  14: rust_begin_unwind
             at src/libstd/panicking.rs:437
  15: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  16: core::option::expect_failed
             at src/libcore/option.rs:1261
  17: <rustc_mir::transform::const_prop::ConstPropagator as rustc_middle::mir::visit::MutVisitor>::visit_terminator::{{closure}}
  18: <rustc_mir::transform::const_prop::ConstPropagator as rustc_middle::mir::visit::MutVisitor>::visit_terminator
  19: <rustc_mir::transform::const_prop::ConstPropagator as rustc_middle::mir::visit::MutVisitor>::visit_body
  20: <rustc_mir::transform::const_prop::ConstProp as rustc_mir::transform::MirPass>::run_pass
  21: rustc_mir::transform::run_passes
  22: rustc_mir::transform::run_optimization_passes
  23: rustc_mir::transform::optimized_mir
  24: 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
  25: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  26: rustc_data_structures::stack::ensure_sufficient_stack
  27: rustc_query_system::query::plumbing::get_query_impl
  28: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::instance_mir
  29: rustc_mir::monomorphize::collector::collect_neighbours
  30: rustc_mir::monomorphize::collector::collect_items_rec
  31: rustc_session::utils::<impl rustc_session::session::Session>::time
  32: rustc_mir::monomorphize::collector::collect_crate_mono_items
  33: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  34: 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
  35: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  36: rustc_data_structures::stack::ensure_sufficient_stack
  37: rustc_query_system::query::plumbing::get_query_impl
  38: rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local
  39: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::exported_symbols>::compute
  40: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  41: rustc_data_structures::stack::ensure_sufficient_stack
  42: rustc_query_system::query::plumbing::get_query_impl
  43: rustc_metadata::rmeta::encoder::encode_metadata_impl
  44: rustc_data_structures::sync::join
  45: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_middle::middle::cstore::CrateStore for rustc_metadata::creader::CStore>::encode_metadata
  46: rustc_middle::ty::context::TyCtxt::encode_metadata
  47: rustc_interface::passes::start_codegen
  48: rustc_middle::ty::context::tls::enter_global
  49: rustc_interface::queries::Queries::ongoing_codegen
  50: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  51: rustc_span::with_source_map
  52: rustc_interface::interface::run_compiler_in_existing_thread_pool
  53: scoped_tls::ScopedKey<T>::set
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.46.0-nightly (5db778aff 2020-07-09) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 --crate-type lib

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

query stack during panic:
#0 [optimized_mir] optimizing MIR for `<fixed64::Fixed64 as std::ops::Div>::div`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
#2 [exported_symbols] exported_symbols
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

@wesleywiser
Copy link
Member

wesleywiser commented Jul 10, 2020

@oli-obk This is still broken. I'm pretty confused because running the test you added in #74102 on the playground shows that it ICEs. Is the test not actually working for some reason?

Edit: Does that test need // compile-flags: --crate-type lib in order to actually check the body of those functions since they are uncalled from main?

@wesleywiser wesleywiser reopened this Jul 10, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 13, 2020
Don't panic if the lhs of a div by zero is not statically known

Fixes rust-lang#73993 for real this time

r? @wesleywiser
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 13, 2020
Don't panic if the lhs of a div by zero is not statically known

Fixes rust-lang#73993 for real this time

r? @wesleywiser
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 13, 2020
Don't panic if the lhs of a div by zero is not statically known

Fixes rust-lang#73993 for real this time

r? @wesleywiser
@spastorino spastorino added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jul 15, 2020
@spastorino
Copy link
Member

Assigning P-high as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.

@spastorino spastorino added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jul 15, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 16, 2020
Don't panic if the lhs of a div by zero is not statically known

Fixes rust-lang#73993 for real this time

r? @wesleywiser
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 16, 2020
Don't panic if the lhs of a div by zero is not statically known

Fixes rust-lang#73993 for real this time

r? @wesleywiser
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 16, 2020
Don't panic if the lhs of a div by zero is not statically known

Fixes rust-lang#73993 for real this time

r? @wesleywiser
@bors bors closed this as completed in a80559f Jul 16, 2020
@wesleywiser
Copy link
Member

Hi @apopiak and @drahnr, have either of you had a chance to upgrade to a recently nightly? I just wanted to confirm this is fixed for you.

@GabrielMajeri
Copy link
Contributor

I've updated to rust version 1.47.0-nightly (bbebe73 2020-07-22), and tried compiling the crate which was triggering this ICE (sp-arithmetic). I no longer encounter an ICE, the crate compiles successfully.

@drahnr
Copy link
Contributor Author

drahnr commented Jul 23, 2020

I can confirm rustc 1.47.0-nightly (bbebe7351 2020-07-22) is not throwing ICE 👍

@wesleywiser
Copy link
Member

Great, thank you!

@pnkfelix pnkfelix added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jul 23, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet