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

ICE with syntax error #133230

Closed
kurtlawrence opened this issue Nov 20, 2024 · 3 comments
Closed

ICE with syntax error #133230

kurtlawrence opened this issue Nov 20, 2024 · 3 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

@kurtlawrence
Copy link

Code

fn foo {
    static CLIENT = std::cell::LazyCell::new(|| reqwest::blocking::Client::new());
}

Meta

rustc --version --verbose:

rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: x86_64-unknown-linux-gnu
release: 1.82.0
LLVM version: 19.1.1

Error output

error: missing type for `static` item
  --> src/main.rs:77:22
   |
77 |         static CLIENT = std::cell::LazyCell::new(|| reqwest::blocking::Client::new());
   |                      ^
   |
note: however, the inferred type `LazyCell<Client, {[email protected]:77:50}>` cannot be named
  --> src/main.rs:77:25
   |
77 |         static CLIENT = std::cell::LazyCell::new(|| reqwest::blocking::Client::new());
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_const_eval/src/interpret/validity.rs:763:21:
assertion `left == right` failed
  left: Mut
 right: Not
Backtrace


stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed::<rustc_ast_ir::Mutability, rustc_ast_ir::Mutability>
   4: <rustc_const_eval::interpret::validity::ValidityVisitor<rustc_const_eval::const_eval::machine::CompileTimeMachine>>::in_mutable_memory.cold
   5: <rustc_const_eval::interpret::validity::ValidityVisitor<rustc_const_eval::const_eval::machine::CompileTimeMachine> as rustc_const_eval::interpret::visitor::ValueVisitor<rustc_const_eval::const_eval::machine::CompileTimeMachine>>::visit_value
   6: <rustc_const_eval::interpret::validity::ValidityVisitor<rustc_const_eval::const_eval::machine::CompileTimeMachine> as rustc_const_eval::interpret::visitor::ValueVisitor<rustc_const_eval::const_eval::machine::CompileTimeMachine>>::visit_value
   7: <rustc_const_eval::interpret::eval_context::InterpCx<rustc_const_eval::const_eval::machine::CompileTimeMachine>>::validate_operand_internal
   8: rustc_const_eval::const_eval::eval_queries::eval_body_using_ecx::<rustc_middle::mir::interpret::allocation::ConstAllocation>
   9: rustc_const_eval::const_eval::eval_queries::eval_static_initializer_provider
      [... omitted 2 frames ...]
  10: rustc_hir_analysis::check_crate
  11: rustc_interface::passes::run_required_analyses
  12: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  13: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: 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.82.0 (f6e511eec 2024-10-15) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [eval_static_initializer] evaluating initializer of static `fetch::fetch_::CLIENT`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `milestone-tracker` (bin "milestone-tracker") due to 1 previous error

Other

Not a big deal because it was a typo that triggered it. Thought I would report the ICE nonetheless.

@kurtlawrence kurtlawrence 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 Nov 20, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 20, 2024
@theemathas
Copy link
Contributor

Duplicate of #124164. It is currently already fixed on the beta version, and will be fixed in stable rust in the upcoming 1.83.0 version.

@fmease
Copy link
Member

fmease commented Nov 20, 2024

Thanks for your report! This is already fixed on beta and nightly. In the future please double-check that your issue hasn't been fixed already on beta/nightly before opening an issue.

Closing as duplicate of closed #124164.

@fmease fmease closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2024
@fmease
Copy link
Member

fmease commented Nov 20, 2024

ah raced :^)

@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 20, 2024
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

4 participants