Skip to content

ICE when compiling eyre on no_std #101707

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

Closed
TheButlah opened this issue Sep 12, 2022 · 6 comments
Closed

ICE when compiling eyre on no_std #101707

TheButlah opened this issue Sep 12, 2022 · 6 comments
Labels
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.

Comments

@TheButlah
Copy link

Code

Please note that the error disappears when the eyre dependency is removed.
https://github.com/SlimeVR/SlimeVR-Rust/tree/ice-1

Meta

rustc --version --verbose:

rustc 1.65.0-nightly (228710758 2022-09-10)
binary: rustc
commit-hash: 2287107588d92889d282e6cd3c1ca5df34cd34a5
commit-date: 2022-09-10
host: x86_64-pc-windows-msvc
release: 1.65.0-nightly
LLVM version: 15.0.0

Error output

 Compiling compiler_builtins v0.1.79
   Compiling core v0.0.0 (C:\Users\Ryan\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core)
   Compiling proc-macro2 v1.0.43
   Compiling quote v1.0.21
   Compiling unicode-ident v1.0.3
   Compiling memchr v2.5.0
   Compiling syn v1.0.99
   Compiling regex-syntax v0.6.27
   Compiling lazy_static v1.4.0
   Compiling version_check v0.9.4
   Compiling autocfg v1.1.0
   Compiling strsim v0.10.0
   Compiling fnv v1.0.7
   Compiling ident_case v1.0.1
   Compiling riscv v0.8.0
   Compiling semver v1.0.13
   Compiling paste v1.0.8
   Compiling esp32c3 v0.5.0
   Compiling atomic-polyfill v1.0.1
   Compiling futures-core v0.3.24
   Compiling defmt v0.3.2
   Compiling futures-task v0.3.24
   Compiling esp-hal-common v0.1.0 (https://github.com/esp-rs/esp-hal?rev=da3ec47b30a5f598e904ffac0e10f94716cb4023#da3ec47b)
   Compiling defmt-macros v0.3.2
   Compiling defmt-parser v0.3.1
   Compiling futures-util v0.3.24
   Compiling esp32c3-hal v0.1.0 (https://github.com/esp-rs/esp-hal?rev=da3ec47b30a5f598e904ffac0e10f94716cb4023#da3ec47b)
   Compiling libm v0.2.5
   Compiling critical-section v0.2.7
   Compiling log v0.4.17
   Compiling esp-println v0.2.2
   Compiling typenum v1.15.0
   Compiling defmt-rtt v0.3.2
   Compiling eyre v0.6.8
   Compiling esp-backtrace v0.1.0
   Compiling embassy-executor v0.1.0 (https://github.com/embassy-rs/embassy?rev=cb9f0ef5b800ce4a22cde1805e0eb88425f1e07b#cb9f0ef5)
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling num-rational v0.4.1
   Compiling aho-corasick v0.7.19
   Compiling rustc_version v0.4.0
   Compiling heapless v0.7.16
   Compiling regex v1.6.0
   Compiling riscv-target v0.1.2
   Compiling riscv-rt v0.9.0
   Compiling riscv-atomic-emulation-trap v0.1.1
   Compiling riscv v0.7.0
   Compiling esp-wifi v0.1.0 (https://github.com/esp-rs/esp-wifi?rev=1fb0a1562a7faccb5a624fcff5a51806f9c14b09#1fb0a156)
   Compiling darling_core v0.14.1
   Compiling darling_core v0.13.4
   Compiling riscv-rt-macros v0.2.0
   Compiling darling_macro v0.14.1
   Compiling darling_macro v0.13.4
   Compiling darling v0.14.1
   Compiling darling v0.13.4
   Compiling esp-hal-procmacros v0.1.0 (https://github.com/esp-rs/esp-hal?rev=da3ec47b30a5f598e904ffac0e10f94716cb4023#da3ec47b)
   Compiling embassy-macros v0.1.0 (https://github.com/embassy-rs/embassy?rev=cb9f0ef5b800ce4a22cde1805e0eb88425f1e07b#cb9f0ef5)
   Compiling rustc-std-workspace-core v1.99.0 (C:\Users\Ryan\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-core)
   Compiling alloc v0.0.0 (C:\Users\Ryan\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc)
    Checking nb v1.0.0
    Checking bare-metal v1.0.0
    Checking bit_field v0.10.1
    Checking void v1.0.2
    Checking cfg-if v1.0.0
    Checking critical-section v1.1.0
    Checking r0 v1.0.0
    Checking vcell v0.1.3
    Checking gcd v2.1.0
    Checking byteorder v1.4.3
    Checking bitflags v1.3.2
    Checking stable_deref_trait v1.2.0
    Checking pin-utils v0.1.0
    Checking managed v0.8.0
    Checking linked_list_allocator v0.10.3
    Checking pin-project-lite v0.2.9
    Checking indenter v0.3.3
    Checking embedded-io v0.3.0
    Checking once_cell v1.14.0
    Checking embassy-futures v0.1.0 (https://github.com/embassy-rs/embassy?rev=cb9f0ef5b800ce4a22cde1805e0eb88425f1e07b#cb9f0ef5)
    Checking nb v0.1.3
    Checking embedded-hal v1.0.0-alpha.8
thread 'rustc' panicked at 'identifier: "metadata_std_required", attr: None, args: FluentArgs([("add_info", String("")), ("crate_name", String("std")), ("locator_triple", String("riscv32imac-unknown-none-elf"))]), errors: [ResolverError(Reference(Variable { id: "current_crate" }))]', compiler\rustc_errors\src\translation.rs:91:17
stack backtrace:
   0:     0x7ffbc75290f2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf35025dfc3e99720
   1:     0x7ffbc756459b - core::fmt::write::h63a906fee2a3ab5d
   2:     0x7ffbc751b79a - <std::io::IoSlice as core::fmt::Debug>::fmt::heed42498161d7b5a
   3:     0x7ffbc752c6e4 - std::panicking::default_hook::h236acf19113b7a6a
   4:     0x7ffbc752c31a - std::panicking::default_hook::h236acf19113b7a6a
    Checking fugit v0.3.6
    Checking embedded-hal v0.2.7
   5:     0x7ffbca25b18b - rustc_driver[3883b99043dbd0d]::describe_lints
   6:     0x7ffbc752d0e2 - std::panicking::rust_panic_with_hook::h0b9d1a8fb544c891
   7:     0x7ffbc752ce6d - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::he2f45151bac0e625
   8:     0x7ffbc7529dff - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf35025dfc3e99720
   9:     0x7ffbc752cb30 - rust_begin_unwind
  10:     0x7ffbc7599df5 - core::panicking::panic_fmt::hfb4a9b7f2fc8e120
  11:     0x7ffbc8a442b6 - <rustc_errors[725ee6d1248fa06b]::emitter::FileWithAnnotatedLines>::collect_annotations
  12:     0x7ffbc8a3c008 - <rustc_errors[725ee6d1248fa06b]::emitter::EmitterWriter>::ui_testing
  13:     0x7ffbc8a3ca45 - <rustc_errors[725ee6d1248fa06b]::emitter::EmitterWriter>::ui_testing
  14:     0x7ffbc8a37584 - <rustc_errors[725ee6d1248fa06b]::emitter::EmitterWriter as rustc_errors[725ee6d1248fa06b]::emitter::Emitter>::emit_diagnostic
  15:     0x7ffbc8a31f04 - <rustc_errors[725ee6d1248fa06b]::json::JsonEmitter as rustc_errors[725ee6d1248fa06b]::emitter::Emitter>::emit_artifact_notification
  16:     0x7ffbc8a312ef - <rustc_errors[725ee6d1248fa06b]::json::JsonEmitter as rustc_errors[725ee6d1248fa06b]::emitter::Emitter>::emit_diagnostic
  17:     0x7ffbc8a2efae - <rustc_errors[725ee6d1248fa06b]::HandlerInner>::emit_diagnostic
  18:     0x7ffbc8a2e112 - <rustc_errors[725ee6d1248fa06b]::Handler>::emit_diagnostic
  19:     0x7ffbcc6052db - <rustc_errors[725ee6d1248fa06b]::ErrorGuaranteed as rustc_errors[725ee6d1248fa06b]::diagnostic_builder::EmissionGuarantee>::diagnostic_builder_emit_producing_guarantee
  20:     0x7ffbcc1206f5 - <rustc_metadata[fcf7fe61921e0dd9]::rmeta::ProcMacroData as rustc_serialize[b2c7da44c7113ca]::serialize::Encodable<rustc_metadata[fcf7fe61921e0dd9]::rmeta::encoder::EncodeContext>>::encode
  21:     0x7ffbcc11be9c - <rustc_metadata[fcf7fe61921e0dd9]::locator::MetadataError as core[be660d2aa9fa5454]::fmt::Display>::fmt
  22:     0x7ffbc87d1f0f - <rustc_metadata[fcf7fe61921e0dd9]::creader::CrateLoader>::into_cstore
  23:     0x7ffbc87d3986 - <rustc_metadata[fcf7fe61921e0dd9]::creader::CrateLoader>::process_extern_crate
  24:     0x7ffbc98156d5 - <rustc_resolve[2fc444a2449b3d64]::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast[2e96cc40c1434c55]::visit::Visitor>::visit_item
  25:     0x7ffbc842797c - <rustc_resolve[2fc444a2449b3d64]::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast[2e96cc40c1434c55]::visit::Visitor>::visit_crate
  26:     0x7ffbc97f991b - <rustc_resolve[2fc444a2449b3d64]::Resolver as rustc_expand[e0b81650263632b7]::base::ResolverExpand>::visit_ast_fragment_with_placeholders
  27:     0x7ffbc9de9816 - <rustc_expand[e0b81650263632b7]::expand::MacroExpander>::fully_expand_fragment
  28:     0x7ffbc8845992 - <rustc_expand[e0b81650263632b7]::expand::MacroExpander>::expand_crate
  29:     0x7ffbc7b9721f - rustc_interface[349b21d0ff016796]::callbacks::setup_callbacks
  30:     0x7ffbc7b8b4c4 - <rustc_interface[349b21d0ff016796]::queries::Queries>::expansion
  31:     0x7ffbc7b4a2c0 - rustc_driver[3883b99043dbd0d]::main
  32:     0x7ffbc7b7d392 - rustc_driver[3883b99043dbd0d]::args::arg_expand_all
  33:     0x7ffbc7b4b7f0 - rustc_driver[3883b99043dbd0d]::main
  34:     0x7ffbc7b7ded7 - rustc_driver[3883b99043dbd0d]::args::arg_expand_all
  35:     0x7ffbc7b6e499 - rustc_driver[3883b99043dbd0d]::main
  36:     0x7ffbc7b6e8fd - rustc_driver[3883b99043dbd0d]::main
  37:     0x7ffbc753d8fc - std::sys::windows::thread::Thread::new::hbba233cde4ca4894
  38:     0x7ffc76087034 - BaseThreadInitThunk
  39:     0x7ffc78062651 - 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.65.0-nightly (228710758 2022-09-10) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -Z unstable-options -C force-frame-pointers -C link-arg=-Tlinkall.x -C link-arg=-Tdefmt.x

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

query stack during panic:
end of query stack
error: could not compile `once_cell`
Backtrace

    Checking fugit v0.3.6
thread 'rustc' panicked at 'identifier: "metadata_std_required", attr: None, args: FluentArgs([("add_info", String("")), ("crate_name", String("std")), ("locator_triple", String("riscv32imac-unknown-none-elf"))]), errors: [ResolverError(Reference(Variable { id: "current_crate" }))]', compiler\rustc_errors\src\translation.rs:91:17
stack backtrace:
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.65.0-nightly (228710758 2022-09-10) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -Z unstable-options -C force-frame-pointers -C link-arg=-Tlinkall.x -C link-arg=-Tdefmt.x

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

query stack during panic:
end of query stack
    Checking static_cell v1.0.0
error: could not compile `once_cell`

@TheButlah TheButlah 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 Sep 12, 2022
@BGR360
Copy link
Contributor

BGR360 commented Sep 12, 2022

Shoot, I'm unable to attempt a repro on my machine since ovr_overlay_sys won't build on Mac :/

@BGR360
Copy link
Contributor

BGR360 commented Sep 12, 2022

Is there any chance you could work to put together a more minimal repro with fewer dependencies? I know that's a lot to ask but it would be a massive help.

Also, can you clarify: is it just adding eyre to your Cargo.toml that breaks things? Or are you doing something with it? The backtrace looks vaguely like it's coming from trying to expand a proc_macro. Are you using some macro from the eyre crate?

I also see a line in the backtrace that references the compiler's incremental compilation serialization/deserialization. Can you try doing a cargo clean and see if that resolves things?

@compiler-errors
Copy link
Member

I think this is #101640

@TheButlah
Copy link
Author

I can attempt to make a more minimal example. Will take some work, but will update when its done. Probably won't happen in the next day or two though.

@compiler-errors
Copy link
Member

compiler-errors commented Sep 13, 2022

I wouldn't bother -- can you try updating your nightly compiler and seeing if this persists? see my previous comment, I think this is #101640 and therefore already fixed.

@TheButlah
Copy link
Author

I no longer get an ICE, instead I get a bunch of errors about missing types, presumably because once_cell was not passed the no_std flag

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. 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.
Projects
None yet
Development

No branches or pull requests

3 participants