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

panicked in libstd/macros.rs: inconsistent resolution for an import #71998

Closed
ctaggart opened this issue May 7, 2020 · 4 comments · Fixed by #72003
Closed

panicked in libstd/macros.rs: inconsistent resolution for an import #71998

ctaggart opened this issue May 7, 2020 · 4 comments · Fixed by #72003
Assignees
Labels
C-bug Category: This is a bug.

Comments

@ctaggart
Copy link
Contributor

ctaggart commented May 7, 2020

I tried this code:
I'll try to create a minimal test repository. I get this after adding rustfmt from master with the code similar to rust-lang/rustfmt#4132 (comment) .

I expected to see this happen: the code to build without panic.

Instead, this happened:

   Compiling rustc-ap-rustc_span v656.0.0
thread 'rustc' panicked at 'src/librustc_resolve/imports.rs:906: inconsistent resolution for an import', /rustc/1836e3b42a5b2f37fd79104eedbe8f48a5afdee6/src/libstd/macros.rs:13:23

Meta

rustc --version --verbose:

rustc 1.45.0-nightly (1836e3b42 2020-05-06)
binary: rustc
commit-hash: 1836e3b42a5b2f37fd79104eedbe8f48a5afdee6
commit-date: 2020-05-06
host: x86_64-apple-darwin
release: 1.45.0-nightly
LLVM version: 9.0
Backtrace

$ RUST_BACKTRACE=1 cargo build
   Compiling toml v0.5.6
   Compiling serde_json v1.0.52
   Compiling web-sys v0.3.39
   Compiling rustc-ap-rustc_span v656.0.0
thread 'rustc' panicked at 'src/librustc_resolve/imports.rs:906: inconsistent resolution for an import', /rustc/1836e3b42a5b2f37fd79104eedbe8f48a5afdee6/src/libstd/macros.rs:13:23
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: rustc_driver::report_ice
   6: std::panicking::rust_panic_with_hook
   7: std::panicking::begin_panic
   8: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
   9: rustc_middle::ty::context::tls::with_opt::{{closure}}
  10: rustc_middle::ty::context::tls::with_opt
  11: rustc_middle::util::bug::opt_span_bug_fmt
  12: rustc_middle::util::bug::span_bug_fmt
  13: rustc_resolve::imports::ImportResolver::finalize_import
  14: rustc_resolve::imports::ImportResolver::finalize_imports
  15: rustc_resolve::Resolver::resolve_crate
  16: rustc_interface::passes::configure_and_expand_inner
  17: rustc_interface::passes::configure_and_expand::{{closure}}
  18: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  19: rustc_interface::passes::configure_and_expand
  20: rustc_interface::queries::Queries::expansion
  21: rustc_interface::interface::run_compiler_in_existing_thread_pool
  22: scoped_tls::ScopedKey<T>::set
  23: rustc_ast::attr::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.45.0-nightly (1836e3b42 2020-05-06) running on x86_64-apple-darwin

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

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

query stack during panic:
end of query stack
error: could not compile `rustc-ap-rustc_span`.

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

@ctaggart ctaggart added the C-bug Category: This is a bug. label May 7, 2020
@petrochenkov petrochenkov self-assigned this May 7, 2020
@petrochenkov
Copy link
Contributor

Interesting.
A self-contained reproduction would be appreciated.

@ctaggart
Copy link
Contributor Author

ctaggart commented May 8, 2020

Here is a minimal reproduction:
https://github.com/ctaggart/rust-lang_71998

It is a combination of target = "wasm32-unknown-unknown" and rustc-ap-rustc_span = "656.0.0".

@petrochenkov
Copy link
Contributor

The issue happens only during cross-compilation, so it's likely a duplicate of #56935 #64450.

@ctaggart
Copy link
Contributor Author

ctaggart commented May 8, 2020

I thought I might be able to reproduce it by compiling librustc_span with wasm32, but I was wrong. It worked fine:

Camerons-MacBook-Pro:librustc_span cameron$ pwd
/Users/cameron/rs/rust/src/librustc_span
Camerons-MacBook-Pro:librustc_span cameron$ cargo build --target wasm32-unknown-unknown
    Finished dev [unoptimized] target(s) in 0.75s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants