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

Failed to build Windows crate with i686-pc-windows-msvc #82991

Closed
kennykerr opened this issue Mar 10, 2021 · 17 comments
Closed

Failed to build Windows crate with i686-pc-windows-msvc #82991

kennykerr opened this issue Mar 10, 2021 · 17 comments
Labels
A-proc-macros Area: Procedural macros 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) ❄️ O-windows-msvc Toolchain: MSVC, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kennykerr
Copy link
Contributor

As requested, here's another internal compiler error I just ran into. Targeting x86_64-pc-windows-msvc works fine but targeting i686-pc-windows-msvc causes a compiler error.

Repro steps

git clone http://github.com/microsoft/windows-rs
cd windows-rs
cargo build --target i686-pc-windows-msvc

Results

C:\windows-rs>cargo build --target i686-pc-windows-msvc
   Compiling proc-macro2 v1.0.24
   Compiling syn v1.0.63
   Compiling unicode-xid v0.2.1
   Compiling squote v0.1.2
   Compiling const-sha1 v0.2.0
   Compiling quote v1.0.9
   Compiling windows_gen_macros v0.4.0 (C:\windows-rs\crates\gen\macros)
   Compiling windows_gen v0.4.0 (C:\windows-rs\crates\gen)
thread 'rustc' panicked at 'Failed to get crate data for crate15', compiler\rustc_metadata\src\creader.rs:136:32
note: run with `RUST_BACKTRACE=1` environment variable to display a 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.52.0-nightly (3a5d45f68 2021-03-09) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --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 `windows_gen`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
@kennykerr kennykerr 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 Mar 10, 2021
@kennykerr
Copy link
Contributor Author

Actually, this seems to be the same issue that docs.rs is running into (#82988).

@jyn514
Copy link
Member

jyn514 commented Mar 10, 2021

Note docs.rs is using "--target" "x86_64-pc-windows-msvc", so this isn't spcific to i686.

@moxian
Copy link
Contributor

moxian commented Mar 11, 2021

Backtrace:
PS D:\work\trash\github\windows-rs> cargo +nightly build --target i686-pc-windows-msvc --verbose
       Fresh unicode-xid v0.2.1
       Fresh squote v0.1.2
       Fresh const-sha1 v0.2.0
       Fresh proc-macro2 v1.0.24
       Fresh quote v1.0.9
       Fresh syn v1.0.63
       Fresh windows_gen_macros v0.4.0 (D:\work\trash\github\windows-rs\crates\gen\macros)
   Compiling windows_gen v0.4.0 (D:\work\trash\github\windows-rs\crates\gen)
       Fresh windows_macros v0.4.0 (D:\work\trash\github\windows-rs\crates\macros)
     Running `rustc --crate-name windows_gen --edition=2018 crates\gen\src\lib.rs --error-format=json --json=diagnostic-
rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=1e
a50951892df2d0 -C extra-filename=-1ea50951892df2d0 --out-dir D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps --target i686-pc-windows-msvc -C incremental=D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\incremental -L dependency=D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps -L dependency=D:\work\trash\github\windows-rs\target\debug\deps --extern proc_macro2=D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps\libproc_macro2-38e33f2f3aac18a7.rmeta --extern quote=D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps\libquote-3fdae8b6361c3c59.rmeta --extern squote=D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps\libsquote-7e42ba303971a56d.rmeta --extern syn=D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps\libsyn-b33358b6864d6692.rmeta --extern macros=D:\work\trash\github\windows-rs\target\debug\deps\windows_gen_macros-a1f290352570ce5d.dll`
thread 'rustc' panicked at 'Failed to get crate data for crate15', compiler\rustc_metadata\src\creader.rs:136:32
stack backtrace:
   0:      0x7fed9c3879e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h29e3178dfca9172d
   1:      0x7fed9c6405c - core::fmt::write::h187a24ff0c56237d
   2:      0x7fed9c2bf38 - <std::io::IoSlice as core::fmt::Debug>::fmt::hf9bc4afd00f56a97
   3:      0x7fed9c3c94d - std::panicking::take_hook::he864250439773e97
   4:      0x7fed9c3c419 - std::panicking::take_hook::he864250439773e97
   5:      0x7feccec2457 - rustc_driver::report_ice::hbe9b74fa4ffbc8a3
   6:      0x7fed9c3d1b5 - std::panicking::rust_panic_with_hook::hfaab7d6c0aa47dfe
   7:      0x7fed9c3cd11 - rust_begin_unwind
   8:      0x7fed9c390ef - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h29e3178dfca9172d
   9:      0x7fed9c3cc69 - rust_begin_unwind
  10:      0x7fed9c9584c - std::panicking::begin_panic_fmt::h827db613866cf127
  11:      0x7fed0667447 - <rustc_metadata::creader::CrateDump as core::fmt::Debug>::fmt::h5df8090f56b7e514
  12:      0x7fed066bb24 - rustc_metadata::creader::CrateLoader::into_cstore::h5cc49120d4022104
  13:      0x7fed0670313 - rustc_metadata::creader::CrateLoader::maybe_process_path_extern::hd535eb9109c96348
  14:      0x7fecf858b0e - rustc_resolve::Resolver::traits_in_scope::h260c452b1769e900
  15:      0x7fecf83ba77 - rustc_resolve::macros::<impl rustc_resolve::Resolver>::resolve_macro_path::h9733130447ef38a8
  16:      0x7fecf8538d9 - rustc_resolve::Resolver::traits_in_scope::h260c452b1769e900
  17:      0x7fecf851560 - rustc_resolve::Resolver::traits_in_scope::h260c452b1769e900
  18:      0x7fecf83a28e - rustc_resolve::macros::<impl rustc_resolve::Resolver>::resolve_macro_path::h9733130447ef38a8
  19:      0x7fecf836ada - rustc_resolve::macros::<impl rustc_expand::base::ResolverExpand for rustc_resolve::Resolver>::resolve_macro_invocation::h115bf92ce6620889
  20:      0x7fed082d673 - rustc_expand::expand::MacroExpander::fully_expand_fragment::h4189cd99156fd4cc
  21:      0x7fed082c60c - rustc_expand::expand::MacroExpander::expand_crate::h3dedfb87f63a1924
  22:      0x7fecd009bc0 - rustc_interface::passes::BoxedResolver::to_resolver_outputs::hcf4e5c823f6ab62b
  23:      0x7fecd0adb69 - rustc_interface::interface::try_print_query_stack::h390f27bc39ef53eb
  24:      0x7fecd0a2636 - <rustc_interface::proc_macro_decls::Finder as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h42fa963856279c22
  25:      0x7fecd007a67 - <rls_span::compiler::_::<impl serde::de::Deserialize for rls_span::compiler::DiagnosticSpanMacroExpansion>::deserialize::__Visitor as serde::de::Visitor>::expecting::hd5b46ca79c97c9e8
  26:      0x7fecd01b4d8 - rustc_interface::queries::Queries::expansion::h11dcf0fe3e54df0d
  27:      0x7feccedaa1d - <rustc_middle::ty::SymbolName as core::fmt::Display>::fmt::h17a09aa888927f04
  28:      0x7feccec4b8c - <rustc_driver::Compilation as core::fmt::Debug>::fmt::he3b75735c17c4dbb
  29:      0x7feccedd206 - <rustc_middle::ty::SymbolName as core::fmt::Display>::fmt::h17a09aa888927f04
  30:      0x7fecced77c4 - chalk_engine::table::AnswerIndex::increment::he965260fccad8761
  31:      0x7feccedd93b - <rustc_middle::ty::SymbolName as core::fmt::Display>::fmt::h17a09aa888927f04
  32:      0x7feccf013bd - <tracing_subscriber::util::TryInitError as core::fmt::Display>::fmt::he7f90af69710fa6b
  33:      0x7fed9c4c84a - std::sys::windows::thread::Thread::new::h41ec480efd53d216
  34:         0x7701556d - BaseThreadInitThunk
  35:         0x7717372d - RtlUserThreadStart

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.52.0-nightly (8f349be27 2021-03-08) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --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 `windows_gen`

Caused by:
  process didn't exit successfully: `rustc --crate-name windows_gen --edition=2018 crates\gen\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=1ea50951892df2d0 -C extra-filename=-1ea50951892df2d0 --out-dir D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps --target i686-pc-windows-msvc -C incremental=D:\work\trash\github\windows-rs\target\i
686-pc-windows-msvc\debug\incremental -L dependency=D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps -L dependency=D:\work\trash\github\windows-rs\target\debug\deps --extern proc_macro2=D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps\libproc_macro2-38e33f2f3aac18a7.rmeta --extern quote=D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps\libquote-3fdae8b6361c3c59.rmeta --extern squote=D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps\libsquote-7e42ba303971a56d.rmeta --extern syn=D:\work\trash\github\windows-rs\target\i686-pc-windows-msvc\debug\deps\libsyn-b33358b6864d6692.rmeta --extern macros=D:\work\trash\github\windows-rs\target\debug\deps\windows_gen_macros-a1f290352570ce5d.dll` (exit code: 101)

@rylev
Copy link
Member

rylev commented Mar 11, 2021

Testing against this windows-rs commit. This fails in stable all the way back to 1.46. It may go further back but windows-rs relies on some const functionality that was introduced in 1.46 and so it fails to compile without an ICE in 1.45.

This has a different backtrace on beta and all of the stables:

backtrace
 cargo +beta build --target=i686-pc-windows-msvc
   Compiling windows_gen v0.4.0 (C:\Users\ryanl\Code\windows-rs\crates\gen)
thread 'rustc' panicked at 'compiler\rustc_resolve\src\imports.rs:904:25: inconsistent resolution for an import', /rustc/4d25f4607015a56d18d7c6c649441608a9298845\library\std\src\panic.rs:59:5
stack backtrace:
   0:     0x7fffb8c8896e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4250b92f779127fa
   1:     0x7fffb8cb47cb - core::fmt::write::h03b5df1724a61ac9
   2:     0x7fffb8c7be68 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::hfbc56bd070366dc3
   3:     0x7fffb8c8cb3d - std::panicking::take_hook::h63160ec33aab7934
   4:     0x7fffb8c8c609 - std::panicking::take_hook::h63160ec33aab7934
   5:     0x7fffa1dfd475 - rustc_driver::report_ice::hfe8ada112a6b706d
   6:     0x7fffb8c8d5a2 - std::panicking::rust_panic_with_hook::hdf6c3e39bb7a4662
   7:     0x7fffa47a17d8 - <rustc_resolve::imports::UnresolvedImportError as core::fmt::Debug>::fmt::h2263387dae85b984
   8:     0x7fffa47a165f - <rustc_resolve::imports::UnresolvedImportError as core::fmt::Debug>::fmt::h2263387dae85b984
   9:     0x7fffa47a16e6 - <rustc_resolve::imports::UnresolvedImportError as core::fmt::Debug>::fmt::h2263387dae85b984
  10:     0x7fffa47d1d06 - <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_ty::h7f161ddb75dc5d05
  11:     0x7fffa47d0e2c - <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_ty::h7f161ddb75dc5d05
  12:     0x7fffa47d0ce1 - <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_ty::h7f161ddb75dc5d05
  13:     0x7fffa47d0c43 - <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_ty::h7f161ddb75dc5d05
  14:     0x7fffa47d0d89 - <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_ty::h7f161ddb75dc5d05
  15:     0x7fffa47d0d49 - <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_ty::h7f161ddb75dc5d05
  16:     0x7fffa478af53 - rustc_resolve::imports::ImportResolver::finalize_imports::h058aecd33a8078be
  17:     0x7fffa4784d0a - rustc_resolve::imports::ImportResolver::finalize_imports::h058aecd33a8078be
  18:     0x7fffa47d1185 - <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_ty::h7f161ddb75dc5d05
  19:     0x7fffa482ff22 - rustc_resolve::Resolver::resolve_crate::h8a92aa605b0036a3
  20:     0x7fffa1ff61f8 - rustc_interface::passes::BoxedResolver::to_resolver_outputs::h2d92347711680db0
  21:     0x7fffa1fd47ff - rustc_interface::interface::parse_cfgspecs::hd94eda9d41345067
  22:     0x7fffa1fc3146 - rustc_interface::util::commit_date_str::hb81a5a6e14a3c6be
  23:     0x7fffa1ff4647 - rustc_interface::interface::parse_cfgspecs::hd94eda9d41345067
  24:     0x7fffa202c516 - rustc_interface::queries::Queries::expansion::h630bc3eb9a43aab4
  25:     0x7fffa1e21ba0 - rustc_ast::util::parser::prec_let_scrutinee_needs_par::h697cc8610eb6932c
  26:     0x7fffa1e005d5 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::hf50081b5c60853fc
  27:     0x7fffa1e23229 - rustc_ast::util::parser::prec_let_scrutinee_needs_par::h697cc8610eb6932c
  28:     0x7fffa1e02465 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::hf50081b5c60853fc
  29:     0x7fffa1e25a15 - rustc_ast::util::parser::prec_let_scrutinee_needs_par::h697cc8610eb6932c
  30:     0x7fffa1e4d28d - rustc_ast::util::parser::prec_let_scrutinee_needs_par::h697cc8610eb6932c
  31:     0x7fffb8c9cb8a - std::sys::windows::thread::Thread::new::hbe3a2f8dadfc4075
  32:     0x7ff82e387034 - BaseThreadInitThunk
  33:     0x7ff82f25d241 - RtlUserThreadStart

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.51.0-beta.4 (4d25f4607 2021-03-05) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --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 `windows_gen`

This does not fail with the x86_64-pc-windows-msvc target. Not sure if there's something else happening with docs.rs.

@rylev rylev added the O-windows-msvc Toolchain: MSVC, Operating system: Windows label Mar 11, 2021
@rylev rylev added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 11, 2021
@JohnTitor JohnTitor added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Mar 12, 2021
@rylev
Copy link
Member

rylev commented Mar 15, 2021

I've not been able to reproduce this exactly like what's happening in windows-rs, but I have a repro of what is most likely a related issue. Fixing this issue should help us get closer to the issue at hand.

The issue ICE on stable and beta but only plain compiler errors on nightly (though the code is fine and shouldn't error). This mirrors how the original issue seems to change behavior in nightly.

Main Crate

main.rs

fn main() {
    dep::foo!();
}

Cargo.toml

[package]
name = "main_crate"
version = "0.1.0"
authors = ["Ryan Levick <me@ryanlevick.com>"]
edition = "2018"

[dependencies]
# Renaming the dependency seems to be the key here
dep = { package = "dependency", path = "dependency",  version = "0.1.0"  }

Dependency Crate

lib.rs

use proc_macro::TokenStream;

#[proc_macro]
pub fn foo(_arg: TokenStream) -> TokenStream {
    TokenStream::new()
}

Cargo.toml

[package]
name = "dependency"
version = "0.1.0"
authors = ["Ryan Levick <me@ryanlevick.com>"]
edition = "2018"

[lib]
proc-macro = true

[dependencies]

Compilation

Nightly

> cargo +nightly build --target=i686-pc-windows-msvc
   Compiling dependency v0.1.0 (C:\Users\ryanl\Code\issue-repros\rustc-82991\dependency)
   Compiling main_crate v0.1.0 (C:\Users\ryanl\Code\issue-repros\rustc-82991\main_crate)
error: found crates (`dependency` and `dependency`) with colliding StableCrateId values.
 --> src\main.rs:2:5
  |
2 |     dep::foo!();
  |     ^^^

error: aborting due to previous error

error: could not compile `main_crate

> cargo +nightly build 
   Compiling main_crate v0.1.0 (C:\Users\ryanl\Code\issue-repros\rustc-82991\main_crate)
    Finished dev [unoptimized + debuginfo] target(s) in 0.51s

Stable

> cargo build --target=i686-pc-windows-msvc           
   Compiling dependency v0.1.0 (C:\Users\ryanl\Code\issue-repros\rustc-82991\dependency)
   Compiling main_crate v0.1.0 (C:\Users\ryanl\Code\issue-repros\rustc-82991\main_crate)
thread 'rustc' panicked at 'forcing query with already existing `DepNode`
- query-key: crate14
- dep-node: defined_lang_items(cb974dfd4fb62bad-4511b4e87d478f4)', /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b\compiler\rustc_query_system\src\query\plumbing.rs:586:5
note: run with `RUST_BACKTRACE=1` environment variable to display a 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.50.0 (cb75ad5db 2021-02-10) running on x86_64-pc-windows-msvc

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:
#0 [get_lang_items] calculating the lang items map
#1 [codegen_fn_attrs] computing codegen attributes of `main`
end of query stack
error: internal compiler error: inconsistent resolution for a macro
 --> src\main.rs:2:5
  |
2 |     dep::foo!();
  |     ^^^^^^^^
  |
  = note: delayed at compiler\rustc_resolve\src\macros.rs:905:34

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler\rustc_errors\src\lib.rs:974:13
stack backtrace:
   0:     0x7ff9437bba1e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h199efbbe241ec08f
   1:     0x7ff9437e83ab - core::fmt::write::h63b6c7d72e7e2a54
   2:     0x7ff9437ad238 - <std::io::IoSlice as core::fmt::Debug>::fmt::h607ced2beaa31968
   3:     0x7ff9437bfcbd - std::panicking::take_hook::h0c6a997b269337ea
   4:     0x7ff9437bf724 - std::panicking::take_hook::h0c6a997b269337ea
   5:     0x7ff91d45bad7 - rustc_driver::report_ice::h2ae604e88a111d05
   6:     0x7ff9437c076f - std::panicking::rust_panic_with_hook::h556f87f9f9305c97
   7:     0x7ff9437c0261 - rust_begin_unwind
   8:     0x7ff9437bc37f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h199efbbe241ec08f
   9:     0x7ff9437c01b9 - rust_begin_unwind
  10:     0x7ff9437c016c - std::panicking::begin_panic_fmt::hc026b96589146be6
  11:     0x7ff921bf7e34 - rustc_errors::HandlerInner::delay_as_bug::h28973f7e9d60a8f6
  12:     0x7ff921bf3514 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::hbc37fc6cd4566a50
  13:     0x7ff91d474867 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::hee44c68edd0d4a9a
  14:     0x7ff91d47d40a - <rustc_driver::Compilation as core::fmt::Debug>::fmt::hee44c68edd0d4a9a
  15:     0x7ff91d47620c - <rustc_driver::Compilation as core::fmt::Debug>::fmt::hee44c68edd0d4a9a
  16:     0x7ff91d46008e - <rustc_driver::Compilation as core::fmt::Debug>::fmt::hee44c68edd0d4a9a
  17:     0x7ff921d95620 - _rust_alloc_zeroed
  18:     0x7ff921d94a6a - _rust_alloc_zeroed
  19:     0x7ff921d90874 - _rust_alloc_zeroed
  20:     0x7ff921d93dd1 - _rust_alloc_zeroed
  21:     0x7ff921d9118d - _rust_alloc_zeroed
  22:     0x7ff9ad171fef - _chkstk
  23:     0x7ff9ad100939 - RtlUnwindEx
  24:     0x7ff921d90d3e - _rust_alloc_zeroed
  25:     0x7ff921d92a41 - _rust_alloc_zeroed
  26:     0x7ff921d92e6b - _rust_alloc_zeroed
  27:     0x7ff921d93ecd - _rust_alloc_zeroed
  28:     0x7ff921d9118d - _rust_alloc_zeroed
  29:     0x7ff9ad171f6f - _chkstk
  30:     0x7ff9ad121454 - RtlRaiseException
  31:     0x7ff9ad1211a5 - RtlRaiseException
  32:     0x7ff9aac1d759 - RaiseException
  33:     0x7ff94380dad8 - _udivmodti4
  34:     0x7ff9437d3981 - _rust_start_panic
  35:     0x7ff9437d3909 - _rust_start_panic
  36:     0x7ff9437c0928 - rust_panic
  37:     0x7ff9437c0884 - std::panicking::rust_panic_with_hook::h556f87f9f9305c97
  38:     0x7ff9437b4099 - std::panic::resume_unwind::h668be6558c89fe0f
  39:     0x7ff91d66cb38 - rustc_interface::passes::QueryContext::print_stats::h865e85c5d05f5d22
  40:     0x7ff91d4a969b - rustc_ast::util::parser::prec_let_scrutinee_needs_par::ha8da07b6c5fa4d2d
  41:     0x7ff91d4ab576 - rustc_ast::util::parser::prec_let_scrutinee_needs_par::ha8da07b6c5fa4d2d
  42:     0x7ff91d41c7ed - chalk_engine::TimeStamp::increment::hfde8a5e4e8d69fa5
  43:     0x7ff91d46bc51 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::hee44c68edd0d4a9a
  44:     0x7ff91d40f69c - <tracing_subscriber::util::TryInitError as core::fmt::Display>::fmt::hf3e9f3dfdba5224e
  45:     0x7ff91d4aba0c - rustc_ast::util::parser::prec_let_scrutinee_needs_par::ha8da07b6c5fa4d2d
  46:     0x7ff91d4851d4 - rustc_ast::util::parser::prec_let_scrutinee_needs_par::ha8da07b6c5fa4d2d
  47:     0x7ff91d45f8d5 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::hee44c68edd0d4a9a
  48:     0x7ff91d486a09 - rustc_ast::util::parser::prec_let_scrutinee_needs_par::ha8da07b6c5fa4d2d
  49:     0x7ff91d46cc7b - <rustc_driver::Compilation as core::fmt::Debug>::fmt::hee44c68edd0d4a9a
  50:     0x7ff91d3f44bd - <tracing_subscriber::util::TryInitError as core::fmt::Display>::fmt::hf3e9f3dfdba5224e
  51:     0x7ff9437cfd73 - std::sys::windows::thread::Thread::new::h36b7d068c12d6134
  52:     0x7ff9abc87034 - BaseThreadInitThunk
  53:     0x7ff9ad122651 - RtlUserThreadStart

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 (cb75ad5db 2021-02-10) running on x86_64-pc-windows-msvc

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
thread panicked while panicking. aborting.
error: could not compile `main_crate`

Caused by:
  process didn't exit successfully: `rustc --crate-name main_crate --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=d3ac3ec5167edbd7 --out-dir C:\Users\ryanl\Code\issue-repros\rustc-82991\main_crate\target\i686-pc-windows-msvc\debug\deps --target i686-pc-windows-msvc -C incremental=C:\Users\ryanl\Code\issue-repros\rustc-82991\main_crate\target\i686-pc-windows-msvc\debug\incremental -L dependency=C:\Users\ryanl\Code\issue-repros\rustc-82991\main_crate\target\i686-pc-windows-msvc\debug\deps -L dependency=C:\Users\ryanl\Code\issue-repros\rustc-82991\main_crate\target\debug\deps --extern dep=C:\Users\ryanl\Code\issue-repros\rustc-82991\main_crate\target\debug\deps\dependency-908b25e1ff475f50.dll` (exit code: 0xc000001d, STATUS_ILLEGAL_INSTRUCTION)

> cargo build                              
   Compiling main_crate v0.1.0 (C:\Users\ryanl\Code\issue-repros\rustc-82991\main_crate)
    Finished dev [unoptimized + debuginfo] target(s) in 0.33s

rustc version

> rustc +nightly --version --verbose
rustc 1.52.0-nightly (d6eaea1c8 2021-03-14)
binary: rustc
commit-hash: d6eaea1c8860adb5302d2fbaad409e36585ab217
commit-date: 2021-03-14
host: x86_64-pc-windows-msvc
release: 1.52.0-nightly
LLVM version: 12.0.0

> rustc --version --verbose         
rustc 1.50.0 (cb75ad5db 2021-02-10)
binary: rustc
commit-hash: cb75ad5db02783e8b0222fee363c5f63f7e2cf5b
commit-date: 2021-02-10
host: x86_64-pc-windows-msvc
release: 1.50.0

@rylev
Copy link
Member

rylev commented Mar 15, 2021

The issue is partially fixed (i.e., it goes from an ICE to just the compiler error message) in nightly-2021-03-09. It looks like #81635 is what caused the change.

@petrochenkov
Copy link
Contributor

petrochenkov commented Mar 15, 2021

If the issue happens only when you are cross-compiling, then it may be #56935.

@JohnTitor JohnTitor added 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) ❄️ and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Mar 17, 2021
@apiraino apiraino added the A-proc-macros Area: Procedural macros label Mar 17, 2021
@eddyb
Copy link
Member

eddyb commented Mar 17, 2021

@petrochenkov I can cause this ICE without cross-compiling (#83045 (comment) / #83138 (comment)) but I can't tell if this is the same situation - it would be nice to be able to consolidate all 3 of these issues under one, if they have the same cause.

@rylev
Copy link
Member

rylev commented Mar 17, 2021

@eddyb if your ICE doesn't repro on stable than it may be related but isn't the same issue as this.

@eddyb
Copy link
Member

eddyb commented Mar 17, 2021

Ah I see my confusion, #82991 (comment) states that #81635 fixed the ICE for you, while it introduced the ICE elsewhere.

I believe #81635 just changes which crates are considered identical. The ICE seems to be separate, but whether it can be triggered depends on some logic that #81635 changed.

@michaelwoerister
Copy link
Member

michaelwoerister commented Mar 19, 2021

I'll take a look as soon as I get a chance. I thought this was a duplicate of #83045 but turns out it isn't. #83045 is what I'm actually looking into.

@Berrysoft
Copy link
Contributor

Today the compiler reports a more readable error:

   Compiling proc-macro2 v1.0.24
   Compiling syn v1.0.64
   Compiling unicode-xid v0.2.1
   Compiling squote v0.1.2
   Compiling const-sha1 v0.2.0
   Compiling quote v1.0.9
   Compiling windows_gen_macros v0.5.0 (D:\Documents\GitHub\windows-rs\crates\gen\macros)
   Compiling windows_gen v0.5.0 (D:\Documents\GitHub\windows-rs\crates\gen)
error: found crates (`windows_gen_macros` and `windows_gen_macros`) with colliding StableCrateId values.
 --> crates\gen\src\parser\codes.rs:2:5
  |
2 | use macros::type_code;
  |     ^^^^^^

error: aborting due to previous error

error: could not compile `windows_gen`

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

Note that this error only complains when cross compiling. The build succeeds when using i686 toolchain.

@eddyb
Copy link
Member

eddyb commented Mar 19, 2021

That may explain why the ICE is gone: the error probably happens before the point the ICE would've triggered.

@apiraino
Copy link
Contributor

apiraino commented Aug 26, 2021

@kennykerr I'm trying to get an updated picture of this issue, can you report if it still reproduces? thanks

@jyn514
Copy link
Member

jyn514 commented Aug 26, 2021

Oh yeah, #56935 has since been fixed.

@apiraino
Copy link
Contributor

Cool, then if the issue is no more, please @kennykerr can you confirm we can close it? Otherwise I'll close it myself after a while

@rustbot label -I-prioritize

@rustbot rustbot removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Aug 26, 2021
@kennykerr
Copy link
Contributor Author

Looks good to me.

@jyn514 jyn514 closed this as completed Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-proc-macros Area: Procedural macros 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) ❄️ O-windows-msvc Toolchain: MSVC, Operating system: Windows 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