Skip to content

ICE: can't find an upper bound in nll::compute_regions in rustc_borrowck #122704

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
shkoo opened this issue Mar 18, 2024 · 4 comments · Fixed by #139668
Closed

ICE: can't find an upper bound in nll::compute_regions in rustc_borrowck #122704

shkoo opened this issue Mar 18, 2024 · 4 comments · Fixed by #139668
Labels
A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@shkoo
Copy link
Contributor

shkoo commented Mar 18, 2024

Code

use std::any::Any;

pub struct Foo {
    bar: Box<dyn for<'a> Fn(&'a usize) -> Box<dyn Any + 'a>>,
}

impl Foo {
    pub fn ack<I>(&mut self, f: impl for<'a> Fn(&'a usize) -> Box<I>) {
        self.bar = Box::new(|baz| Box::new(f(baz)));
    }
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.79.0-nightly (eb45c8444 2024-03-17)
binary: rustc
commit-hash: eb45c844407968ea54df0d9870ebce9e3235b706
commit-date: 2024-03-17
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2

Error output

thread 'rustc' panicked at compiler/rustc_borrowck/src/type_check/free_region_relations.rs:97:9:
can't find an upper bound!?
stack backtrace:
   0:     0x7fcf37ef030f - std::backtrace_rs::backtrace::libunwind::trace::hd1b8e7bf69bd2659
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7fcf37ef030f - std::backtrace_rs::backtrace::trace_unsynchronized::ha2541878f17a8bf5
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fcf37ef030f - std::backtrace::Backtrace::create::h2489761f8d713f8d
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/std/src/backtrace.rs:331:13
   3:     0x7fcf37ef0250 - std::backtrace::Backtrace::force_capture::h212b9648ae6a4e34
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/std/src/backtrace.rs:312:9
   4:     0x7fcf3af33762 - std[f30794364a8567e8]::panicking::update_hook::<alloc[d4fc0c1400399e53]::boxed::Box<rustc_driver_impl[977aa2f7506c0463]::install_ice_hook::{closure#0}>>::{closure#0}
   5:     0x7fcf37f0ab50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::he9235fc142cfefbc
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/alloc/src/boxed.rs:2034:9
   6:     0x7fcf37f0ab50 - std::panicking::rust_panic_with_hook::hcb10f10b9294465e
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/std/src/panicking.rs:783:13
   7:     0x7fcf37f0a859 - std::panicking::begin_panic_handler::{{closure}}::h1df158136e631df7
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/std/src/panicking.rs:649:13
   8:     0x7fcf37f07de6 - std::sys_common::backtrace::__rust_end_short_backtrace::h3eabad15a30d1baa
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/std/src/sys_common/backtrace.rs:171:18
   9:     0x7fcf37f0a5c4 - rust_begin_unwind
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/std/src/panicking.rs:645:5
  10:     0x7fcf37f551a5 - core::panicking::panic_fmt::hc408b30751ce7310
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/core/src/panicking.rs:72:14
  11:     0x7fcf3ad4253d - <rustc_borrowck[19dbd917483b2da6]::type_check::free_region_relations::UniversalRegionRelations>::non_local_upper_bounds
  12:     0x7fcf39a48644 - rustc_borrowck[19dbd917483b2da6]::nll::compute_regions
  13:     0x7fcf3d1605ef - rustc_borrowck[19dbd917483b2da6]::do_mir_borrowck
  14:     0x7fcf3c349228 - rustc_borrowck[19dbd917483b2da6]::mir_borrowck
  15:     0x7fcf3c348d17 - rustc_query_impl[29f35dd1a1f5675d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[29f35dd1a1f5675d]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e264bbe93e45f6ca]::query::erase::Erased<[u8; 8usize]>>
  16:     0x7fcf3c34ad2e - rustc_query_system[7e5eced594b3b3e4]::query::plumbing::try_execute_query::<rustc_query_impl[29f35dd1a1f5675d]::DynamicConfig<rustc_query_system[7e5eced594b3b3e4]::query::caches::VecCache<rustc_span[30575adc3f012a9d]::def_id::LocalDefId, rustc_middle[e264bbe93e45f6ca]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[29f35dd1a1f5675d]::plumbing::QueryCtxt, false>
  17:     0x7fcf3c34a84c - rustc_query_impl[29f35dd1a1f5675d]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  18:     0x7fcf3cc5d29c - rustc_middle[e264bbe93e45f6ca]::query::plumbing::query_get_at::<rustc_query_system[7e5eced594b3b3e4]::query::caches::VecCache<rustc_span[30575adc3f012a9d]::def_id::LocalDefId, rustc_middle[e264bbe93e45f6ca]::query::erase::Erased<[u8; 8usize]>>>
  19:     0x7fcf3cc5d30e - <rustc_borrowck[19dbd917483b2da6]::type_check::TypeChecker>::prove_closure_bounds
  20:     0x7fcf3c6873a3 - <rustc_borrowck[19dbd917483b2da6]::type_check::TypeChecker>::typeck_mir
  21:     0x7fcf39a024ea - rustc_borrowck[19dbd917483b2da6]::type_check::type_check
  22:     0x7fcf39a3c137 - rustc_borrowck[19dbd917483b2da6]::nll::compute_regions
  23:     0x7fcf3d1605ef - rustc_borrowck[19dbd917483b2da6]::do_mir_borrowck
  24:     0x7fcf3c349228 - rustc_borrowck[19dbd917483b2da6]::mir_borrowck
  25:     0x7fcf3c348d17 - rustc_query_impl[29f35dd1a1f5675d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[29f35dd1a1f5675d]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e264bbe93e45f6ca]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7fcf3c34ad2e - rustc_query_system[7e5eced594b3b3e4]::query::plumbing::try_execute_query::<rustc_query_impl[29f35dd1a1f5675d]::DynamicConfig<rustc_query_system[7e5eced594b3b3e4]::query::caches::VecCache<rustc_span[30575adc3f012a9d]::def_id::LocalDefId, rustc_middle[e264bbe93e45f6ca]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[29f35dd1a1f5675d]::plumbing::QueryCtxt, false>
  27:     0x7fcf3c34a84c - rustc_query_impl[29f35dd1a1f5675d]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7fcf3c61d95d - rustc_interface[2a44f2ea1a7c30d3]::passes::analysis
  29:     0x7fcf3c61cb19 - rustc_query_impl[29f35dd1a1f5675d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[29f35dd1a1f5675d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e264bbe93e45f6ca]::query::erase::Erased<[u8; 1usize]>>
  30:     0x7fcf3cfc7ec3 - rustc_query_system[7e5eced594b3b3e4]::query::plumbing::try_execute_query::<rustc_query_impl[29f35dd1a1f5675d]::DynamicConfig<rustc_query_system[7e5eced594b3b3e4]::query::caches::SingleCache<rustc_middle[e264bbe93e45f6ca]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[29f35dd1a1f5675d]::plumbing::QueryCtxt, false>
  31:     0x7fcf3cfc7c3f - rustc_query_impl[29f35dd1a1f5675d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7fcf3cdf3084 - rustc_interface[2a44f2ea1a7c30d3]::interface::run_compiler::<core[451cccbd72d71aca]::result::Result<(), rustc_span[30575adc3f012a9d]::ErrorGuaranteed>, rustc_driver_impl[977aa2f7506c0463]::run_compiler::{closure#0}>::{closure#0}
  33:     0x7fcf3cedf685 - std[f30794364a8567e8]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2a44f2ea1a7c30d3]::util::run_in_thread_with_globals<rustc_interface[2a44f2ea1a7c30d3]::util::run_in_thread_pool_with_globals<rustc_interface[2a44f2ea1a7c30d3]::interface::run_compiler<core[451cccbd72d71aca]::result::Result<(), rustc_span[30575adc3f012a9d]::ErrorGuaranteed>, rustc_driver_impl[977aa2f7506c0463]::run_compiler::{closure#0}>::{closure#0}, core[451cccbd72d71aca]::result::Result<(), rustc_span[30575adc3f012a9d]::ErrorGuaranteed>>::{closure#0}, core[451cccbd72d71aca]::result::Result<(), rustc_span[30575adc3f012a9d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[451cccbd72d71aca]::result::Result<(), rustc_span[30575adc3f012a9d]::ErrorGuaranteed>>
  34:     0x7fcf3cedf4b2 - <<std[f30794364a8567e8]::thread::Builder>::spawn_unchecked_<rustc_interface[2a44f2ea1a7c30d3]::util::run_in_thread_with_globals<rustc_interface[2a44f2ea1a7c30d3]::util::run_in_thread_pool_with_globals<rustc_interface[2a44f2ea1a7c30d3]::interface::run_compiler<core[451cccbd72d71aca]::result::Result<(), rustc_span[30575adc3f012a9d]::ErrorGuaranteed>, rustc_driver_impl[977aa2f7506c0463]::run_compiler::{closure#0}>::{closure#0}, core[451cccbd72d71aca]::result::Result<(), rustc_span[30575adc3f012a9d]::ErrorGuaranteed>>::{closure#0}, core[451cccbd72d71aca]::result::Result<(), rustc_span[30575adc3f012a9d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[451cccbd72d71aca]::result::Result<(), rustc_span[30575adc3f012a9d]::ErrorGuaranteed>>::{closure#1} as core[451cccbd72d71aca]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:     0x7fcf37f141e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h746ad893ba25d760
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/alloc/src/boxed.rs:2020:9
  36:     0x7fcf37f141e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6b3d742dc2cb92e7
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/alloc/src/boxed.rs:2020:9
  37:     0x7fcf37f141e5 - std::sys::pal::unix::thread::Thread::new::thread_start::h23f93afbf81ba466
                               at /rustc/eb45c844407968ea54df0d9870ebce9e3235b706/library/std/src/sys/pal/unix/thread.rs:108:17
  38:     0x7fcf37e14609 - start_thread
                               at /build/glibc-wuryBv/glibc-2.31/nptl/pthread_create.c:477:8
  39:     0x7fcf37d39353 - clone
                               at /build/glibc-wuryBv/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  40:                0x0 - <unknown>


rustc version: 1.79.0-nightly (eb45c8444 2024-03-17)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at repro.rs:7:1: 7:9>::ack::{closure#0}`
#1 [mir_borrowck] borrow-checking `<impl at repro.rs:7:1: 7:9>::ack`
#2 [analysis] running analysis passes on this crate
end of query stack
@shkoo shkoo 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 Mar 18, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 18, 2024
@jieyouxu jieyouxu added the A-borrow-checker Area: The borrow checker label Mar 18, 2024
@matthiaskrgr
Copy link
Member

Regression in nightly-2022-06-08
get_commits_between returning commits, len: 7
commit[0] 2022-06-06: Auto merge of #97730 - flip1995:clippyup, r=Manishearth
commit[1] 2022-06-06: Auto merge of #97809 - matthiaskrgr:rollup-ajyvjd3, r=matthiaskrgr
commit[2] 2022-06-07: Auto merge of #97801 - RalfJung:miri, r=RalfJung
commit[3] 2022-06-07: Auto merge of #95565 - jackh726:remove-borrowck-mode, r=nikomatsakis
commit[4] 2022-06-07: Auto merge of #97512 - scottmcm:add-coldcc, r=nagisa,lcnr
commit[5] 2022-06-07: Auto merge of #97825 - Dylan-DPC:rollup-ya51k1k, r=Dylan-DPC
commit[6] 2022-06-07: Auto merge of #97835 - Dylan-DPC:rollup-0ae3pwp, r=Dylan-DPC
ERROR: no CI builds available between 50b0025 and 5435ed6 within last 167 days

probably 95565 ? cc @jackh726

@lqd
Copy link
Member

lqd commented Mar 18, 2024

That PR removed NLL's migrate mode, so maybe the bisection could go further back with with #![feature(nll)], to opt-in to full NLLs before it was the default.

@matthiaskrgr matthiaskrgr changed the title ICE: can't find an upper bound in nll::compute_regions in rustc_borrowck ICE: can't find an upper bound in nll::compute_regions in rustc_borrowck Mar 18, 2024
@matthiaskrgr
Copy link
Member

matthiaskrgr commented Mar 18, 2024

fourth attempt or so...
searched toolchains nightly-2018-01-01 through nightly-2024-03-18

Regression in nightly-2019-03-14

looking for regression commit between 2019-03-13 and 2019-03-14
fetching (via remote github) commits from max(7c19e1e, 2019-03-11) to 719b0d9
ending github query because we found starting sha: 7c19e1e
get_commits_between returning commits, len: 6
commit[0] 2019-03-12: Auto merge of #58015 - icefoxen:tryfrom-docs, r=SimonSapin
commit[1] 2019-03-12: Auto merge of #58743 - varkor:bulk-needstest-1, r=alexcrichton
commit[2] 2019-03-13: Auto merge of #59151 - Centril:rollup, r=Centril
commit[3] 2019-03-13: Auto merge of #56864 - Zoxc:stable-hash-macro, r=michaelwoerister
commit[4] 2019-03-13: Auto merge of #58349 - petrochenkov:uni201x, r=pnkfelix
commit[5] 2019-03-13: Auto merge of #59143 - ehuss:update-cargo, r=ehuss
ERROR: no CI builds available between 7c19e1e and 719b0d9 within last 167 days

maybe #59132 ?

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 9, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
@theemathas
Copy link
Contributor

Minimized:

trait IsStatic: 'static {}

impl<T: 'static> IsStatic for T {}

fn foo<T>(x: Box<T>) -> Box<dyn for<'a> FnOnce(&'a ()) -> Box<dyn IsStatic + 'a>> {
    Box::new(move |_| x)
}
Error output
   Compiling playground v0.0.1 (/playground)
thread 'rustc' panicked at compiler/rustc_borrowck/src/type_check/free_region_relations.rs:97:9:
can't find an upper bound!?
stack backtrace:
   0:     0x7fa39f960ae5 - std::backtrace_rs::backtrace::libunwind::trace::hd03f93528d46491d
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7fa39f960ae5 - std::backtrace_rs::backtrace::trace_unsynchronized::h74dc0b19b052c2ae
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fa39f960ae5 - std::sys_common::backtrace::_print_fmt::h9a3bc0e652cf7b69
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7fa39f960ae5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4837d7bdd071c26e
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fa39f9b177b - core::fmt::rt::Argument::fmt::h5f4cca7a86de3ac3
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/core/src/fmt/rt.rs:165:63
   5:     0x7fa39f9b177b - core::fmt::write::h58fee7e5e6f828bb
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/core/src/fmt/mod.rs:1168:21
   6:     0x7fa39f9556bf - std::io::Write::write_fmt::h5a54d56832f12d0f
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/io/mod.rs:1835:15
   7:     0x7fa39f9608be - std::sys_common::backtrace::_print::hf8a2cb55c2c8353b
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fa39f9608be - std::sys_common::backtrace::print::h6b23178d2042c60b
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fa39f9632f9 - std::panicking::default_hook::{{closure}}::h8098cbc85e732f3b
  10:     0x7fa39f96309c - std::panicking::default_hook::h21b51f336018bc80
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/panicking.rs:292:9
  11:     0x7fa3a2c957ff - std[e439e5cd3a449d52]::panicking::update_hook::<alloc[b12fd6abffc16fa6]::boxed::Box<rustc_driver_impl[9892696329624aa2]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fa39f963bff - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h5602e10eecbd0618
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/alloc/src/boxed.rs:2076:9
  13:     0x7fa39f963bff - std::panicking::rust_panic_with_hook::hd1b3711c6ea634e2
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/panicking.rs:801:13
  14:     0x7fa39f9637f3 - std::panicking::begin_panic_handler::{{closure}}::h01c1581833053b47
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/panicking.rs:660:13
  15:     0x7fa39f960fa9 - std::sys_common::backtrace::__rust_end_short_backtrace::h12d87452272215f0
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7fa39f9634d4 - rust_begin_unwind
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/panicking.rs:658:5
  17:     0x7fa39f9add33 - core::panicking::panic_fmt::h219f5a3f16bd9a4d
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/core/src/panicking.rs:74:14
  18:     0x7fa3a2aa270a - <rustc_borrowck[d08da6903e11d7f3]::type_check::free_region_relations::UniversalRegionRelations>::non_local_upper_bounds
  19:     0x7fa3a115387d - rustc_borrowck[d08da6903e11d7f3]::nll::compute_regions
  20:     0x7fa3a4f5f93a - rustc_borrowck[d08da6903e11d7f3]::do_mir_borrowck
  21:     0x7fa3a4f51a3e - rustc_query_impl[8f9eb950d6cc008f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8f9eb950d6cc008f]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>
  22:     0x7fa3a42e66ee - rustc_query_system[8ccdec27dd679281]::query::plumbing::try_execute_query::<rustc_query_impl[8f9eb950d6cc008f]::DynamicConfig<rustc_query_system[8ccdec27dd679281]::query::caches::VecCache<rustc_span[7d8a0f37f02bb30e]::def_id::LocalDefId, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[8f9eb950d6cc008f]::plumbing::QueryCtxt, false>
  23:     0x7fa3a42e614d - rustc_query_impl[8f9eb950d6cc008f]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7fa3a4930860 - rustc_middle[e07a585f38de947]::query::plumbing::query_get_at::<rustc_query_system[8ccdec27dd679281]::query::caches::VecCache<rustc_span[7d8a0f37f02bb30e]::def_id::LocalDefId, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>>
  25:     0x7fa3a49308ce - <rustc_borrowck[d08da6903e11d7f3]::type_check::TypeChecker>::prove_closure_bounds
  26:     0x7fa3a40e459e - <rustc_borrowck[d08da6903e11d7f3]::type_check::TypeChecker>::typeck_mir
  27:     0x7fa3a11845ad - rustc_borrowck[d08da6903e11d7f3]::type_check::type_check
  28:     0x7fa3a1147ca8 - rustc_borrowck[d08da6903e11d7f3]::nll::compute_regions
  29:     0x7fa3a4f5f93a - rustc_borrowck[d08da6903e11d7f3]::do_mir_borrowck
  30:     0x7fa3a4f51a3e - rustc_query_impl[8f9eb950d6cc008f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8f9eb950d6cc008f]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>
  31:     0x7fa3a42e66ee - rustc_query_system[8ccdec27dd679281]::query::plumbing::try_execute_query::<rustc_query_impl[8f9eb950d6cc008f]::DynamicConfig<rustc_query_system[8ccdec27dd679281]::query::caches::VecCache<rustc_span[7d8a0f37f02bb30e]::def_id::LocalDefId, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[8f9eb950d6cc008f]::plumbing::QueryCtxt, false>
  32:     0x7fa3a42e614d - rustc_query_impl[8f9eb950d6cc008f]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7fa3a4a0b313 - rustc_interface[c905b19a64c8fe9a]::passes::analysis
  34:     0x7fa3a4a0a487 - rustc_query_impl[8f9eb950d6cc008f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8f9eb950d6cc008f]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 1usize]>>
  35:     0x7fa3a4df92a5 - rustc_query_system[8ccdec27dd679281]::query::plumbing::try_execute_query::<rustc_query_impl[8f9eb950d6cc008f]::DynamicConfig<rustc_query_system[8ccdec27dd679281]::query::caches::SingleCache<rustc_middle[e07a585f38de947]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[8f9eb950d6cc008f]::plumbing::QueryCtxt, false>
  36:     0x7fa3a4df900f - rustc_query_impl[8f9eb950d6cc008f]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7fa3a4cbd7d2 - rustc_interface[c905b19a64c8fe9a]::interface::run_compiler::<core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>, rustc_driver_impl[9892696329624aa2]::run_compiler::{closure#0}>::{closure#1}
  38:     0x7fa3a4ce13a7 - std[e439e5cd3a449d52]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c905b19a64c8fe9a]::util::run_in_thread_with_globals<rustc_interface[c905b19a64c8fe9a]::util::run_in_thread_pool_with_globals<rustc_interface[c905b19a64c8fe9a]::interface::run_compiler<core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>, rustc_driver_impl[9892696329624aa2]::run_compiler::{closure#0}>::{closure#1}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>::{closure#0}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>
  39:     0x7fa3a4ce116a - <<std[e439e5cd3a449d52]::thread::Builder>::spawn_unchecked_<rustc_interface[c905b19a64c8fe9a]::util::run_in_thread_with_globals<rustc_interface[c905b19a64c8fe9a]::util::run_in_thread_pool_with_globals<rustc_interface[c905b19a64c8fe9a]::interface::run_compiler<core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>, rustc_driver_impl[9892696329624aa2]::run_compiler::{closure#0}>::{closure#1}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>::{closure#0}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bd37ed12c97f867b]::result::Result<(), rustc_span[7d8a0f37f02bb30e]::ErrorGuaranteed>>::{closure#2} as core[bd37ed12c97f867b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7fa39f96da7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h32b9a9f0c1b7e30b
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/alloc/src/boxed.rs:2062:9
  41:     0x7fa39f96da7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h33379ef2bcdd46d5
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/alloc/src/boxed.rs:2062:9
  42:     0x7fa39f96da7b - std::sys::pal::unix::thread::Thread::new::thread_start::h27a5de020b7d499b
                               at /rustc/f8e566053207b4ecbcbc7a7d6ded82c43061e3da/library/std/src/sys/pal/unix/thread.rs:108:17
  43:     0x7fa39f87b609 - start_thread
  44:     0x7fa39f79e353 - clone
  45:                0x0 - <unknown>

error: 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: please make sure that you have updated to the latest nightly

note: please attach the file at `/playground/rustc-ice-2024-06-15T05_47_22-27.txt` to your bug report

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 [mir_borrowck] borrow-checking `foo::{closure#0}`
#1 [mir_borrowck] borrow-checking `foo`
end of query stack
error: could not compile `playground` (lib)

Identical to #125891 except for having dyn instead of impl.

@jieyouxu jieyouxu added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label Nov 20, 2024
@bors bors closed this as completed in 706dc70 May 23, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 23, 2025
Rollup merge of rust-lang#139668 - matthewjasper:upper-bound-fix, r=compiler-errors

Handle regions equivalent to 'static in non_local_bounds

`non_local_bounds` would only find non local bounds that strictly bound a given region, but it's possible that a local region is equated to 'static when showing a type referencing a locally bound lifetime, such as `dyn Any + 'a` in the tests added, is well-formed. In this case we should return 'static.

closes rust-lang#122704
closes rust-lang#139004
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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.

7 participants