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

save-analysis causes ICE #68621

Closed
jonhoo opened this issue Jan 28, 2020 · 2 comments · Fixed by #68744
Closed

save-analysis causes ICE #68621

jonhoo opened this issue Jan 28, 2020 · 2 comments · Fixed by #68744
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. 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

@jonhoo
Copy link
Contributor

jonhoo commented Jan 28, 2020

When running cargo-udeps on noria in the noria/ subdirectory, a call to rustc with -Z save-analysis causes the following ICE:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/librustc_typeck/check/mod.rs:840:14
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   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:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   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:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
             at /rustc/698fcd38fa9548e64a2092ff48c9d15ceb57d40c/src/liballoc/boxed.rs:1029
  12: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}
             at /rustc/698fcd38fa9548e64a2092ff48c9d15ceb57d40c/src/libproc_macro/bridge/client.rs:305
  13: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:476
  14: rust_begin_unwind
             at src/libstd/panicking.rs:380
  15: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  16: core::panicking::panic
             at src/libcore/panicking.rs:52
  17: rustc_typeck::check::has_typeck_tables
  18: rustc::ty::query::__query_compute::has_typeck_tables
  19: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::has_typeck_tables>::compute
  20: rustc::dep_graph::graph::DepGraph::with_task_impl
  21: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  22: <rustc_save_analysis::dump_visitor::DumpVisitor as syntax::visit::Visitor>::visit_ty
  23: <rustc_save_analysis::dump_visitor::DumpVisitor as syntax::visit::Visitor>::visit_item
  24: <rustc_save_analysis::dump_visitor::DumpVisitor as syntax::visit::Visitor>::visit_item
  25: <rustc_save_analysis::dump_visitor::DumpVisitor as syntax::visit::Visitor>::visit_mod
  26: rustc::dep_graph::graph::DepGraph::with_ignore
  27: rustc::ty::context::tls::enter_global
  28: rustc_interface::interface::run_compiler_in_existing_thread_pool
  29: scoped_tls::ScopedKey<T>::set
  30: syntax::with_globals
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.42.0-nightly (698fcd38f 2020-01-26) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis -C debuginfo=2 -C incremental -C target-cpu=native --crate-type lib

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

query stack during panic:
#0 [has_typeck_tables] processing `<controller::Controller<A> as tower_service::Service<controller::ControllerRequest>>::Future::{{opaque}}#0`
end of query stack
error: could not compile `noria`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name noria noria/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata -C debuginfo=2 -C metadata=0715f59924125db7 -C extra-filename=-0715f59924125db7 --out-dir /home/jon/.cargo-target/debug/deps -C incremental=/home/jon/.cargo-target/debug/incremental -L dependency=/home/jon/.cargo-target/debug/deps --extern arccstr=/home/jon/.cargo-target/debug/deps/libarccstr-3299b99c3963ea5d.rmeta --extern assert_infrequent=/home/jon/.cargo-target/debug/deps/libassert_infrequent-f9c4e668a370aafe.rmeta --extern async_bincode=/home/jon/.cargo-target/debug/deps/libasync_bincode-4faa92d746814f53.rmeta --extern bincode=/home/jon/.cargo-target/debug/deps/libbincode-47b650c80911238a.rmeta --extern bufstream=/home/jon/.cargo-target/debug/deps/libbufstream-e0c6c4aa7ef08edc.rmeta --extern byteorder=/home/jon/.cargo-target/debug/deps/libbyteorder-ab79fc25ad9848f0.rmeta --extern chrono=/home/jon/.cargo-target/debug/deps/libchrono-891148d6cdd9335c.rmeta --extern failure=/home/jon/.cargo-target/debug/deps/libfailure-9ff4c9d45b2bf666.rmeta --extern fnv=/home/jon/.cargo-target/debug/deps/libfnv-0cb134456c2698a3.rmeta --extern futures_util=/home/jon/.cargo-target/debug/deps/libfutures_util-8ab4380e642f05cd.rmeta --extern hyper=/home/jon/.cargo-target/debug/deps/libhyper-565ad34723db5faf.rmeta --extern net2=/home/jon/.cargo-target/debug/deps/libnet2-0316f6e42f83f45e.rmeta --extern nom_sql=/home/jon/.cargo-target/debug/deps/libnom_sql-5df647292a5cb9b4.rmeta --extern petgraph=/home/jon/.cargo-target/debug/deps/libpetgraph-a8fd5219bda290c4.rmeta --extern pin_project=/home/jon/.cargo-target/debug/deps/libpin_project-043910174a645244.rmeta --extern serde=/home/jon/.cargo-target/debug/deps/libserde-93719e869579b218.rmeta --extern serde_derive=/home/jon/.cargo-target/debug/deps/libserde_derive-f3903af2230c892b.so --extern serde_json=/home/jon/.cargo-target/debug/deps/libserde_json-034ac1fb1bcd2a16.rmeta --extern slab=/home/jon/.cargo-target/debug/deps/libslab-13e99d19418a3886.rmeta --extern slog=/home/jon/.cargo-target/debug/deps/libslog-2ae66f5c5e69ef5f.rmeta --extern slog_term=/home/jon/.cargo-target/debug/deps/libslog_term-4e25763582e9062e.rmeta --extern tokio=/home/jon/.cargo-target/debug/deps/libtokio-539efbaf98693041.rmeta --extern tokio_tower=/home/jon/.cargo-target/debug/deps/libtokio_tower-111b44b21527362d.rmeta --extern tower=/home/jon/.cargo-target/debug/deps/libtower-b8ea60d3ed6b6523.rmeta --extern tower_balance=/home/jon/.cargo-target/debug/deps/libtower_balance-028ac6bbc18ac3e0.rmeta --extern tower_buffer=/home/jon/.cargo-target/debug/deps/libtower_buffer-512073f502368f5a.rmeta --extern tower_discover=/home/jon/.cargo-target/debug/deps/libtower_discover-0b2fd0d49c16c4a0.rmeta --extern tower_service=/home/jon/.cargo-target/debug/deps/libtower_service-1e31e61c59e4c14c.rmeta --extern tower_util=/home/jon/.cargo-target/debug/deps/libtower_util-d7bae5364a8b2ad9.rmeta --extern tracing=/home/jon/.cargo-target/debug/deps/libtracing-719e9d0019dd5f23.rmeta --extern vec_map=/home/jon/.cargo-target/debug/deps/libvec_map-de61a4a46db7f9e0.rmeta --extern zookeeper=/home/jon/.cargo-target/debug/deps/libzookeeper-8aec0169da355c97.rmeta -C target-cpu=native -L native=/home/jon/.cargo-target/debug/build/backtrace-sys-20eee53aeca624cf/out -Z save-analysis` (exit code: 101)

I'm not exactly sure what additional information to provide? I filed an issue with cargo-udeps, and was forwarded here since it is an ICE.

@jonas-schievink jonas-schievink added A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 28, 2020
@est31
Copy link
Member

est31 commented Jan 29, 2020

I've minimized it a bit: bug_68621.zip

It still uses external crates but the example itself is very small.

@hellow554
Copy link
Contributor

hellow554 commented Jan 29, 2020

#[feature(type_alias_impl_trait)]

trait Trait {}

trait Service {
    type Future: Trait;
}

struct Struct;

impl Service for Struct {
    type Future = impl Trait;
}

fn main() {}

compile it with: rustc -Z save-analysis main.rs

Although impl Trait is behind a feature gate it will ICE without the feature gate!

@rustbot modify labels: F-type_alias_impl_trait


ICE code:

fn has_typeck_tables(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
// Closures' tables come from their outermost function,
// as they are part of the same "inference environment".
let outer_def_id = tcx.closure_base_def_id(def_id);
if outer_def_id != def_id {
return tcx.has_typeck_tables(outer_def_id);
}
let id = tcx.hir().as_local_hir_id(def_id).unwrap();
primary_body_of(tcx, id).is_some()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. 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.
Development

Successfully merging a pull request may close this issue.

6 participants