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: bound types encountered in super_relate_tys non_lifetime_binders #108190

Closed
matthiaskrgr opened this issue Feb 17, 2023 · 1 comment · Fixed by #108202
Closed

ICE: bound types encountered in super_relate_tys non_lifetime_binders #108190

matthiaskrgr opened this issue Feb 17, 2023 · 1 comment · Fixed by #108202
Assignees
Labels
C-bug Category: This is a bug. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` 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

@matthiaskrgr
Copy link
Member

Code

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

trait Trait<Input> {
    type Output;
}

async fn walk2<F: 'a>(filter: F)
where
    for<F> F: Trait<&'a u32> + 'a,
{}

fn main() {}

Meta

rustc --version --verbose:

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

Error output

error[E0670]: `async fn` is not permitted in Rust 2015
 --> /tmp/im/2ec83234343195293d1cafeb6c8dd3911c99ba01.rs:8:1
  |
8 | async fn walk2<F: 'a>(filter: F)
  | ^^^^^ to use `async fn`, switch to Rust 2018 or later
  |
  = help: pass `--edition 2021` to `rustc`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0261]: use of undeclared lifetime name `'a`
 --> /tmp/im/2ec83234343195293d1cafeb6c8dd3911c99ba01.rs:8:19
  |
8 | async fn walk2<F: 'a>(filter: F)
  |                -  ^^ undeclared lifetime
  |                |
  |                help: consider introducing lifetime `'a` here: `'a,`

error[E0261]: use of undeclared lifetime name `'a`
  --> /tmp/im/2ec83234343195293d1cafeb6c8dd3911c99ba01.rs:10:22
   |
10 |     for<F> F: Trait<&'a u32> + 'a,
   |                      ^^ undeclared lifetime
   |
   = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
   |
10 |     for<F> F: for<'a> Trait<&'a u32> + 'a,
   |               +++++++
help: consider making the bound lifetime-generic with a new `'a` lifetime
   |
10 |     for<'a, F> F: Trait<&'a u32> + 'a,
   |         +++
help: consider introducing lifetime `'a` here
   |
8  | async fn walk2<'a, F: 'a>(filter: F)
   |                +++

error[E0261]: use of undeclared lifetime name `'a`
  --> /tmp/im/2ec83234343195293d1cafeb6c8dd3911c99ba01.rs:10:32
   |
10 |     for<F> F: Trait<&'a u32> + 'a,
   |                                ^^ undeclared lifetime
   |
help: consider making the bound lifetime-generic with a new `'a` lifetime
   |
10 |     for<'a, F> F: Trait<&'a u32> + 'a,
   |         +++
help: consider introducing lifetime `'a` here
   |
8  | async fn walk2<'a, F: 'a>(filter: F)
   |                +++

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/im/2ec83234343195293d1cafeb6c8dd3911c99ba01.rs:1:12
  |
1 | #![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
Backtrace

