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: escaping late-bound region during canonicalization with lifetime-generic TAIT #103666

Closed
Jules-Bertholet opened this issue Oct 28, 2022 · 2 comments
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. 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

@Jules-Bertholet
Copy link
Contributor

Code

#![feature(type_alias_impl_trait)]

type Tait<'b> = impl Sized;

fn foo(f: &dyn Fn(Tait)) {}

Meta

Version:

1.66.0-nightly
(2022-10-26 1898c34e923bad763e72)

Error output

error: internal compiler error: compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:351:21: escaping late-bound region during canonicalization

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/compiler/rustc_errors/src/lib.rs:1519:9
stack backtrace:
   0:     0x7f76f6c6a160 - std::backtrace_rs::backtrace::libunwind::trace::h335cb7d284210dcd
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f76f6c6a160 - std::backtrace_rs::backtrace::trace_unsynchronized::h96bebe31884696aa
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f76f6c6a160 - std::sys_common::backtrace::_print_fmt::h3a966776806a5901
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f76f6c6a160 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9873151158634bfb
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f76f2ded7ae - core::fmt::write::h76f1dd707576780a
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/core/src/fmt/mod.rs:1209:17
   5:     0x7f76f6c5de15 - std::io::Write::write_fmt::h92487d1ebc53913c
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/io/mod.rs:1682:15
   6:     0x7f76f6c69f25 - std::sys_common::backtrace::_print::hb4e235864fa298b0
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f76f6c69f25 - std::sys_common::backtrace::print::h653f44b23a413cb5
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f76f6c6c27f - std::panicking::default_hook::{{closure}}::hc9092a79fd9e0703
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/panicking.rs:267:22
   9:     0x7f76f6c6bfba - std::panicking::default_hook::h2a487c86ebeb8ba4
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/panicking.rs:286:9
  10:     0x7f76f5f2be64 - <rustc_driver[3a9e58a752c57e0a]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[731c476bbe2eb77e]::ops::function::FnOnce<(&core[731c476bbe2eb77e]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f76f6c6ca69 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hcab349cf6232f449
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/alloc/src/boxed.rs:2001:9
  12:     0x7f76f6c6ca69 - std::panicking::rust_panic_with_hook::hb9a0a3528b1a00c5
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/panicking.rs:692:13
  13:     0x7f76f63c1891 - std[fe5f4c1edace479]::panicking::begin_panic::<rustc_errors[a667d3b760aec769]::ExplicitBug>::{closure#0}
  14:     0x7f76f63be386 - std[fe5f4c1edace479]::sys_common::backtrace::__rust_end_short_backtrace::<std[fe5f4c1edace479]::panicking::begin_panic<rustc_errors[a667d3b760aec769]::ExplicitBug>::{closure#0}, !>
  15:     0x7f76f63bcfa6 - std[fe5f4c1edace479]::panicking::begin_panic::<rustc_errors[a667d3b760aec769]::ExplicitBug>
  16:     0x7f76f63551f6 - std[fe5f4c1edace479]::panic::panic_any::<rustc_errors[a667d3b760aec769]::ExplicitBug>
  17:     0x7f76f635510d - <rustc_errors[a667d3b760aec769]::HandlerInner>::bug::<&alloc[a0d4246b74acabb6]::string::String>
  18:     0x7f76f6354b80 - <rustc_errors[a667d3b760aec769]::Handler>::bug::<&alloc[a0d4246b74acabb6]::string::String>
  19:     0x7f76f6406985 - rustc_middle[25dd0db25d9b6162]::ty::context::tls::with_context_opt::<rustc_middle[25dd0db25d9b6162]::ty::context::tls::with_opt<rustc_middle[25dd0db25d9b6162]::util::bug::opt_span_bug_fmt<rustc_span[882156c2b67f5204]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  20:     0x7f76f6406cc6 - rustc_middle[25dd0db25d9b6162]::util::bug::opt_span_bug_fmt::<rustc_span[882156c2b67f5204]::span_encoding::Span>
  21:     0x7f76f41bba93 - rustc_middle[25dd0db25d9b6162]::util::bug::bug_fmt
  22:     0x7f76f40a319e - <rustc_infer[84debb9d2c0822d1]::infer::canonical::canonicalizer::Canonicalizer as rustc_middle[25dd0db25d9b6162]::ty::fold::TypeFolder>::fold_region
  23:     0x7f76f5182f69 - <&rustc_middle[25dd0db25d9b6162]::ty::list::List<rustc_middle[25dd0db25d9b6162]::ty::subst::GenericArg> as rustc_middle[25dd0db25d9b6162]::ty::fold::TypeFoldable>::try_fold_with::<rustc_infer[84debb9d2c0822d1]::infer::canonical::canonicalizer::Canonicalizer>
  24:     0x7f76f51607f0 - <rustc_middle[25dd0db25d9b6162]::infer::canonical::QueryResponse<alloc[a0d4246b74acabb6]::vec::Vec<rustc_middle[25dd0db25d9b6162]::traits::query::OutlivesBound>> as rustc_middle[25dd0db25d9b6162]::ty::fold::TypeFoldable>::fold_with::<rustc_infer[84debb9d2c0822d1]::infer::canonical::canonicalizer::Canonicalizer>
  25:     0x7f76f4c9dc6f - <rustc_infer[84debb9d2c0822d1]::infer::InferCtxtBuilder as rustc_trait_selection[7f17b2023115ca83]::infer::InferCtxtBuilderExt>::enter_canonical_trait_query::<rustc_middle[25dd0db25d9b6162]::ty::ParamEnvAnd<rustc_middle[25dd0db25d9b6162]::ty::Ty>, alloc[a0d4246b74acabb6]::vec::Vec<rustc_middle[25dd0db25d9b6162]::traits::query::OutlivesBound>, rustc_traits[1f9741b68d8bb0df]::implied_outlives_bounds::implied_outlives_bounds::{closure#0}>
  26:     0x7f76f50e1530 - rustc_query_system[2ce74b9538bccb8f]::query::plumbing::try_execute_query::<rustc_query_impl[1922eb72fec2b651]::plumbing::QueryCtxt, rustc_query_system[2ce74b9538bccb8f]::query::caches::DefaultCache<rustc_middle[25dd0db25d9b6162]::infer::canonical::Canonical<rustc_middle[25dd0db25d9b6162]::ty::ParamEnvAnd<rustc_middle[25dd0db25d9b6162]::ty::Ty>>, core[731c476bbe2eb77e]::result::Result<&rustc_middle[25dd0db25d9b6162]::infer::canonical::Canonical<rustc_middle[25dd0db25d9b6162]::infer::canonical::QueryResponse<alloc[a0d4246b74acabb6]::vec::Vec<rustc_middle[25dd0db25d9b6162]::traits::query::OutlivesBound>>>, rustc_middle[25dd0db25d9b6162]::traits::query::NoSolution>>>
  27:     0x7f76f4533cb9 - <rustc_trait_selection[7f17b2023115ca83]::traits::query::type_op::implied_outlives_bounds::ImpliedOutlivesBounds as rustc_trait_selection[7f17b2023115ca83]::traits::query::type_op::QueryTypeOp>::fully_perform_into
  28:     0x7f76f4c382c2 - <rustc_infer[84debb9d2c0822d1]::infer::outlives::env::OutlivesEnvironment>::with_bounds::<core[731c476bbe2eb77e]::iter::adapters::flatten::Flatten<core[731c476bbe2eb77e]::iter::adapters::map::Map<std[fe5f4c1edace479]::collections::hash::set::IntoIter<rustc_middle[25dd0db25d9b6162]::ty::Ty>, <rustc_infer[84debb9d2c0822d1]::infer::InferCtxt as rustc_trait_selection[7f17b2023115ca83]::traits::outlives_bounds::InferCtxtExt>::implied_bounds_tys::{closure#0}>>>
  29:     0x7f76f4c317b3 - rustc_hir_analysis[365bb067b141719f]::check::wfcheck::check_item_fn
  30:     0x7f76f4c29306 - rustc_hir_analysis[365bb067b141719f]::check::wfcheck::check_well_formed
  31:     0x7f76f415f5f5 - rustc_query_system[2ce74b9538bccb8f]::query::plumbing::get_query::<rustc_query_impl[1922eb72fec2b651]::queries::check_well_formed, rustc_query_impl[1922eb72fec2b651]::plumbing::QueryCtxt>
  32:     0x7f76f5428d09 - rustc_data_structures[a2db8ee2a835d2c8]::sync::par_for_each_in::<&[rustc_hir[12b882f0377fe91d]::hir::ItemId], <rustc_middle[25dd0db25d9b6162]::hir::ModuleItems>::par_items<rustc_hir_analysis[365bb067b141719f]::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
  33:     0x7f76f586d161 - rustc_hir_analysis[365bb067b141719f]::check::wfcheck::check_mod_type_wf
  34:     0x7f76f47f2878 - rustc_query_system[2ce74b9538bccb8f]::query::plumbing::try_execute_query::<rustc_query_impl[1922eb72fec2b651]::plumbing::QueryCtxt, rustc_query_system[2ce74b9538bccb8f]::query::caches::DefaultCache<rustc_span[882156c2b67f5204]::def_id::LocalDefId, ()>>
  35:     0x7f76f53b3f79 - rustc_query_system[2ce74b9538bccb8f]::query::plumbing::get_query::<rustc_query_impl[1922eb72fec2b651]::queries::check_mod_type_wf, rustc_query_impl[1922eb72fec2b651]::plumbing::QueryCtxt>
  36:     0x7f76f437b798 - rustc_data_structures[a2db8ee2a835d2c8]::sync::par_for_each_in::<&[rustc_hir[12b882f0377fe91d]::hir_id::OwnerId], <rustc_middle[25dd0db25d9b6162]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[365bb067b141719f]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
  37:     0x7f76f437b5b3 - <rustc_session[918d7b2bbd2629cb]::session::Session>::track_errors::<rustc_hir_analysis[365bb067b141719f]::check_crate::{closure#5}, ()>
  38:     0x7f76f437ace1 - rustc_hir_analysis[365bb067b141719f]::check_crate
  39:     0x7f76f437a98b - rustc_interface[38d8e7298dc9bf29]::passes::analysis
  40:     0x7f76f576ef54 - rustc_query_system[2ce74b9538bccb8f]::query::plumbing::try_execute_query::<rustc_query_impl[1922eb72fec2b651]::plumbing::QueryCtxt, rustc_query_system[2ce74b9538bccb8f]::query::caches::DefaultCache<(), core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>>>
  41:     0x7f76f576ec57 - rustc_query_system[2ce74b9538bccb8f]::query::plumbing::get_query::<rustc_query_impl[1922eb72fec2b651]::queries::analysis, rustc_query_impl[1922eb72fec2b651]::plumbing::QueryCtxt>
  42:     0x7f76f52a036d - <rustc_interface[38d8e7298dc9bf29]::passes::QueryContext>::enter::<rustc_driver[3a9e58a752c57e0a]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>>
  43:     0x7f76f529c92f - <rustc_interface[38d8e7298dc9bf29]::interface::Compiler>::enter::<rustc_driver[3a9e58a752c57e0a]::run_compiler::{closure#1}::{closure#2}, core[731c476bbe2eb77e]::result::Result<core[731c476bbe2eb77e]::option::Option<rustc_interface[38d8e7298dc9bf29]::queries::Linker>, rustc_errors[a667d3b760aec769]::ErrorGuaranteed>>
  44:     0x7f76f5294472 - rustc_span[882156c2b67f5204]::with_source_map::<core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>, rustc_interface[38d8e7298dc9bf29]::interface::run_compiler<core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>, rustc_driver[3a9e58a752c57e0a]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  45:     0x7f76f5293f69 - <scoped_tls[f319009629b0a1b4]::ScopedKey<rustc_span[882156c2b67f5204]::SessionGlobals>>::set::<rustc_interface[38d8e7298dc9bf29]::interface::run_compiler<core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>, rustc_driver[3a9e58a752c57e0a]::run_compiler::{closure#1}>::{closure#0}, core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>>
  46:     0x7f76f5293578 - std[fe5f4c1edace479]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[38d8e7298dc9bf29]::util::run_in_thread_pool_with_globals<rustc_interface[38d8e7298dc9bf29]::interface::run_compiler<core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>, rustc_driver[3a9e58a752c57e0a]::run_compiler::{closure#1}>::{closure#0}, core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>>
  47:     0x7f76f529329c - <<std[fe5f4c1edace479]::thread::Builder>::spawn_unchecked_<rustc_interface[38d8e7298dc9bf29]::util::run_in_thread_pool_with_globals<rustc_interface[38d8e7298dc9bf29]::interface::run_compiler<core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>, rustc_driver[3a9e58a752c57e0a]::run_compiler::{closure#1}>::{closure#0}, core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[731c476bbe2eb77e]::result::Result<(), rustc_errors[a667d3b760aec769]::ErrorGuaranteed>>::{closure#1} as core[731c476bbe2eb77e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:     0x7f76f6c739d3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5b00bc9defbef88c
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/alloc/src/boxed.rs:1987:9
  49:     0x7f76f6c739d3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc3b726dad8143273
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/alloc/src/boxed.rs:1987:9
  50:     0x7f76f6c739d3 - std::sys::unix::thread::Thread::new::thread_start::hf9c71b7d57dac377
                               at /rustc/1898c34e923bad763e723c68dd9f23a09f9eb0fc/library/std/src/sys/unix/thread.rs:108:17
  51:     0x7f76f2c70609 - start_thread
  52:     0x7f76f2b93133 - clone
  53:                0x0 - <unknown>

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.66.0-nightly (1898c34e9 2022-10-26) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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

query stack during panic:
#0 [implied_outlives_bounds] computing implied outlives bounds for `&dyn for<'a> core::ops::function::Fn(Tait<'a>)`
#1 [check_well_formed] checking that `foo` is well-formed
#2 [check_mod_type_wf] checking that types are well-formed in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
@Jules-Bertholet Jules-Bertholet 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 Oct 28, 2022
@Rageking8
Copy link
Contributor

@rustbot label +F-type_alias_impl_trait

@Alexendoo
Copy link
Member

Fixed by #106910

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. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. 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

5 participants