-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️L-rust_2021_incompatible_closure_capturesLint: rust_2021_incompatible_closure_capturesLint: rust_2021_incompatible_closure_capturesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
auto-reduced (treereduce-rust):
//@compile-flags: -Wrust-2021-incompatible-closure-captures
#![feature(lazy_type_alias)]
type ExplicitTypeOutlives<'a, T: FnMut() -> ()> = (&'a (), T);
pub struct Warns {
_significant_drop: ExplicitTypeOutlives,
field: String,
}
pub fn test(w: Warns) {
_ = || drop(w.field);
}original:
#![feature(lazy_type_alias)]
#![allow(incomplete_features)]
struct Outer0<'a, T>(ExplicitTypeOutlives<'a, T>);
type ExplicitTypeOutlives<'a, T: FnMut() -> ()> = (&'a (), T);
pub struct Warns {
_significant_drop: ExplicitTypeOutlives,
field: String,
}
pub fn test(w: Warns) {
_ = || drop(w.field);
}
fn main() {}Version information
rustc 1.94.0-nightly (fa1f706fb 2025-12-07)
binary: rustc
commit-hash: fa1f706fbd0fd1c02763ecb28915bf23c860cb32
commit-date: 2025-12-07
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.5
Possibly related line of code:
rust/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs
Lines 165 to 177 in fa1f706
| fn normalize_generic_arg_after_erasing_regions( | |
| &self, | |
| arg: ty::GenericArg<'tcx>, | |
| ) -> ty::GenericArg<'tcx> { | |
| let arg = self.typing_env.as_query_input(arg); | |
| self.tcx.try_normalize_generic_arg_after_erasing_regions(arg).unwrap_or_else(|_| { | |
| bug!( | |
| "Failed to normalize {:?} in typing_env={:?}, \ | |
| maybe try to call `try_normalize_erasing_regions` instead", | |
| arg.value, | |
| self.typing_env, | |
| ) | |
| }) |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Wrust-2021-incompatible-closure-captures
Program output
error[E0106]: missing lifetime specifier
--> /tmp/icemaker_global_tempdir.icMrYBw7OIG2/rustc_testrunner_tmpdir_reporting.OSV5ks8o68FA/mvce.rs:6:24
|
6 | _significant_drop: ExplicitTypeOutlives,
| ^^^^^^^^^^^^^^^^^^^^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
5 ~ pub struct Warns<'a> {
6 ~ _significant_drop: ExplicitTypeOutlives<'a>,
|
warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
--> /tmp/icemaker_global_tempdir.icMrYBw7OIG2/rustc_testrunner_tmpdir_reporting.OSV5ks8o68FA/mvce.rs:1:12
|
1 | #![feature(lazy_type_alias)]
| ^^^^^^^^^^^^^^^
|
= note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.icMrYBw7OIG2/rustc_testrunner_tmpdir_reporting.OSV5ks8o68FA/mvce.rs:12:2
|
12 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.icMrYBw7OIG2/rustc_testrunner_tmpdir_reporting.OSV5ks8o68FA/mvce.rs`
error[E0107]: missing generics for type alias `ExplicitTypeOutlives`
--> /tmp/icemaker_global_tempdir.icMrYBw7OIG2/rustc_testrunner_tmpdir_reporting.OSV5ks8o68FA/mvce.rs:6:24
|
6 | _significant_drop: ExplicitTypeOutlives,
| ^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument
|
note: type alias defined here, with 1 generic parameter: `T`
--> /tmp/icemaker_global_tempdir.icMrYBw7OIG2/rustc_testrunner_tmpdir_reporting.OSV5ks8o68FA/mvce.rs:3:6
|
3 | type ExplicitTypeOutlives<'a, T: FnMut() -> ()> = (&'a (), T);
| ^^^^^^^^^^^^^^^^^^^^ -
help: add missing generic argument
|
6 | _significant_drop: ExplicitTypeOutlives<T>,
| +++
error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:171:13: Failed to normalize Alias(Free, AliasTy { args: ['{erased}, {type error}], def_id: DefId(0:3 ~ mvce[6541]::ExplicitTypeOutlives), .. }) in typing_env=TypingEnv { typing_mode: Analysis { defining_opaque_types_and_generators: [] }, param_env: ParamEnv { caller_bounds: [] } }, maybe try to call `try_normalize_erasing_regions` instead
thread 'rustc' (408988) panicked at compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:171:13:
Box<dyn Any>
stack backtrace:
0: 0x7f0c0f893323 - <<std[5c7f04eca2c746db]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[e92c6d2b0e153d2a]::fmt::Display>::fmt
1: 0x7f0c10010588 - core[e92c6d2b0e153d2a]::fmt::write
2: 0x7f0c0f8a9a46 - <std[5c7f04eca2c746db]::sys::stdio::unix::Stderr as std[5c7f04eca2c746db]::io::Write>::write_fmt
3: 0x7f0c0f869ae8 - std[5c7f04eca2c746db]::panicking::default_hook::{closure#0}
4: 0x7f0c0f8871f3 - std[5c7f04eca2c746db]::panicking::default_hook
5: 0x7f0c0e8e2367 - std[5c7f04eca2c746db]::panicking::update_hook::<alloc[2f4c348958231a6d]::boxed::Box<rustc_driver_impl[ff53cc85d4fe2831]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f0c0f8874d2 - std[5c7f04eca2c746db]::panicking::panic_with_hook
7: 0x7f0c0e91eb01 - std[5c7f04eca2c746db]::panicking::begin_panic::<rustc_errors[12eb4000f9addf8c]::ExplicitBug>::{closure#0}
8: 0x7f0c0e90f026 - std[5c7f04eca2c746db]::sys::backtrace::__rust_end_short_backtrace::<std[5c7f04eca2c746db]::panicking::begin_panic<rustc_errors[12eb4000f9addf8c]::ExplicitBug>::{closure#0}, !>
9: 0x7f0c0e90c69a - std[5c7f04eca2c746db]::panicking::begin_panic::<rustc_errors[12eb4000f9addf8c]::ExplicitBug>
10: 0x7f0c0e93c201 - <rustc_errors[12eb4000f9addf8c]::diagnostic::BugAbort as rustc_errors[12eb4000f9addf8c]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
11: 0x7f0c0eea7129 - rustc_middle[10f0ae36f3f57be5]::util::bug::opt_span_bug_fmt::<rustc_span[35783d68e4343c6b]::span_encoding::Span>::{closure#0}
12: 0x7f0c0eea72b2 - rustc_middle[10f0ae36f3f57be5]::ty::context::tls::with_opt::<rustc_middle[10f0ae36f3f57be5]::util::bug::opt_span_bug_fmt<rustc_span[35783d68e4343c6b]::span_encoding::Span>::{closure#0}, !>::{closure#0}
13: 0x7f0c0ee9858b - rustc_middle[10f0ae36f3f57be5]::ty::context::tls::with_context_opt::<rustc_middle[10f0ae36f3f57be5]::ty::context::tls::with_opt<rustc_middle[10f0ae36f3f57be5]::util::bug::opt_span_bug_fmt<rustc_span[35783d68e4343c6b]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
14: 0x7f0c0d77b194 - rustc_middle[10f0ae36f3f57be5]::util::bug::bug_fmt
15: 0x7f0c10058b7d - <rustc_middle[10f0ae36f3f57be5]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_type_ir[85c3acd7cc324286]::fold::TypeFolder<rustc_middle[10f0ae36f3f57be5]::ty::context::TyCtxt>>::fold_ty
16: 0x7f0c0ec0f895 - <rustc_middle[10f0ae36f3f57be5]::ty::Ty>::has_significant_drop
17: 0x7f0c0ec04392 - <rustc_hir_typeck[fb855dcd9b6ed24e]::fn_ctxt::FnCtxt>::has_significant_drop_outside_of_captures
18: 0x7f0c0ec04777 - <rustc_hir_typeck[fb855dcd9b6ed24e]::fn_ctxt::FnCtxt>::has_significant_drop_outside_of_captures
19: 0x7f0c0ec02309 - <rustc_hir_typeck[fb855dcd9b6ed24e]::fn_ctxt::FnCtxt>::perform_2229_migration_analysis
20: 0x7f0c109129e7 - <rustc_hir_typeck[fb855dcd9b6ed24e]::fn_ctxt::FnCtxt>::analyze_closure
21: 0x7f0c103414d6 - <rustc_hir_typeck[fb855dcd9b6ed24e]::upvar::InferBorrowKindVisitor as rustc_hir[74c63b4d46dabc83]::intravisit::Visitor>::visit_expr
22: 0x7f0c10341355 - <rustc_hir_typeck[fb855dcd9b6ed24e]::upvar::InferBorrowKindVisitor as rustc_hir[74c63b4d46dabc83]::intravisit::Visitor>::visit_block
23: 0x7f0c10341326 - <rustc_hir_typeck[fb855dcd9b6ed24e]::upvar::InferBorrowKindVisitor as rustc_hir[74c63b4d46dabc83]::intravisit::Visitor>::visit_block
24: 0x7f0c10c8502f - rustc_hir_typeck[fb855dcd9b6ed24e]::typeck_with_inspect::{closure#0}
25: 0x7f0c10c8340c - rustc_query_impl[6aae0acf4e13669d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6aae0acf4e13669d]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[10f0ae36f3f57be5]::query::erase::Erased<[u8; 8usize]>>
26: 0x7f0c1027ea37 - rustc_query_system[fa4efcfe010df873]::query::plumbing::try_execute_query::<rustc_query_impl[6aae0acf4e13669d]::DynamicConfig<rustc_data_structures[73134daec9aace99]::vec_cache::VecCache<rustc_span[35783d68e4343c6b]::def_id::LocalDefId, rustc_middle[10f0ae36f3f57be5]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[fa4efcfe010df873]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[6aae0acf4e13669d]::plumbing::QueryCtxt, false>
27: 0x7f0c1027e309 - rustc_query_impl[6aae0acf4e13669d]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
28: 0x7f0c10a4c331 - <rustc_middle[10f0ae36f3f57be5]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[17be6d7467a2287]::check_crate::{closure#2}>::{closure#0}
29: 0x7f0c10a4bd43 - rustc_hir_analysis[17be6d7467a2287]::check_crate
30: 0x7f0c102782cb - rustc_interface[e1658ef693222f0e]::passes::analysis
31: 0x7f0c10277f91 - rustc_query_impl[6aae0acf4e13669d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6aae0acf4e13669d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[10f0ae36f3f57be5]::query::erase::Erased<[u8; 0usize]>>
32: 0x7f0c111609e0 - rustc_query_system[fa4efcfe010df873]::query::plumbing::try_execute_query::<rustc_query_impl[6aae0acf4e13669d]::DynamicConfig<rustc_query_system[fa4efcfe010df873]::query::caches::SingleCache<rustc_middle[10f0ae36f3f57be5]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[6aae0acf4e13669d]::plumbing::QueryCtxt, false>
33: 0x7f0c11160636 - rustc_query_impl[6aae0acf4e13669d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
34: 0x7f0c11302fd3 - <rustc_interface[e1658ef693222f0e]::passes::create_and_enter_global_ctxt<core[e92c6d2b0e153d2a]::option::Option<rustc_interface[e1658ef693222f0e]::queries::Linker>, rustc_driver_impl[ff53cc85d4fe2831]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[e92c6d2b0e153d2a]::ops::function::FnOnce<(&rustc_session[8a50b1a7e7ccb86f]::session::Session, rustc_middle[10f0ae36f3f57be5]::ty::context::CurrentGcx, alloc[2f4c348958231a6d]::sync::Arc<rustc_data_structures[73134daec9aace99]::jobserver::Proxy>, &std[5c7f04eca2c746db]::sync::once_lock::OnceLock<rustc_middle[10f0ae36f3f57be5]::ty::context::GlobalCtxt>, &rustc_data_structures[73134daec9aace99]::sync::worker_local::WorkerLocal<rustc_middle[10f0ae36f3f57be5]::arena::Arena>, &rustc_data_structures[73134daec9aace99]::sync::worker_local::WorkerLocal<rustc_hir[74c63b4d46dabc83]::Arena>, rustc_driver_impl[ff53cc85d4fe2831]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
35: 0x7f0c110a7005 - rustc_interface[e1658ef693222f0e]::interface::run_compiler::<(), rustc_driver_impl[ff53cc85d4fe2831]::run_compiler::{closure#0}>::{closure#1}
36: 0x7f0c1111604a - std[5c7f04eca2c746db]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e1658ef693222f0e]::util::run_in_thread_with_globals<rustc_interface[e1658ef693222f0e]::util::run_in_thread_pool_with_globals<rustc_interface[e1658ef693222f0e]::interface::run_compiler<(), rustc_driver_impl[ff53cc85d4fe2831]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
37: 0x7f0c11115e1d - <std[5c7f04eca2c746db]::thread::lifecycle::spawn_unchecked<rustc_interface[e1658ef693222f0e]::util::run_in_thread_with_globals<rustc_interface[e1658ef693222f0e]::util::run_in_thread_pool_with_globals<rustc_interface[e1658ef693222f0e]::interface::run_compiler<(), rustc_driver_impl[ff53cc85d4fe2831]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e92c6d2b0e153d2a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
38: 0x7f0c11113f38 - <std[5c7f04eca2c746db]::sys::thread::unix::Thread>::new::thread_start
39: 0x7f0c0aa969cb - <unknown>
40: 0x7f0c0ab1aa0c - <unknown>
41: 0x0 - <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: please make sure that you have updated to the latest nightly
note: rustc 1.94.0-nightly (fa1f706fb 2025-12-07) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z dump-mir-dir=dir
query stack during panic:
#0 [typeck] type-checking `test`
#1 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0106, E0107, E0601.
For more information about an error, try `rustc --explain E0106`.
@rustbot label +F-lazy_type_alias
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️L-rust_2021_incompatible_closure_capturesLint: rust_2021_incompatible_closure_capturesLint: rust_2021_incompatible_closure_capturesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.