Skip to content

ICE on nightly: thread 'rustc' panicked at 'called Option::unwrap() on a None value', compiler/rustc_middle/src/ty/query/mod.rs:235:5 #79782

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

Closed
PaulGrandperrin opened this issue Dec 7, 2020 · 1 comment
Labels
A-incr-comp Area: Incremental compilation A-metadata Area: Crate metadata C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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.

Comments

@PaulGrandperrin
Copy link

Just like #79779 which I reported a few hours ago, it is a spurious bug, running cargo clean and then cargo run clears the ICE.
However, it doesn't really look like this bug is related to the one I just reported before.
It also comes from a different crate I'm working on.

Code

This is some WIP/playground code, please don't judge :-)

use tracing::{info, Level};
use tracing_subscriber::FmtSubscriber;

use rustyline::error::ReadlineError;
use rustyline::Editor;

fn setup_logger() {
    let subscriber = FmtSubscriber::builder()
    .with_max_level(Level::TRACE)
    .finish();

    tracing::subscriber::set_global_default(subscriber)
        .expect("setting default subscriber failed");
}

fn main() {
    setup_logger();

    let mut session = client_core::Session::new();
    let f = session.signup_test("hey");
    //futures::executor::block_on(f);

    let rt = tokio::runtime::Runtime::new().unwrap();
    rt.block_on(f);
    
    
    // `()` can be used when no completer is required
    let mut rl = Editor::<()>::new();
    if rl.load_history("history.txt").is_err() {
        println!("No previous history.");
    }
    loop {
        let readline = rl.readline(">> ");
        match readline {
            Ok(line) => {
                rl.add_history_entry(line.as_str());
                match line.split_ascii_whitespace().collect::<Vec<_>>().as_slice() {
                    ["signup", password] => {
                        session.signup(password);
                    }
                    _ => {
                        tracing::error!("unknown command");
                    }
                }
            },
            Err(ReadlineError::Interrupted) => {
                println!("CTRL-C");
                break
            },
            Err(ReadlineError::Eof) => {
                println!("CTRL-D");
                break
            },
            Err(err) => {
                println!("Error: {:?}", err);
                break
            }
        }
    }
    rl.save_history("history.txt").unwrap();
}

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (0f6f2d681 2020-12-06)
binary: rustc
commit-hash: 0f6f2d681b39c5f95459cd09cb936b6ceb27cd82
commit-date: 2020-12-06
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly

Error output

   Compiling client-cli v0.1.0 (/home/paulg/Repositories/cachou-playground/client-cli)
     Running `rustc --crate-name client_cli --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=a2808c23c7b12571 -C extra-filename=-a2808c23c7b12571 --out-dir /home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps -C incremental=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/incremental -L dependency=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps --extern client_core=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/libclient_core-6a28514683622551.rlib --extern futures=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/libfutures-43b72e0c8a3ce88c.rlib --extern rustyline=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/librustyline-43ac40a9101c84c2.rlib --extern tokio=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/libtokio-245ea55611ce700e.rlib --extern tracing=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/libtracing-231e273397d7a4f0.rlib --extern tracing_subscriber=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/libtracing_subscriber-abf5619db598f6a0.rlib -L 'native=/home/linuxbrew/.linuxbrew/Cellar/[email protected]/1.1.1h/lib'`
warning: unused import: `info`
 --> src/main.rs:1:15
  |
1 | use tracing::{info, Level};
  |               ^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_middle/src/ty/query/mod.rs:235:5