error: internal compiler error: /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/compiler/rustc_middle/src/ty/relate.rs:412:13: bound types encountered in super_relate_tys

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/compiler/rustc_errors/src/lib.rs:1642:9
stack backtrace:
   0:     0x7f36b496aa5a - std::backtrace_rs::backtrace::libunwind::trace::hf4a48a91b677bc8d
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f36b496aa5a - std::backtrace_rs::backtrace::trace_unsynchronized::h52302266f2c9e2af
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f36b496aa5a - std::sys_common::backtrace::_print_fmt::h00aaca457620efb0
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f36b496aa5a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6d9f10455e422cbd
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f36b49ca9ae - core::fmt::write::h065585aa0e682316
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/core/src/fmt/mod.rs:1232:17
   5:     0x7f36b495ae05 - std::io::Write::write_fmt::h54937c0abd9a719d
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/std/src/io/mod.rs:1684:15
   6:     0x7f36b496a825 - std::sys_common::backtrace::_print::h0141838be2b7fc59
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f36b496a825 - std::sys_common::backtrace::print::h422705047959e0cf
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f36b496d59f - std::panicking::default_hook::{{closure}}::h04c227824228bc2c
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/std/src/panicking.rs:267:22
   9:     0x7f36b496d2db - std::panicking::default_hook::h1a17cdb165515d8b
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/std/src/panicking.rs:286:9
  10:     0x7f36b7c60224 - rustc_driver_impl[9b756e32c0d38789]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f36b496dddd - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7593a5eec671dafe
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/alloc/src/boxed.rs:2002:9
  12:     0x7f36b496dddd - std::panicking::rust_panic_with_hook::h815681ed9ae37db1
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/std/src/panicking.rs:692:13
  13:     0x7f36b821c361 - std[92d2792449a90a80]::panicking::begin_panic::<rustc_errors[c2c7aee1e156d1f6]::ExplicitBug>::{closure#0}
  14:     0x7f36b8213fd6 - std[92d2792449a90a80]::sys_common::backtrace::__rust_end_short_backtrace::<std[92d2792449a90a80]::panicking::begin_panic<rustc_errors[c2c7aee1e156d1f6]::ExplicitBug>::{closure#0}, !>
  15:     0x7f36b816d676 - std[92d2792449a90a80]::panicking::begin_panic::<rustc_errors[c2c7aee1e156d1f6]::ExplicitBug>
  16:     0x7f36b82128d6 - std[92d2792449a90a80]::panic::panic_any::<rustc_errors[c2c7aee1e156d1f6]::ExplicitBug>
  17:     0x7f36b82127c6 - <rustc_errors[c2c7aee1e156d1f6]::HandlerInner>::bug::<&alloc[77fdffdb8c1c6cb]::string::String>
  18:     0x7f36b8212490 - <rustc_errors[c2c7aee1e156d1f6]::Handler>::bug::<&alloc[77fdffdb8c1c6cb]::string::String>
  19:     0x7f36b827972b - rustc_middle[b5631d71f72482ee]::util::bug::opt_span_bug_fmt::<rustc_span[65551fbbac8b0f76]::span_encoding::Span>::{closure#0}
  20:     0x7f36b8278eea - rustc_middle[b5631d71f72482ee]::ty::context::tls::with_opt::<rustc_middle[b5631d71f72482ee]::util::bug::opt_span_bug_fmt<rustc_span[65551fbbac8b0f76]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f36b8278eb6 - rustc_middle[b5631d71f72482ee]::ty::context::tls::with_context_opt::<rustc_middle[b5631d71f72482ee]::ty::context::tls::with_opt<rustc_middle[b5631d71f72482ee]::util::bug::opt_span_bug_fmt<rustc_span[65551fbbac8b0f76]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f36b8279676 - rustc_middle[b5631d71f72482ee]::util::bug::opt_span_bug_fmt::<rustc_span[65551fbbac8b0f76]::span_encoding::Span>
  23:     0x7f36b5f35973 - rustc_middle[b5631d71f72482ee]::util::bug::bug_fmt
  24:     0x7f36b6524b03 - rustc_middle[b5631d71f72482ee]::ty::relate::super_relate_tys::<rustc_infer[e7333a217508eb8e]::infer::outlives::test_type_match::Match>
  25:     0x7f36b65246d0 - rustc_infer[e7333a217508eb8e]::infer::outlives::test_type_match::can_match_erased_ty
  26:     0x7f36b6521fae - <rustc_infer[e7333a217508eb8e]::infer::outlives::verify::VerifyBoundCx>::declared_generic_bounds_from_env_for_erased_ty
  27:     0x7f36b651af7b - <rustc_infer[e7333a217508eb8e]::infer::outlives::obligations::TypeOutlives<&mut rustc_borrowck[2bd7762540f7a794]::type_check::constraint_conversion::ConstraintConversion>>::components_must_outlive
  28:     0x7f36b6c2445a - <rustc_borrowck[2bd7762540f7a794]::type_check::constraint_conversion::ConstraintConversion>::convert_all
  29:     0x7f36b6c071d3 - <rustc_borrowck[2bd7762540f7a794]::type_check::TypeChecker>::typeck_mir
  30:     0x7f36b6b79dbf - rustc_borrowck[2bd7762540f7a794]::nll::compute_regions
  31:     0x7f36b6b4ba3c - rustc_borrowck[2bd7762540f7a794]::do_mir_borrowck
  32:     0x7f36b6b38458 - rustc_borrowck[2bd7762540f7a794]::mir_borrowck
  33:     0x7f36b65bfb6b - rustc_query_system[2b3be6912aef78d5]::query::plumbing::try_execute_query::<rustc_query_impl[a3402ef8368c6710]::queries::mir_borrowck, rustc_query_impl[a3402ef8368c6710]::plumbing::QueryCtxt>
  34:     0x7f36b765bd3d - <rustc_query_impl[a3402ef8368c6710]::Queries as rustc_middle[b5631d71f72482ee]::ty::query::QueryEngine>::mir_borrowck
  35:     0x7f36b71cf5e2 - rustc_hir_analysis[90a2d534158d44df]::collect::type_of::type_of
  36:     0x7f36b66c0ad1 - rustc_query_system[2b3be6912aef78d5]::query::plumbing::get_query::<rustc_query_impl[a3402ef8368c6710]::queries::type_of, rustc_query_impl[a3402ef8368c6710]::plumbing::QueryCtxt, rustc_middle[b5631d71f72482ee]::dep_graph::dep_node::DepKind>
  37:     0x7f36b65c5314 - rustc_hir_analysis[90a2d534158d44df]::check::check::check_mod_item_types
  38:     0x7f36b722229f - rustc_query_system[2b3be6912aef78d5]::query::plumbing::try_execute_query::<rustc_query_impl[a3402ef8368c6710]::queries::check_mod_item_types, rustc_query_impl[a3402ef8368c6710]::plumbing::QueryCtxt>
  39:     0x7f36b765b32d - <rustc_query_impl[a3402ef8368c6710]::Queries as rustc_middle[b5631d71f72482ee]::ty::query::QueryEngine>::check_mod_item_types
  40:     0x7f36b610781d - <rustc_middle[b5631d71f72482ee]::hir::map::Map>::for_each_module::<rustc_hir_analysis[90a2d534158d44df]::check_crate::{closure#6}::{closure#0}>
  41:     0x7f36b61052ad - rustc_hir_analysis[90a2d534158d44df]::check_crate
  42:     0x7f36b60fad72 - rustc_interface[828b714f964ce1da]::passes::analysis
  43:     0x7f36b744d4f2 - rustc_query_system[2b3be6912aef78d5]::query::plumbing::try_execute_query::<rustc_query_impl[a3402ef8368c6710]::queries::analysis, rustc_query_impl[a3402ef8368c6710]::plumbing::QueryCtxt>
  44:     0x7f36b76550fa - <rustc_query_impl[a3402ef8368c6710]::Queries as rustc_middle[b5631d71f72482ee]::ty::query::QueryEngine>::analysis
  45:     0x7f36b6e75a23 - <rustc_interface[828b714f964ce1da]::queries::QueryResult<&rustc_middle[b5631d71f72482ee]::ty::context::GlobalCtxt>>::enter::<core[d0f7fc72c0be1fb4]::result::Result<(), rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>, rustc_driver_impl[9b756e32c0d38789]::run_compiler::{closure#1}::{closure#2}::{closure#3}>
  46:     0x7f36b6e74bf4 - <rustc_interface[828b714f964ce1da]::interface::Compiler>::enter::<rustc_driver_impl[9b756e32c0d38789]::run_compiler::{closure#1}::{closure#2}, core[d0f7fc72c0be1fb4]::result::Result<core[d0f7fc72c0be1fb4]::option::Option<rustc_interface[828b714f964ce1da]::queries::Linker>, rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>>
  47:     0x7f36b6e6fe14 - rustc_span[65551fbbac8b0f76]::with_source_map::<core[d0f7fc72c0be1fb4]::result::Result<(), rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>, rustc_interface[828b714f964ce1da]::interface::run_compiler<core[d0f7fc72c0be1fb4]::result::Result<(), rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>, rustc_driver_impl[9b756e32c0d38789]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  48:     0x7f36b6e6f924 - <scoped_tls[18b6b4dd1216e2e8]::ScopedKey<rustc_span[65551fbbac8b0f76]::SessionGlobals>>::set::<rustc_interface[828b714f964ce1da]::interface::run_compiler<core[d0f7fc72c0be1fb4]::result::Result<(), rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>, rustc_driver_impl[9b756e32c0d38789]::run_compiler::{closure#1}>::{closure#0}, core[d0f7fc72c0be1fb4]::result::Result<(), rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>>
  49:     0x7f36b6e6f022 - std[92d2792449a90a80]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[828b714f964ce1da]::util::run_in_thread_pool_with_globals<rustc_interface[828b714f964ce1da]::interface::run_compiler<core[d0f7fc72c0be1fb4]::result::Result<(), rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>, rustc_driver_impl[9b756e32c0d38789]::run_compiler::{closure#1}>::{closure#0}, core[d0f7fc72c0be1fb4]::result::Result<(), rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d0f7fc72c0be1fb4]::result::Result<(), rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>>
  50:     0x7f36b6e6edcc - <<std[92d2792449a90a80]::thread::Builder>::spawn_unchecked_<rustc_interface[828b714f964ce1da]::util::run_in_thread_pool_with_globals<rustc_interface[828b714f964ce1da]::interface::run_compiler<core[d0f7fc72c0be1fb4]::result::Result<(), rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>, rustc_driver_impl[9b756e32c0d38789]::run_compiler::{closure#1}>::{closure#0}, core[d0f7fc72c0be1fb4]::result::Result<(), rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d0f7fc72c0be1fb4]::result::Result<(), rustc_errors[c2c7aee1e156d1f6]::ErrorGuaranteed>>::{closure#1} as core[d0f7fc72c0be1fb4]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x7f36b4977c63 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h24b1cedbd344db9f
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/alloc/src/boxed.rs:1988:9
  52:     0x7f36b4977c63 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb7ac28b0dfacf269
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/alloc/src/boxed.rs:1988:9
  53:     0x7f36b4977c63 - std::sys::unix::thread::Thread::new::thread_start::h67c8d237baa6ad51
                               at /rustc/9aa5c24b7d763fb98d998819571128ff2eb8a3ca/library/std/src/sys/unix/thread.rs:108:17
  54:     0x7f36b4707bb5 - <unknown>
  55:     0x7f36b4789d90 - <unknown>
  56:                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: rustc 1.69.0-nightly (9aa5c24b7 2023-02-17) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `walk2`
#1 [type_of] computing type of `walk2::{opaque#0}`
#2 [check_mod_item_types] checking item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors; 1 warning emitted

Some errors have detailed explanations: E0261, E0670.

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Feb 17, 2023
@compiler-errors
Copy link
Member

compiler-errors commented Feb 17, 2023

Most of the error messages are superfluous, this still ICEs if you use edition 2021 and add a 'a to the generics:

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

async fn walk2<'a, T: 'a>(_: T)
where
    for<F> F: 'a,
{}

fn main() {}

@estebank estebank added the F-non_lifetime_binders `#![feature(non_lifetime_binders)]` label Feb 18, 2023
compiler-errors added a commit to compiler-errors/rust that referenced this issue Feb 21, 2023
…rs-type-match-ice, r=davidtwco

Make sure `test_type_match` doesn't ICE with late-bound types

Fixes rust-lang#108190 (in a kind of hacky way, anyways doesn't really matter)
@bors bors closed this as completed in 8a5843f Feb 22, 2023
@compiler-errors compiler-errors self-assigned this Mar 16, 2023
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-non_lifetime_binders `#![feature(non_lifetime_binders)]` 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

Successfully merging a pull request may close this issue.

3 participants