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: add_outlives_bounds: unexpected regions #113793

Open
matthiaskrgr opened this issue Jul 17, 2023 · 4 comments
Open

ICE: add_outlives_bounds: unexpected regions #113793

matthiaskrgr opened this issue Jul 17, 2023 · 4 comments
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jul 17, 2023

Code

trait Gat {
    type FooArg<'a, 'b: 'b>;
}

impl Gat for () {
    type FooArg<'a, 'b: 'b> = &'a dyn ToString;
}

struct Test;

impl Iterator for Test {
    type Item = Box<dyn Fn(<() as Gat>::FooArg<'_, '_>)>;

    fn next(&mut self) -> Option<Self::Item> { None }
}

pub fn main() {}

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (1a8d09468 2023-07-17)
binary: rustc
commit-hash: 1a8d09468f045d75c5072af0a3e9b23443d484dd
commit-date: 2023-07-17
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Error output

Backtrace

error: internal compiler error: /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/compiler/rustc_infer/src/infer/outlives/env.rs:148:26: add_outlives_bounds: unexpected regions: (RePlaceholder(Placeholder { universe: U3, bound: BoundRegion { var: 1, kind: BrNamed(DefId(0:18 ~ playground[4e9f]::{impl#1}::Item::'_#1), '_) } }), RePlaceholder(Placeholder { universe: U3, bound: BoundRegion { var: 1, kind: BrNamed(DefId(0:18 ~ playground[4e9f]::{impl#1}::Item::'_#1), '_) } }))

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/compiler/rustc_errors/src/lib.rs:1651:9
stack backtrace:
   0:     0x7fb0e822a071 - std::backtrace_rs::backtrace::libunwind::trace::h6aeaf83abc038fe6
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fb0e822a071 - std::backtrace_rs::backtrace::trace_unsynchronized::h4f9875212db0ad97
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb0e822a071 - std::sys_common::backtrace::_print_fmt::h3f820027e9c39d3b
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fb0e822a071 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hded4932df41373b3
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fb0e8289d9f - core::fmt::rt::Argument::fmt::hc8ead7746b2406d6
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/fmt/rt.rs:138:9
   5:     0x7fb0e8289d9f - core::fmt::write::hb1cb56105a082ad9
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fb0e821d271 - std::io::Write::write_fmt::h797fda7085c97e57
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/io/mod.rs:1713:15
   7:     0x7fb0e8229e85 - std::sys_common::backtrace::_print::h492d3c92d7400346
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fb0e8229e85 - std::sys_common::backtrace::print::hf74aa2eef05af215
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fb0e822cb47 - std::panicking::default_hook::{{closure}}::h8cad394227ea3de8
  10:     0x7fb0e822c934 - std::panicking::default_hook::h249cc184fec99a8a
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:288:9
  11:     0x7fb0eb3a9b5b - rustc_driver_impl[55b27a31f76e3fb7]::install_ice_hook::{closure#0}
  12:     0x7fb0e822d28d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0be7fc2421582b49
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/alloc/src/boxed.rs:1999:9
  13:     0x7fb0e822d28d - std::panicking::rust_panic_with_hook::h82ebcd5d5ed2fad4
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:709:13
  14:     0x7fb0eb8b6dc1 - std[a2d7a4c8dd6a1366]::panicking::begin_panic::<rustc_errors[ac1621e430503503]::ExplicitBug>::{closure#0}
  15:     0x7fb0eb8b2b96 - std[a2d7a4c8dd6a1366]::sys_common::backtrace::__rust_end_short_backtrace::<std[a2d7a4c8dd6a1366]::panicking::begin_panic<rustc_errors[ac1621e430503503]::ExplicitBug>::{closure#0}, !>
  16:     0x7fb0eb8aece6 - std[a2d7a4c8dd6a1366]::panicking::begin_panic::<rustc_errors[ac1621e430503503]::ExplicitBug>
  17:     0x7fb0eb8ac204 - <rustc_errors[ac1621e430503503]::HandlerInner>::bug::<alloc[af44278adca4aa3a]::string::String>
  18:     0x7fb0eb8abfa6 - <rustc_errors[ac1621e430503503]::Handler>::bug::<alloc[af44278adca4aa3a]::string::String>
  19:     0x7fb0eb93a92c - rustc_middle[69e8a450f04f22d]::util::bug::opt_span_bug_fmt::<rustc_span[b25f563e2e6d20a1]::span_encoding::Span>::{closure#0}
  20:     0x7fb0eb936ffa - rustc_middle[69e8a450f04f22d]::ty::context::tls::with_opt::<rustc_middle[69e8a450f04f22d]::util::bug::opt_span_bug_fmt<rustc_span[b25f563e2e6d20a1]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fb0eb936fca - rustc_middle[69e8a450f04f22d]::ty::context::tls::with_context_opt::<rustc_middle[69e8a450f04f22d]::ty::context::tls::with_opt<rustc_middle[69e8a450f04f22d]::util::bug::opt_span_bug_fmt<rustc_span[b25f563e2e6d20a1]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fb0e9a7632d - rustc_middle[69e8a450f04f22d]::util::bug::bug_fmt
  23:     0x7fb0e9e096db - <rustc_infer[ab09412129cf3116]::infer::outlives::env::OutlivesEnvironment>::with_bounds::<core[3d2408b9a7974bb]::iter::adapters::flatten::FlatMap<indexmap[35ddfa7bf58f02e4]::set::IntoIter<rustc_middle[69e8a450f04f22d]::ty::Ty>, alloc[af44278adca4aa3a]::vec::Vec<rustc_middle[69e8a450f04f22d]::traits::query::OutlivesBound>, <rustc_infer[ab09412129cf3116]::infer::InferCtxt as rustc_trait_selection[fd75ccd2de8cef13]::traits::outlives_bounds::InferCtxtExt>::implied_bounds_tys::{closure#0}>>
  24:     0x7fb0ea310490 - rustc_hir_analysis[367b7eb6b2106fd1]::check::compare_impl_item::compare_method_predicate_entailment
  25:     0x7fb0ea3065b0 - rustc_hir_analysis[367b7eb6b2106fd1]::check::compare_impl_item::compare_impl_method
  26:     0x7fb0ea2fa9d3 - rustc_hir_analysis[367b7eb6b2106fd1]::check::check::check_mod_item_types
  27:     0x7fb0e9feac5c - rustc_query_impl[9640443f3247e199]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9640443f3247e199]::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[69e8a450f04f22d]::query::erase::Erased<[u8; 0usize]>>
  28:     0x7fb0e9feac3e - <rustc_query_impl[9640443f3247e199]::query_impl::check_mod_item_types::dynamic_query::{closure#2} as core[3d2408b9a7974bb]::ops::function::FnOnce<(rustc_middle[69e8a450f04f22d]::ty::context::TyCtxt, rustc_span[b25f563e2e6d20a1]::def_id::LocalDefId)>>::call_once
  29:     0x7fb0e9b688ef - rustc_query_system[18feb85a2a4aa83f]::query::plumbing::try_execute_query::<rustc_query_impl[9640443f3247e199]::DynamicConfig<rustc_query_system[18feb85a2a4aa83f]::query::caches::VecCache<rustc_span[b25f563e2e6d20a1]::def_id::LocalDefId, rustc_middle[69e8a450f04f22d]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[9640443f3247e199]::plumbing::QueryCtxt, false>
  30:     0x7fb0ead65a14 - rustc_query_impl[9640443f3247e199]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7fb0ea88fdd7 - <rustc_middle[69e8a450f04f22d]::hir::map::Map>::for_each_module::<rustc_hir_analysis[367b7eb6b2106fd1]::check_crate::{closure#6}::{closure#0}>
  32:     0x7fb0ea88f20d - <rustc_session[3eaa31a6c81d371]::session::Session>::time::<(), rustc_hir_analysis[367b7eb6b2106fd1]::check_crate::{closure#6}>
  33:     0x7fb0ea88d247 - rustc_hir_analysis[367b7eb6b2106fd1]::check_crate
  34:     0x7fb0ea88843d - rustc_interface[2ac6857faa489841]::passes::analysis
  35:     0x7fb0ea8c624a - rustc_query_impl[9640443f3247e199]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9640443f3247e199]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[69e8a450f04f22d]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7fb0ea8c6239 - <rustc_query_impl[9640443f3247e199]::query_impl::analysis::dynamic_query::{closure#2} as core[3d2408b9a7974bb]::ops::function::FnOnce<(rustc_middle[69e8a450f04f22d]::ty::context::TyCtxt, ())>>::call_once
  37:     0x7fb0eaa7b8e8 - rustc_query_system[18feb85a2a4aa83f]::query::plumbing::try_execute_query::<rustc_query_impl[9640443f3247e199]::DynamicConfig<rustc_query_system[18feb85a2a4aa83f]::query::caches::SingleCache<rustc_middle[69e8a450f04f22d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[9640443f3247e199]::plumbing::QueryCtxt, false>
  38:     0x7fb0eaa7b6b9 - rustc_query_impl[9640443f3247e199]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7fb0ea632f22 - <rustc_interface[2ac6857faa489841]::queries::QueryResult<&rustc_middle[69e8a450f04f22d]::ty::context::GlobalCtxt>>::enter::<core[3d2408b9a7974bb]::result::Result<(), rustc_span[b25f563e2e6d20a1]::ErrorGuaranteed>, rustc_driver_impl[55b27a31f76e3fb7]::run_compiler::{closure#1}::{closure#2}::{closure#4}>
  40:     0x7fb0ea631e85 - <rustc_interface[2ac6857faa489841]::interface::Compiler>::enter::<rustc_driver_impl[55b27a31f76e3fb7]::run_compiler::{closure#1}::{closure#2}, core[3d2408b9a7974bb]::result::Result<core[3d2408b9a7974bb]::option::Option<rustc_interface[2ac6857faa489841]::queries::Linker>, rustc_span[b25f563e2e6d20a1]::ErrorGuaranteed>>
  41:     0x7fb0ea62f683 - std[a2d7a4c8dd6a1366]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2ac6857faa489841]::util::run_in_thread_pool_with_globals<rustc_interface[2ac6857faa489841]::interface::run_compiler<core[3d2408b9a7974bb]::result::Result<(), rustc_span[b25f563e2e6d20a1]::ErrorGuaranteed>, rustc_driver_impl[55b27a31f76e3fb7]::run_compiler::{closure#1}>::{closure#0}, core[3d2408b9a7974bb]::result::Result<(), rustc_span[b25f563e2e6d20a1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3d2408b9a7974bb]::result::Result<(), rustc_span[b25f563e2e6d20a1]::ErrorGuaranteed>>
  42:     0x7fb0eac5b165 - <<std[a2d7a4c8dd6a1366]::thread::Builder>::spawn_unchecked_<rustc_interface[2ac6857faa489841]::util::run_in_thread_pool_with_globals<rustc_interface[2ac6857faa489841]::interface::run_compiler<core[3d2408b9a7974bb]::result::Result<(), rustc_span[b25f563e2e6d20a1]::ErrorGuaranteed>, rustc_driver_impl[55b27a31f76e3fb7]::run_compiler::{closure#1}>::{closure#0}, core[3d2408b9a7974bb]::result::Result<(), rustc_span[b25f563e2e6d20a1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3d2408b9a7974bb]::result::Result<(), rustc_span[b25f563e2e6d20a1]::ErrorGuaranteed>>::{closure#1} as core[3d2408b9a7974bb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x7fb0e82377b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9adfc2ae43657457
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/alloc/src/boxed.rs:1985:9
  44:     0x7fb0e82377b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h14fefbfa7b574396
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/alloc/src/boxed.rs:1985:9
  45:     0x7fb0e82377b5 - std::sys::unix::thread::Thread::new::thread_start::ha211bb47f6f5cedc
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys/unix/thread.rs:108:17
  46:     0x7fb0e8107609 - start_thread
  47:     0x7fb0e802a133 - clone
  48:                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.71.0 (8ede3aae2 2023-07-12) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_mod_item_types] checking item types in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0412`.

@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. requires-nightly This issue requires a nightly compiler in some way. F-lazy_type_alias `#![feature(lazy_type_alias)]` labels Jul 17, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 17, 2023
@compiler-errors
Copy link
Member

compiler-errors commented Jul 17, 2023

This is just a regular GAT ICE:

trait Gat {
    type FooArg<'a, 'b: 'b>;
}

impl Gat for () {
    type FooArg<'a, 'b: 'b> = &'a dyn ToString;
}

struct Test;

impl Iterator for Test {
    type Item = Box<dyn Fn(<() as Gat>::FooArg<'_, '_>)>;

    fn next(&mut self) -> Option<Self::Item> { None }
}

pub fn main() {}

@matthiaskrgr matthiaskrgr added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Jul 18, 2023
@matthiaskrgr
Copy link
Member Author

Heh so that started crashing with 1.65 then :/

@compiler-errors
Copy link
Member

I think that's just when GATs were stabilized.

@Jules-Bertholet
Copy link
Contributor

@rustbot label -requires-nightly

@rustbot rustbot removed the requires-nightly This issue requires a nightly compiler in some way. label Jul 24, 2023
@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 29, 2023
@Noratrieb Noratrieb changed the title ICE: lazy_type_alias: add_outlives_bounds: unexpected regions ICE: add_outlives_bounds: unexpected regions` Jul 29, 2023
@Noratrieb Noratrieb removed the F-lazy_type_alias `#![feature(lazy_type_alias)]` label Jul 29, 2023
@Noratrieb Noratrieb changed the title ICE: add_outlives_bounds: unexpected regions` ICE: add_outlives_bounds: unexpected regions Jul 29, 2023
@matthiaskrgr matthiaskrgr added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Apr 19, 2024
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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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