Skip to content

ICE: unexpected generic param: GenericParam: closure_lifetime_binder + non_lifetime_binders #108184

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(closure_lifetime_binder)]
#![feature(non_lifetime_binders)]
#![crate_type = "lib"]

fn T() {
    for<T> || -> () {};
}

Meta

rustc --version --verbose:

rustc 1.69.0-nightly (f4f5fc3e5 2023-02-17)
binary: rustc
commit-hash: f4f5fc3e5cc70b7a43bf7b518c455f3d9bada9e3
commit-date: 2023-02-17
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Error output

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> a371a027afa2856063889cf433200478158d8c47.rs:2:12
  |
2 | #![feature(non_lifetime_binders)]
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: function `T` is never used
 --> a371a027afa2856063889cf433200478158d8c47.rs:5:4
  |
5 | fn T() {
  |    ^
  |
  = note: `#[warn(dead_code)]` on by default

warning: function `T` should have a snake case name
 --> a371a027afa2856063889cf433200478158d8c47.rs:5:4
  |
5 | fn T() {
  |    ^ help: convert the identifier to snake case: `t`
  |
  = note: `#[warn(non_snake_case)]` on by default

warning: unused closure that must be used
 --> a371a027afa2856063889cf433200478158d8c47.rs:6:5
  |
6 |     for<T> || -> () {};
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: closures are lazy and do nothing unless called
  = note: `#[warn(unused_must_use)]` on by default
Backtrace


error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: unexpected generic param: GenericParam { hir_id: HirId(DefId(0:3 ~ a371a027afa2856063889cf433200478158d8c47[2a77]::T).4), def_id: DefId(0:5 ~ a371a027afa2856063889cf433200478158d8c47[2a77]::T::{closure#0}::T), name: Plain(T#0), span: a371a027afa2856063889cf433200478158d8c47.rs:6:9: 6:10 (#0), pure_wrt_drop: false, kind: Type { default: None, synthetic: false }, colon_span: None }
 --> a371a027afa2856063889cf433200478158d8c47.rs:6:9
  |
6 |     for<T> || -> () {};
  |         ^
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
             2: <rustc_hir_typeck::writeback::WritebackCx as rustc_hir::intravisit::Visitor>::visit_expr
             3: <rustc_hir_typeck::writeback::WritebackCx as rustc_hir::intravisit::Visitor>::visit_expr
             4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::resolve_type_vars_in_body
             5: <rustc_hir_typeck::inherited::InheritedBuilder>::enter::<rustc_hir_typeck::typeck_with_fallback<rustc_hir_typeck::typeck::{closure#0}>::{closure#0}::{closure#1}, &rustc_middle::ty::typeck_results::TypeckResults>
             6: rustc_hir_typeck::typeck
             7: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
             8: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_hir_typeck::typeck_item_bodies::{closure#0}>::{closure#0}>
             9: rustc_hir_typeck::typeck_item_bodies
            10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
            11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
            12: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#7}>
            13: rustc_hir_analysis::check_crate
            14: rustc_interface::passes::analysis
            15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            17: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#3}>
            18: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
            19: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            20: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            21: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            22: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/f4f5fc3e5cc70b7a43bf7b518c455f3d9bada9e3/library/alloc/src/boxed.rs:1988:9
            24: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/f4f5fc3e5cc70b7a43bf7b518c455f3d9bada9e3/library/alloc/src/boxed.rs:1988:9
            25: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/f4f5fc3e5cc70b7a43bf7b518c455f3d9bada9e3/library/std/src/sys/unix/thread.rs:108:17
            26: <unknown>
            27: <unknown>


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.69.0-nightly (f4f5fc3e5 2023-02-17) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 2 previous errors; 4 warnings emitted

Metadata

Metadata

Labels

C-bugCategory: This is a bug.F-non_lifetime_binders`#![feature(non_lifetime_binders)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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