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

assertion failed: locate_ctxt.hash.is_none() when running "cargo test" #51259

Closed
ms705 opened this issue May 31, 2018 · 1 comment
Closed

assertion failed: locate_ctxt.hash.is_none() when running "cargo test" #51259

ms705 opened this issue May 31, 2018 · 1 comment
Labels
A-libtest Area: `#[test]` / the `test` library

Comments

@ms705
Copy link

ms705 commented May 31, 2018

With the latest nightly, running cargo test on the HEAD commit of distributary-mysql fails with a compiler crash, apparently while trying to resolve a crate. cargo build works without issue. N.B.: Cargo.toml uses rename-dependency.

Command to reproduce:

$ git clone https://github.com/mit-pdos/distributary-mysql
$ cd distributary-mysql
$ cargo test

I expected to see this happen: The code should compile, possibly with some errors.

Instead, this happened: The compiler crashes with error

thread 'main' panicked at 'assertion failed: locate_ctxt.hash.is_none()', librustc_metadata/creader.rs:347:21

Meta

rustc --version --verbose:

rustc 1.28.0-nightly (5d0631a64 2018-05-30)
binary: rustc
commit-hash: 5d0631a6438cf30cac236b7176371663e35c8d07
commit-date: 2018-05-30
host: x86_64-unknown-linux-gnu
release: 1.28.0-nightly
LLVM version: 6.0

Backtrace:

thread 'main' panicked at 'assertion failed: locate_ctxt.hash.is_none()', librustc_metadata/creader.rs:347:21
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:467
   6: std::panicking::begin_panic
   7: rustc_metadata::cstore::CStore::iter_crate_data
   8: rustc_metadata::creader::CrateLoader::load
   9: rustc_metadata::creader::CrateLoader::resolve_crate
  10: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  11: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  12: rustc_metadata::creader::CrateLoader::resolve_crate
  13: <rustc_metadata::creader::CrateLoader<'a> as rustc::middle::cstore::CrateLoader>::process_extern_crate
  14: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver<'a>>::build_reduced_graph_for_item
  15: <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor<'a, 'b> as syntax::visit::Visitor<'a>>::visit_item
  16: syntax::visit::walk_item
  17: <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor<'a, 'b> as syntax::visit::Visitor<'a>>::visit_item
  18: syntax::ext::expand::Expansion::visit_with
  19: rustc_resolve::macros::<impl syntax::ext::base::Resolver for rustc_resolve::Resolver<'a>>::visit_expansion
  20: syntax::ext::expand::MacroExpander::collect_invocations
  21: syntax::ext::expand::MacroExpander::expand
  22: syntax::ext::expand::MacroExpander::expand_crate
  23: rustc_driver::driver::phase_2_configure_and_expand_inner::{{closure}}
  24: rustc::util::common::time
  25: rustc_driver::driver::phase_2_configure_and_expand
  26: rustc_driver::driver::compile_input
  27: rustc_driver::run_compiler_with_pool
  28: syntax::with_globals
  29: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  30: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  31: rustc_driver::run
  32: rustc_driver::main
  33: std::rt::lang_start::{{closure}}
  34: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  35: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  36: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:374
             at libstd/rt.rs:58
  37: main
  38: __libc_start_main
  39: <unknown>
query stack during panic:
end of query stack

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

Possibly useful observations

  • This only happens with 335c2ae present in the tree; prior commits do not crash the compiler (but fail to compile with appropriate error messages).
  • 335c2ae introduced a renamed crate dependency (api in distributary is used as distributary via package = "api").
  • This happens with the latest nightly as well as older ones (e.g., 2018-05-26).
  • This only happens on cargo test; normal builds work fine.
@Mark-Simulacrum
Copy link
Member

Closing in favor of the more minimal #51796; thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-libtest Area: `#[test]` / the `test` library
Projects
None yet
Development

No branches or pull requests

3 participants