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

borrowck: no entry found for key #99665

Closed
madonuko opened this issue Jul 24, 2022 · 7 comments
Closed

borrowck: no entry found for key #99665

madonuko opened this issue Jul 24, 2022 · 7 comments
Assignees
Labels
C-bug Category: This is a bug. 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

@madonuko
Copy link

madonuko commented Jul 24, 2022

See code at https://github.com/windowsboy111/rustc-bug-reproduce #99665 (comment).

Meta

rustc --version --verbose:

rustc 1.61.0 (fe5b13d68 2022-05-18)
binary: rustc
commit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e
commit-date: 2022-05-18
host: x86_64-unknown-linux-gnu
release: 1.61.0
LLVM version: 14.0.0
=====
rustc 1.63.0-beta.7 (12c5b1ef3 2022-07-22)
binary: rustc
commit-hash: 12c5b1ef3882fa824a7dc6054f9f15732b44c863
commit-date: 2022-07-22
host: x86_64-unknown-linux-gnu
release: 1.63.0-beta.7
LLVM version: 14.0.5
=====
rustc 1.64.0-nightly (93ffde6f0 2022-07-23)
binary: rustc
commit-hash: 93ffde6f04d3d24327a4e17a2a2bf4f63c246235
commit-date: 2022-07-23
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6

Error output

thread 'rustc' panicked at 'no entry found for key', compiler/rustc_borrowck/src/region_infer/mod.rs:2264:9
(backtrace here)
error: internal compiler error: unexpected panic

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.63.0-beta.7 (12c5b1ef3 2022-07-22) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C linker=/usr/bin/clang -C incremental -C link-arg=--ld-path=/usr/bin/mold

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `artifacts::{closure#1}`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `anda-web`
Backtrace

stack backtrace:
   0:     0x7f3b73a9e14d - std::backtrace_rs::backtrace::libunwind::trace::h4ffcb1087d4a670b
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3b73a9e14d - std::backtrace_rs::backtrace::trace_unsynchronized::hfebfd398676dabc8
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3b73a9e14d - std::sys_common::backtrace::_print_fmt::h5e8697080c4d91af
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f3b73a9e14d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8b4eb6155253b0c4
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f3b73af9f3c - core::fmt::write::h0df1d5b0a79c4094
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/core/src/fmt/mod.rs:1197:17
   5:     0x7f3b73a8f7c1 - std::io::Write::write_fmt::h799cdcc747bb79c7
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/io/mod.rs:1672:15
   6:     0x7f3b73aa0e15 - std::sys_common::backtrace::_print::ha56459f70c2dacd6
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f3b73aa0e15 - std::sys_common::backtrace::print::hb0fd3c04c08f61a3
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f3b73aa0e15 - std::panicking::default_hook::{{closure}}::h2b9b6a57f92337dc
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/panicking.rs:295:22
   9:     0x7f3b73aa0b36 - std::panicking::default_hook::hbd653821328540e3
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/panicking.rs:314:9
  10:     0x7f3b7430f8d4 - rustc_driver[f54b8859d8db0cb5]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f3b617560b3 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h40d3a69e862028a3
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/alloc/src/boxed.rs:1965:9
  12:     0x7f3b616c6f5d - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::h7d6bb5dc1ba8ba03
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/proc_macro/src/bridge/client.rs:328:21
  13:     0x7f3b73aa14ea - std::panicking::rust_panic_with_hook::h06887b27b2f69040
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/panicking.rs:702:17
  14:     0x7f3b73aa1327 - std::panicking::begin_panic_handler::{{closure}}::h88f3790f1b171aa4
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/panicking.rs:588:13
  15:     0x7f3b73a9e604 - std::sys_common::backtrace::__rust_end_short_backtrace::h1933595d50be09d2
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/sys_common/backtrace.rs:138:18
  16:     0x7f3b73aa1059 - rust_begin_unwind
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/panicking.rs:584:5
  17:     0x7f3b73a66213 - core::panicking::panic_fmt::hf5dfeb6d3201b4c6
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/core/src/panicking.rs:142:14
  18:     0x7f3b73af6ba1 - core::panicking::panic_display::h26b3e6fc71383d76
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/core/src/panicking.rs:72:5
  19:     0x7f3b73af6b4b - core::panicking::panic_str::h0a6026aa28b068ee
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/core/src/panicking.rs:56:5
  20:     0x7f3b73a66086 - core::option::expect_failed::h0903a4404197be00
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/core/src/option.rs:1874:5
  21:     0x7f3b74986965 - <rustc_borrowck[c65f7980544eeed]::region_infer::RegionInferenceContext>::universe_info
  22:     0x7f3b75cb6ea0 - rustc_borrowck[c65f7980544eeed]::do_mir_borrowck
  23:     0x7f3b75cac479 - rustc_borrowck[c65f7980544eeed]::mir_borrowck
  24:     0x7f3b75ca91f0 - <rustc_borrowck[c65f7980544eeed]::provide::{closure#0} as core[1646eeb42a20e539]::ops::function::FnOnce<(rustc_middle[6bafe7476f4ae10b]::ty::context::TyCtxt, rustc_span[8cf41c961bdff9]::def_id::LocalDefId)>>::call_once
  25:     0x7f3b769cf881 - <rustc_query_system[54319d294505bd71]::dep_graph::graph::DepGraph<rustc_middle[6bafe7476f4ae10b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[6bafe7476f4ae10b]::ty::context::TyCtxt, rustc_span[8cf41c961bdff9]::def_id::LocalDefId, &rustc_middle[6bafe7476f4ae10b]::mir::query::BorrowCheckResult>
  26:     0x7f3b75f0b730 - rustc_query_system[54319d294505bd71]::query::plumbing::try_execute_query::<rustc_query_impl[dd3d36effa06450b]::plumbing::QueryCtxt, rustc_query_system[54319d294505bd71]::query::caches::DefaultCache<rustc_span[8cf41c961bdff9]::def_id::LocalDefId, &rustc_middle[6bafe7476f4ae10b]::mir::query::BorrowCheckResult>>
  27:     0x7f3b75ee088a - <rustc_query_impl[dd3d36effa06450b]::Queries as rustc_middle[6bafe7476f4ae10b]::ty::query::QueryEngine>::mir_borrowck
  28:     0x7f3b756718ed - <rustc_middle[6bafe7476f4ae10b]::hir::map::Map>::par_body_owners::<rustc_interface[6187cd9eca8862a9]::passes::analysis::{closure#2}::{closure#0}>
  29:     0x7f3b7653c218 - <rustc_session[c2529ebf4e9d0d9d]::session::Session>::time::<(), rustc_interface[6187cd9eca8862a9]::passes::analysis::{closure#2}>
  30:     0x7f3b76536025 - rustc_interface[6187cd9eca8862a9]::passes::analysis
  31:     0x7f3b769e9c45 - <rustc_query_system[54319d294505bd71]::dep_graph::graph::DepGraph<rustc_middle[6bafe7476f4ae10b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[6bafe7476f4ae10b]::ty::context::TyCtxt, (), core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>>
  32:     0x7f3b76a92c1d - rustc_query_system[54319d294505bd71]::query::plumbing::try_execute_query::<rustc_query_impl[dd3d36effa06450b]::plumbing::QueryCtxt, rustc_query_system[54319d294505bd71]::query::caches::DefaultCache<(), core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>>>
  33:     0x7f3b76adcbee - rustc_query_system[54319d294505bd71]::query::plumbing::get_query::<rustc_query_impl[dd3d36effa06450b]::queries::analysis, rustc_query_impl[dd3d36effa06450b]::plumbing::QueryCtxt>
  34:     0x7f3b76519797 - <rustc_interface[6187cd9eca8862a9]::passes::QueryContext>::enter::<rustc_driver[f54b8859d8db0cb5]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>>
  35:     0x7f3b765038ff - <rustc_interface[6187cd9eca8862a9]::interface::Compiler>::enter::<rustc_driver[f54b8859d8db0cb5]::run_compiler::{closure#1}::{closure#2}, core[1646eeb42a20e539]::result::Result<core[1646eeb42a20e539]::option::Option<rustc_interface[6187cd9eca8862a9]::queries::Linker>, rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>>
  36:     0x7f3b764fcebf - rustc_span[8cf41c961bdff9]::with_source_map::<core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>, rustc_interface[6187cd9eca8862a9]::interface::create_compiler_and_run<core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>, rustc_driver[f54b8859d8db0cb5]::run_compiler::{closure#1}>::{closure#1}>
  37:     0x7f3b76504792 - <scoped_tls[818e4097567bb31]::ScopedKey<rustc_span[8cf41c961bdff9]::SessionGlobals>>::set::<rustc_interface[6187cd9eca8862a9]::interface::run_compiler<core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>, rustc_driver[f54b8859d8db0cb5]::run_compiler::{closure#1}>::{closure#0}, core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>>
  38:     0x7f3b76519e1f - std[13c53672748f15b9]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6187cd9eca8862a9]::util::run_in_thread_pool_with_globals<rustc_interface[6187cd9eca8862a9]::interface::run_compiler<core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>, rustc_driver[f54b8859d8db0cb5]::run_compiler::{closure#1}>::{closure#0}, core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>>::{closure#0}, core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>>
  39:     0x7f3b7651a009 - <<std[13c53672748f15b9]::thread::Builder>::spawn_unchecked_<rustc_interface[6187cd9eca8862a9]::util::run_in_thread_pool_with_globals<rustc_interface[6187cd9eca8862a9]::interface::run_compiler<core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>, rustc_driver[f54b8859d8db0cb5]::run_compiler::{closure#1}>::{closure#0}, core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>>::{closure#0}, core[1646eeb42a20e539]::result::Result<(), rustc_errors[b6ac0efed4ab3867]::ErrorGuaranteed>>::{closure#1} as core[1646eeb42a20e539]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7f3b73aab423 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8714758ff84f304b
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/alloc/src/boxed.rs:1951:9
  41:     0x7f3b73aab423 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb14c8f0668b31f6f
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/alloc/src/boxed.rs:1951:9
  42:     0x7f3b73aab423 - std::sys::unix::thread::Thread::new::thread_start::hb16e22a1d03248b9
                               at /rustc/12c5b1ef3882fa824a7dc6054f9f15732b44c863/library/std/src/sys/unix/thread.rs:108:17
  43:     0x7f3b7388ae2d - start_thread
  44:     0x7f3b73910620 - __GI___clone3
  45:                0x0 - <unknown>

(edit starts here)
To people who are reading:

This Github issue contains 2 ICE issues

The original code I minimised causes an ICE on stable, beta and nightly
But the further-minimised code only causes ICEs on beta and nightly, and therefore is a separate issue

@madonuko madonuko 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 Jul 24, 2022
@5225225
Copy link
Contributor

5225225 commented Jul 24, 2022

Minimised example: Uhhh... A different issue?

pub trait MyComponent {
    type Properties;
}

impl<M> MyComponent for M
where
    M: 'static,
{
    type Properties = ();
}

fn main() {
    |_: <&u8 as MyComponent>::Properties| {};
}

@5225225
Copy link
Contributor

5225225 commented Jul 24, 2022

searched nightlies: from nightly-2022-04-01 to nightly-2022-07-24
regressed nightly: nightly-2022-06-08
searched commit range: 50b0025...5435ed6
regressed commit: bb55bd4

bisected with cargo-bisect-rustc v0.6.1

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start 2022-04-01 --end 2022-07-24 --preserve --regress ice -- build 

#95565

@madonuko
Copy link
Author

Minimised example:

pub trait MyComponent {
    type Properties;
}

impl<M> MyComponent for M
where
    M: 'static,
{
    type Properties = ();
}

fn main() {
    |_: <&u8 as MyComponent>::Properties| {};
}

image
The minimised code is actually a separate issue; no ICE under stable.

@5225225
Copy link
Contributor

5225225 commented Jul 24, 2022

pub trait MyComponent {
    type Properties;
}

impl<M> MyComponent for M
where
    M: 'static,
{
    type Properties = TableProps<M>;
}

pub struct TableProps<M>
where
    M: 'static,
{
    pub entries: M,
}

fn main() {
    |_: <&u32 as MyComponent>::Properties| {};
}

Hmm... try this? This does seem to ICE on stable.

@madonuko
Copy link
Author

madonuko commented Jul 24, 2022

This is probably it even though this panics at compiler/rustc_borrowck/src/region_infer/mod.rs:2174:9, which has a different line number to the original ICE.

@madonuko madonuko changed the title Yew causes rustc panic (patternfly_yew Table): no entry found for key borrowck: no entry found for key Jul 24, 2022
@aliemjay
Copy link
Member

@rustbot claim

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jul 29, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Sep 2, 2022
…stebank

don't ICE when normalizing closure input tys

We were ICEing while rendering diagnostics because `universe_causes` is expected to track every universe created in the typeck's infcx.

`normalize_and_add_constraints` doesn't update `universe_causes`
when creating new universes, causing an ICE. Remove it!

Add spans to better track normalization constraints.

Fix couple places where `universe_causes` is not updated correctly to
track newly added universes.

Fixes rust-lang#99665
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Sep 2, 2022
…stebank

don't ICE when normalizing closure input tys

We were ICEing while rendering diagnostics because `universe_causes` is expected to track every universe created in the typeck's infcx.

`normalize_and_add_constraints` doesn't update `universe_causes`
when creating new universes, causing an ICE. Remove it!

Add spans to better track normalization constraints.

Fix couple places where `universe_causes` is not updated correctly to
track newly added universes.

Fixes rust-lang#99665
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Sep 2, 2022
…stebank

don't ICE when normalizing closure input tys

We were ICEing while rendering diagnostics because `universe_causes` is expected to track every universe created in the typeck's infcx.

`normalize_and_add_constraints` doesn't update `universe_causes`
when creating new universes, causing an ICE. Remove it!

Add spans to better track normalization constraints.

Fix couple places where `universe_causes` is not updated correctly to
track newly added universes.

Fixes rust-lang#99665
@JohnTitor
Copy link
Member

Triage: #101708 fixed the issue and it has a regression test that seems to cover this case, closing as fixed.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 8, 2022
…ackh726

don't ICE when normalizing closure input tys

We were ICEing while rendering diagnostics because `universe_causes` is expected to track every universe created in the typeck's infcx.

`normalize_and_add_constraints` doesn't update `universe_causes`
when creating new universes, causing an ICE. Remove it!

Add spans to better track normalization constraints.

Fix couple places where `universe_causes` is not updated correctly to
track newly added universes.

Fixes rust-lang#102800

~Fixess rust-lang#99665~ (UPDATE: no longer true; the issue has a different failure path than when this PR was created and should be fixed by rust-lang#101708, but the changes in this PR are still correct and should prevent potential future ICEs)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 8, 2022
…ackh726

don't ICE when normalizing closure input tys

We were ICEing while rendering diagnostics because `universe_causes` is expected to track every universe created in the typeck's infcx.

`normalize_and_add_constraints` doesn't update `universe_causes`
when creating new universes, causing an ICE. Remove it!

Add spans to better track normalization constraints.

Fix couple places where `universe_causes` is not updated correctly to
track newly added universes.

Fixes rust-lang#102800

~Fixess rust-lang#99665~ (UPDATE: no longer true; the issue has a different failure path than when this PR was created and should be fixed by rust-lang#101708, but the changes in this PR are still correct and should prevent potential future ICEs)
notriddle added a commit to notriddle/rust that referenced this issue Oct 9, 2022
…ackh726

don't ICE when normalizing closure input tys

We were ICEing while rendering diagnostics because `universe_causes` is expected to track every universe created in the typeck's infcx.

`normalize_and_add_constraints` doesn't update `universe_causes`
when creating new universes, causing an ICE. Remove it!

Add spans to better track normalization constraints.

Fix couple places where `universe_causes` is not updated correctly to
track newly added universes.

Fixes rust-lang#102800

~Fixess rust-lang#99665~ (UPDATE: no longer true; the issue has a different failure path than when this PR was created and should be fixed by rust-lang#101708, but the changes in this PR are still correct and should prevent potential future ICEs)
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. 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