stack backtrace:
   0:     0x7f5abbf3f6a7 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f5abbf3f6a7 - std::backtrace_rs::backtrace::trace_unsynchronized::h86340908ff889faa
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f5abbf3f6a7 - std::sys_common::backtrace::_print_fmt::h43f85f9b18230404
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f5abbf3f6a7 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc132ae1a5b5aa7cd
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f5abbfb351c - core::fmt::write::hdf023a0036d2a25f
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/core/src/fmt/mod.rs:1078:17
   5:     0x7f5abbf31692 - std::io::Write::write_fmt::h8580846154bcb66a
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/io/mod.rs:1519:15
   6:     0x7f5abbf433a5 - std::sys_common::backtrace::_print::h7ee55fed88d107a3
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f5abbf433a5 - std::sys_common::backtrace::print::h54a7d3e52a524177
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f5abbf433a5 - std::panicking::default_hook::{{closure}}::h60921e857bf55a40
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/panicking.rs:208:50
   9:     0x7f5abbf42efa - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/panicking.rs:225:9
  10:     0x7f5abc83a868 - rustc_driver::report_ice::hff78d76a39ffbb86
  11:     0x7f5abbf43ca6 - std::panicking::rust_panic_with_hook::h8d66bf42b407aaea
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/panicking.rs:595:17
  12:     0x7f5abbf43797 - std::panicking::begin_panic_handler::{{closure}}::hde71edcd925d0c5e
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/panicking.rs:495:13
  13:     0x7f5abbf3fb6c - std::sys_common::backtrace::__rust_end_short_backtrace::h8a3c7d6cea578919
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f5abbf43729 - rust_begin_unwind
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/panicking.rs:493:5
  15:     0x7f5abbfaf931 - core::panicking::panic_fmt::h20225113c4a2f8fd
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/core/src/panicking.rs:92:14
  16:     0x7f5abbfaf87d - core::panicking::panic::h35b77276aa4b0c12
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/core/src/panicking.rs:50:5
  17:     0x7f5abf219b05 - rustc_middle::ty::query::try_load_from_on_disk_cache::hfa4775df5c5e0180
  18:     0x7f5abe4f469a - rustc_query_system::dep_graph::graph::DepGraph<K>::exec_cache_promotions::h8caa69177622351e
  19:     0x7f5abe50cef1 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::hab5675af7737b3e6
  20:     0x7f5abe4b068b - rustc_incremental::persist::save::save_in::h7f4f43356280dc0a
  21:     0x7f5abe4ab4a1 - rustc_data_structures::sync::join::h0120008f852881ce
  22:     0x7f5abe50bf92 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h2893ce60eec57bb6
  23:     0x7f5abe4afbbf - rustc_incremental::persist::save::save_dep_graph::hffd3fb2ecc639a78
  24:     0x7f5abe38b07a - rustc_codegen_ssa::base::finalize_tcx::h68106e2729498b3e
  25:     0x7f5abcca9257 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h067fffb3870bc5b0
  26:     0x7f5abca5892e - rustc_session::utils::<impl rustc_session::session::Session>::time::had158f21ec5bf4d1
  27:     0x7f5abca9b62c - rustc_interface::passes::QueryContext::enter::h40067ad7feabcbd0
  28:     0x7f5abcaf3a93 - rustc_interface::queries::Queries::ongoing_codegen::h4fc36fc05972247d
  29:     0x7f5abc7e34e2 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hd899306a06575d0c
  30:     0x7f5abc8765f7 - rustc_span::with_source_map::ha4e07ff263d0dc1d
  31:     0x7f5abc7e468b - rustc_interface::interface::create_compiler_and_run::h1d6d732867d1f489
  32:     0x7f5abc890b60 - scoped_tls::ScopedKey<T>::set::h39c0aa543118d3f3
  33:     0x7f5abc897346 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1e5aa72fb9cd6d86
  34:     0x7f5abc7ec07a - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc793837e985b77ce
  35:     0x7f5abbf5365a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/alloc/src/boxed.rs:1328:9
  36:     0x7f5abbf5365a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/alloc/src/boxed.rs:1328:9
  37:     0x7f5abbf5365a - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/0f6f2d681b39c5f95459cd09cb936b6ceb27cd82/library/std/src/sys/unix/thread.rs:71:17
  38:     0x7f5abbe8bead - start_thread
  39:     0x7f5abbdabd2f - __clone
  40:                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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.50.0-nightly (0f6f2d681 2020-12-06) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
end of query stack
warning: 1 warning emitted

error: could not compile `client-cli`

Caused by:
  process didn't exit successfully: `rustc --crate-name client_cli --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=a2808c23c7b12571 -C extra-filename=-a2808c23c7b12571 --out-dir /home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps -C incremental=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/incremental -L dependency=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps --extern client_core=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/libclient_core-6a28514683622551.rlib --extern futures=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/libfutures-43b72e0c8a3ce88c.rlib --extern rustyline=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/librustyline-43ac40a9101c84c2.rlib --extern tokio=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/libtokio-245ea55611ce700e.rlib --extern tracing=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/libtracing-231e273397d7a4f0.rlib --extern tracing_subscriber=/home/paulg/Repositories/cachou-playground/client-cli/target/debug/deps/libtracing_subscriber-abf5619db598f6a0.rlib -L 'native=/home/linuxbrew/.linuxbrew/Cellar/[email protected]/1.1.1h/lib'` (exit code: 101)
@PaulGrandperrin PaulGrandperrin added C-bug Category: This is a bug. 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. labels Dec 7, 2020
@LeSeulArtichaut LeSeulArtichaut added A-incr-comp Area: Incremental compilation A-metadata Area: Crate metadata E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Dec 7, 2020
@jonas-schievink
Copy link
Contributor

duplicate of #79661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation A-metadata Area: Crate metadata C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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.
Projects
None yet
Development

No branches or pull requests

3 participants