Skip to content

Internal compiler error in rustc 1.76.0 #121057

Open
@skibon02

Description

@skibon02

Code

// requires winit version 0.28.7
use winit::event_loop::EventLoop;



fn main() {
    let event_loop = EventLoop::new();

    event_loop.run(move |event, _, _| {
        event.to_static();

        print!("{:?}", event);
    });
}

Meta

rustc --version --verbose:

$ rustc --version --verbose
rustc 1.76.0 (07dca489a 2024-02-04)
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: x86_64-unknown-linux-gnu
release: 1.76.0
LLVM version: 17.0.6

Error output

error: internal compiler error: compiler/rustc_middle/src/ty/generic_args.rs:885:9: expected type for `T/#0` (T/#0/0) but found Lifetime('?30) when substituting, args=['?30, ()]

thread 'rustc' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/compiler/rustc_errors/src/lib.rs:1119:75:
Box<dyn Any>
Backtrace

stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic_builder::Bug as rustc_errors::diagnostic_builder::EmissionGuarantee>::diagnostic_builder_emit_producing_guarantee
   2: <rustc_errors::DiagCtxt>::bug::<alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::bug_fmt
   7: <rustc_middle::ty::generic_args::ArgFolder>::type_param_expected
   8: <rustc_middle::ty::generic_args::ArgFolder as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty
   9: <rustc_middle::ty::Clause as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustc_middle::ty::generic_args::ArgFolder>
  10: <rustc_middle::ty::generics::GenericPredicates>::instantiate_into
  11: <rustc_middle::ty::generics::GenericPredicates>::instantiate
  12: <rustc_infer::infer::InferCtxt as rustc_trait_selection::infer::InferCtxtExt>::could_impl_trait
  13: <rustc_borrowck::MirBorrowckCtxt>::explain_captures
  14: <rustc_borrowck::MirBorrowckCtxt>::report_use_of_moved_or_uninitialized
  15: rustc_borrowck::do_mir_borrowck
  16: rustc_borrowck::mir_borrowck
      [... omitted 1 frame ...]
  17: <rustc_borrowck::type_check::TypeChecker>::prove_closure_bounds
  18: <rustc_borrowck::type_check::TypeChecker>::typeck_mir
  19: rustc_borrowck::type_check::type_check
  20: rustc_borrowck::nll::compute_regions
  21: rustc_borrowck::do_mir_borrowck
  22: rustc_borrowck::mir_borrowck
      [... omitted 1 frame ...]
  23: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  24: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}

Additional info

Project has a single dependency: winit = "0.28.7"
Compiler finishes without panic on older rustc versions, for example on rustc 1.75.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions