Skip to content

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

Closed

Description

@ctaggart

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

Activity

  1. self-assigned this
    on May 7, 2020
  2. petrochenkov commented on May 7, 2020

    @petrochenkov
    Contributor

    Interesting.
    A self-contained reproduction would be appreciated.

  3. ctaggart commented on May 8, 2020

    @ctaggart
    ContributorAuthor

    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".

  4. petrochenkov commented on May 8, 2020

    @petrochenkov
    Contributor

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

  5. ctaggart commented on May 8, 2020

    @ctaggart
    ContributorAuthor

    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
    
  6. added a commit that references this issue on May 8, 2020
    b750ee4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions