Skip to content

ICE: add_outlives_bounds: unexpected regions #109209

Closed

Description

@rkrasiuk

Code

I didn't succeed in minimizing the bug. I just know how to repro it. Would appreciate some pointers.

To repro run at https://github.com/RustCrypto/formats/tree/spki/v0.7.0

cargo b -p cpki --features alloc

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (ab654863c 2023-03-15)
binary: rustc
commit-hash: ab654863c3d50482f260cf862647f1fe0ff5e010
commit-date: 2023-03-15
host: aarch64-apple-darwin
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

error: internal compiler error: /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/compiler/rustc_infer/src/infer/outlives/env.rs:145:26: add_outlives_bounds: unexpected regions

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/ab654863c3d50482f260cf862647f1fe0ff5e010/compiler/rustc_errors/src/lib.rs:1644:9
Backtrace

stack backtrace:
   0:        0x102e085dc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb05446754748fc5b
   1:        0x102e5b3d4 - core::fmt::write::hc4e7e367f0127987
   2:        0x102dfe224 - std::io::Write::write_fmt::h97f8cfc5288a8cc9
   3:        0x102e083f0 - std::sys_common::backtrace::print::hc3e3719568510aef
   4:        0x102e0ae78 - std::panicking::default_hook::{{closure}}::h722f6a6f2478bc6f
   5:        0x102e0abd0 - std::panicking::default_hook::he6f5a145cc5d36de
   6:        0x10af62fd8 - rustc_driver_impl[630fbe36553cc500]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x102e0b570 - std::panicking::rust_panic_with_hook::h1f3530038ad6b26c
   8:        0x10ec35400 - std[22480f07b972d5ac]::panicking::begin_panic::<rustc_errors[8b68f8991908f601]::ExplicitBug>::{closure#0}
   9:        0x10ec345a0 - std[22480f07b972d5ac]::sys_common::backtrace::__rust_end_short_backtrace::<std[22480f07b972d5ac]::panicking::begin_panic<rustc_errors[8b68f8991908f601]::ExplicitBug>::{closure#0}, !>
  10:        0x10f20f210 - std[22480f07b972d5ac]::panicking::begin_panic::<rustc_errors[8b68f8991908f601]::ExplicitBug>
  11:        0x10ecdfb6c - std[22480f07b972d5ac]::panic::panic_any::<rustc_errors[8b68f8991908f601]::ExplicitBug>
  12:        0x10ecdd808 - <rustc_errors[8b68f8991908f601]::HandlerInner>::bug::<&alloc[a89ba42cafc32c62]::string::String>
  13:        0x10ecdd468 - <rustc_errors[8b68f8991908f601]::Handler>::bug::<&alloc[a89ba42cafc32c62]::string::String>
  14:        0x10ecc2bd8 - rustc_middle[bc5773c6b9e81b3f]::util::bug::opt_span_bug_fmt::<rustc_span[5b11aacf1cbc7475]::span_encoding::Span>::{closure#0}
  15:        0x10ecbe970 - rustc_middle[bc5773c6b9e81b3f]::ty::context::tls::with_opt::<rustc_middle[bc5773c6b9e81b3f]::util::bug::opt_span_bug_fmt<rustc_span[5b11aacf1cbc7475]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  16:        0x10ecbe93c - rustc_middle[bc5773c6b9e81b3f]::ty::context::tls::with_context_opt::<rustc_middle[bc5773c6b9e81b3f]::ty::context::tls::with_opt<rustc_middle[bc5773c6b9e81b3f]::util::bug::opt_span_bug_fmt<rustc_span[5b11aacf1cbc7475]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  17:        0x10ecc2b48 - rustc_middle[bc5773c6b9e81b3f]::util::bug::opt_span_bug_fmt::<rustc_span[5b11aacf1cbc7475]::span_encoding::Span>
  18:        0x10f2115a4 - rustc_middle[bc5773c6b9e81b3f]::util::bug::bug_fmt
  19:        0x10d42acb4 - <rustc_infer[841bee24244470c]::infer::outlives::env::OutlivesEnvironment>::with_bounds::<core[3a8cfdcf785a1bad]::iter::adapters::flatten::Flatten<core[3a8cfdcf785a1bad]::iter::adapters::map::Map<indexmap[96e5a7ae5db70d66]::set::IntoIter<rustc_middle[bc5773c6b9e81b3f]::ty::Ty>, <rustc_infer[841bee24244470c]::infer::InferCtxt as rustc_trait_selection[20f6487b014fd0d6]::traits::outlives_bounds::InferCtxtExt>::implied_bounds_tys::{closure#0}>>>
  20:        0x10d3fe5fc - rustc_hir_analysis[d0da5362ade2d80a]::check::compare_impl_item::compare_method_predicate_entailment
  21:        0x10d3f5464 - rustc_hir_analysis[d0da5362ade2d80a]::check::compare_impl_item::compare_impl_method
  22:        0x10d38a270 - rustc_hir_analysis[d0da5362ade2d80a]::check::check::check_impl_items_against_trait
  23:        0x10d385348 - rustc_hir_analysis[d0da5362ade2d80a]::check::check::check_item_type
  24:        0x10d38efb8 - rustc_hir_analysis[d0da5362ade2d80a]::check::check::check_mod_item_types
  25:        0x10df8cb78 - rustc_query_system[726ed3e9f9824747]::query::plumbing::try_execute_query::<rustc_query_impl[7243f20952ea59a4]::queries::check_mod_item_types, rustc_query_impl[7243f20952ea59a4]::plumbing::QueryCtxt>
  26:        0x10e0c5b20 - <rustc_query_impl[7243f20952ea59a4]::Queries as rustc_middle[bc5773c6b9e81b3f]::ty::query::QueryEngine>::check_mod_item_types
  27:        0x10d3cde6c - <rustc_middle[bc5773c6b9e81b3f]::hir::map::Map>::for_each_module::<rustc_hir_analysis[d0da5362ade2d80a]::check_crate::{closure#6}::{closure#0}>
  28:        0x10d3ea404 - <rustc_session[ee16895196d31674]::session::Session>::time::<(), rustc_hir_analysis[d0da5362ade2d80a]::check_crate::{closure#6}>
  29:        0x10d44796c - rustc_hir_analysis[d0da5362ade2d80a]::check_crate
  30:        0x10b0720ac - rustc_interface[f60559f741f10411]::passes::analysis
  31:        0x10e009400 - rustc_query_system[726ed3e9f9824747]::query::plumbing::try_execute_query::<rustc_query_impl[7243f20952ea59a4]::queries::analysis, rustc_query_impl[7243f20952ea59a4]::plumbing::QueryCtxt>
  32:        0x10e0bd1d4 - <rustc_query_impl[7243f20952ea59a4]::Queries as rustc_middle[bc5773c6b9e81b3f]::ty::query::QueryEngine>::analysis
  33:        0x10afafb68 - <rustc_middle[bc5773c6b9e81b3f]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[630fbe36553cc500]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[3a8cfdcf785a1bad]::result::Result<(), rustc_span[5b11aacf1cbc7475]::ErrorGuaranteed>>
  34:        0x10afaf54c - <rustc_interface[f60559f741f10411]::interface::Compiler>::enter::<rustc_driver_impl[630fbe36553cc500]::run_compiler::{closure#1}::{closure#2}, core[3a8cfdcf785a1bad]::result::Result<core[3a8cfdcf785a1bad]::option::Option<rustc_interface[f60559f741f10411]::queries::Linker>, rustc_span[5b11aacf1cbc7475]::ErrorGuaranteed>>
  35:        0x10afaa330 - rustc_span[5b11aacf1cbc7475]::with_source_map::<core[3a8cfdcf785a1bad]::result::Result<(), rustc_span[5b11aacf1cbc7475]::ErrorGuaranteed>, rustc_interface[f60559f741f10411]::interface::run_compiler<core[3a8cfdcf785a1bad]::result::Result<(), rustc_span[5b11aacf1cbc7475]::ErrorGuaranteed>, rustc_driver_impl[630fbe36553cc500]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  36:        0x10af72c9c - std[22480f07b972d5ac]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f60559f741f10411]::util::run_in_thread_pool_with_globals<rustc_interface[f60559f741f10411]::interface::run_compiler<core[3a8cfdcf785a1bad]::result::Result<(), rustc_span[5b11aacf1cbc7475]::ErrorGuaranteed>, rustc_driver_impl[630fbe36553cc500]::run_compiler::{closure#1}>::{closure#0}, core[3a8cfdcf785a1bad]::result::Result<(), rustc_span[5b11aacf1cbc7475]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3a8cfdcf785a1bad]::result::Result<(), rustc_span[5b11aacf1cbc7475]::ErrorGuaranteed>>
  37:        0x10af73b3c - <<std[22480f07b972d5ac]::thread::Builder>::spawn_unchecked_<rustc_interface[f60559f741f10411]::util::run_in_thread_pool_with_globals<rustc_interface[f60559f741f10411]::interface::run_compiler<core[3a8cfdcf785a1bad]::result::Result<(), rustc_span[5b11aacf1cbc7475]::ErrorGuaranteed>, rustc_driver_impl[630fbe36553cc500]::run_compiler::{closure#1}>::{closure#0}, core[3a8cfdcf785a1bad]::result::Result<(), rustc_span[5b11aacf1cbc7475]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3a8cfdcf785a1bad]::result::Result<(), rustc_span[5b11aacf1cbc7475]::ErrorGuaranteed>>::{closure#1} as core[3a8cfdcf785a1bad]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:        0x102e13b98 - std::sys::unix::thread::Thread::new::thread_start::hc3f867787b50646f
  39:        0x1b13b106c - __pthread_deallocate

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.70.0-nightly (ab654863c 2023-03-15) running on aarch64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2

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

query stack during panic:
#0 [check_mod_item_types] checking item types in module `spki`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `spki` (lib)
warning: build failed, waiting for other jobs to finish...

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Mar 16, 2023
  2. lqd commented on Mar 16, 2023

    @lqd
    Member

    I think this is the same underlying issue as #109199. This has already been fixed on master, but too late to appear in today's nightly. The fix will be available in tomorrow's nightly though.

    (cc @aliemjay for spki as a different test crate than bincode for #107376 -- it's probably similar header bounds we can see e.g. in the spki.rs file)

  3. rkrasiuk commented on Mar 16, 2023

    @rkrasiuk
    Author

    ah, apologies, i searched open issues for a similar bug, but didn't look at closed

  4. lqd commented on Mar 16, 2023

    @lqd
    Member

    No worries at all, thanks for opening it. It's in a different crate anyways, so it's better to have duplicate issues rather than miss regressions.

  5. added
    S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.
    on Mar 16, 2023
  6. removed
    S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.
    on Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-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