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: assoc-const-ty-mismatch.rs -Zsave-analysis: 'not yet implemented', compiler/rustc_infer/src/infer/at.rs #93578

Closed
matthiaskrgr opened this issue Feb 2, 2022 · 2 comments · Fixed by #93728
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

@matthiaskrgr
Copy link
Member

Code

code reduced from ./src/test/ui/associated-consts/assoc-const-ty-mismatch.rs

#![feature(associated_const_equality)]
#![allow(unused)]

pub trait Foo {
  const N: usize;
}

pub struct Bar;

impl Foo for Bar {
  const N: usize = 3;
}


fn foo<F: Foo<N=usize>>() {}
//~^ ERROR mismatch in

fn main() {
  foo::<Bar>();
}

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (1ea485171 2022-02-01)
binary: rustc
commit-hash: 1ea4851715893ee3f365a8ef09d47165e9a7864f
commit-date: 2022-02-01
host: x86_64-unknown-linux-gnu
release: 1.60.0-nightly
LLVM version: 13.0.0

(master toolchain)

Error output

rustc ./src/test/ui/associated-consts/assoc-const-ty-mismatch.rs -Zsave-analysis

error: mismatch in bind of associated constant, got type
  --> ./src/test/ui/associated-consts/assoc-const-ty-mismatch.rs:15:15
   |
15 | fn foo<F: Foo<N=usize>>() {}
   |               ^^^^^^^
   |
note: associated constant defined here does not match type
  --> ./src/test/ui/associated-consts/assoc-const-ty-mismatch.rs:5:3
   |
5  |   const N: usize;
   |   ^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'not yet implemented', compiler/rustc_infer/src/infer/at.rs:304:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.60.0-nightly (1ea485171 2022-02-01) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `<Bar as Foo>::N == usize`
#1 [typeck] type-checking `main`
end of query stack
error: aborting due to previous error
Backtrace

thread 'rustc' panicked at 'not yet implemented', compiler/rustc_infer/src/infer/at.rs:304:23
stack backtrace:
   0:     0x7fade2819c2c - std::backtrace_rs::backtrace::libunwind::trace::h97b555d93e806b9e
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fade2819c2c - std::backtrace_rs::backtrace::trace_unsynchronized::hdaab24071cbd11d1
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fade2819c2c - std::sys_common::backtrace::_print_fmt::hd526f02663d74738
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fade2819c2c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8696deb8999a5f33
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7fade287b09c - core::fmt::write::h781fa008b8888eae
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/core/src/fmt/mod.rs:1190:17
   5:     0x7fade28091e3 - std::io::Write::write_fmt::h4ef48abde47b3baa
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/io/mod.rs:1653:15
   6:     0x7fade281e052 - std::sys_common::backtrace::_print::hcd70c906367332f8
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7fade281e052 - std::sys_common::backtrace::print::hdfafa975cab291c8
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7fade281e052 - std::panicking::default_hook::{{closure}}::hcc77563b35700099
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/panicking.rs:290:50
   9:     0x7fade281dc35 - std::panicking::default_hook::h988215e4515b4e8c
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/panicking.rs:307:9
  10:     0x7fade2ffd571 - rustc_driver[b8c5cee21782833e]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fade281e86b - std::panicking::rust_panic_with_hook::ha5380a958bb71ca0
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/panicking.rs:695:17
  12:     0x7fade281e4e9 - std::panicking::begin_panic_handler::{{closure}}::hfefc5ab6450420bd
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/panicking.rs:579:13
  13:     0x7fade281a0d4 - std::sys_common::backtrace::__rust_end_short_backtrace::h3e4f67c6fca92ca4
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/sys_common/backtrace.rs:139:18
  14:     0x7fade281e239 - rust_begin_unwind
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/panicking.rs:577:5
  15:     0x7fade27e57f3 - core::panicking::panic_fmt::h9519158c6a4a8e92
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/core/src/panicking.rs:135:14
  16:     0x7fade27e56cd - core::panicking::panic::he4b7fa492097ef53
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/core/src/panicking.rs:48:5
  17:     0x7fade4c66284 - <rustc_middle[f81dc3bd746ca440]::ty::Term as rustc_infer[315d8358460fe4ad]::infer::at::ToTrace>::to_trace
  18:     0x7fade4ba7d00 - <rustc_infer[315d8358460fe4ad]::infer::InferCtxt>::commit_if_ok::<core[9c864a1268b8bc28]::result::Result<core[9c864a1268b8bc28]::option::Option<alloc[5657b11be84882bf]::vec::Vec<rustc_infer[315d8358460fe4ad]::traits::Obligation<rustc_middle[f81dc3bd746ca440]::ty::Predicate>>>, rustc_trait_selection[539f2e6de6887342]::traits::project::InProgress>, rustc_infer[315d8358460fe4ad]::traits::project::MismatchedProjectionTypes, rustc_trait_selection[539f2e6de6887342]::traits::project::poly_project_and_unify_type::{closure#0}>
  19:     0x7fade4ba99fc - <rustc_infer[315d8358460fe4ad]::infer::InferCtxt>::probe::<core[9c864a1268b8bc28]::result::Result<rustc_middle[f81dc3bd746ca440]::traits::select::EvaluationResult, rustc_middle[f81dc3bd746ca440]::traits::select::OverflowError>, <rustc_trait_selection[539f2e6de6887342]::traits::select::SelectionContext>::evaluation_probe<<rustc_trait_selection[539f2e6de6887342]::traits::select::SelectionContext>::evaluate_root_obligation::{closure#0}>::{closure#0}>
  20:     0x7fade4bb1d2c - <rustc_trait_selection[539f2e6de6887342]::traits::select::SelectionContext>::evaluate_root_obligation
  21:     0x7fade487ea1f - rustc_traits[aa9b450ff685432b]::evaluate_obligation::evaluate_obligation
  22:     0x7fade48e2624 - rustc_query_system[76c120c7b626130f]::query::plumbing::get_query::<rustc_query_impl[2379cdb3b7fbe0e9]::queries::evaluate_obligation, rustc_query_impl[2379cdb3b7fbe0e9]::plumbing::QueryCtxt>
  23:     0x7fade4919614 - <rustc_query_impl[2379cdb3b7fbe0e9]::Queries as rustc_middle[f81dc3bd746ca440]::ty::query::QueryEngine>::evaluate_obligation
  24:     0x7fade4b99990 - <rustc_infer[315d8358460fe4ad]::infer::InferCtxt as rustc_trait_selection[539f2e6de6887342]::traits::query::evaluate_obligation::InferCtxtExt>::predicate_must_hold_considering_regions
  25:     0x7fade4bfbed0 - <rustc_trait_selection[539f2e6de6887342]::traits::fulfill::FulfillProcessor>::progress_changed_obligations
  26:     0x7fade4c05f14 - <rustc_data_structures[9e5bb2a265815808]::obligation_forest::ObligationForest<rustc_trait_selection[539f2e6de6887342]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[539f2e6de6887342]::traits::fulfill::FulfillProcessor, rustc_data_structures[9e5bb2a265815808]::obligation_forest::Outcome<rustc_trait_selection[539f2e6de6887342]::traits::fulfill::PendingPredicateObligation, rustc_infer[315d8358460fe4ad]::traits::FulfillmentErrorCode>>
  27:     0x7fade4bf9067 - <rustc_trait_selection[539f2e6de6887342]::traits::fulfill::FulfillmentContext as rustc_infer[315d8358460fe4ad]::traits::engine::TraitEngine>::select_where_possible
  28:     0x7fade4388ed9 - <rustc_typeck[37e53a7353aab7cc]::check::fn_ctxt::FnCtxt>::check_argument_types
  29:     0x7fade43761c9 - <rustc_typeck[37e53a7353aab7cc]::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  30:     0x7fade4372d8a - <rustc_typeck[37e53a7353aab7cc]::check::fn_ctxt::FnCtxt>::check_call
  31:     0x7fade43b731f - <rustc_typeck[37e53a7353aab7cc]::check::fn_ctxt::FnCtxt>::check_expr_kind
  32:     0x7fade437deb6 - <rustc_typeck[37e53a7353aab7cc]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  33:     0x7fade43a54d2 - <rustc_typeck[37e53a7353aab7cc]::check::fn_ctxt::FnCtxt>::check_stmt
  34:     0x7fade43a6414 - <rustc_typeck[37e53a7353aab7cc]::check::fn_ctxt::FnCtxt>::check_block_with_expected
  35:     0x7fade437deb6 - <rustc_typeck[37e53a7353aab7cc]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  36:     0x7fade44bc96f - rustc_typeck[37e53a7353aab7cc]::check::check::check_fn
  37:     0x7fade4434dbb - <rustc_infer[315d8358460fe4ad]::infer::InferCtxtBuilder>::enter::<&rustc_middle[f81dc3bd746ca440]::ty::context::TypeckResults, <rustc_typeck[37e53a7353aab7cc]::check::inherited::InheritedBuilder>::enter<rustc_typeck[37e53a7353aab7cc]::check::typeck_with_fallback<rustc_typeck[37e53a7353aab7cc]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[f81dc3bd746ca440]::ty::context::TypeckResults>::{closure#0}>
  38:     0x7fade4412662 - rustc_typeck[37e53a7353aab7cc]::check::typeck
  39:     0x7fade48b0157 - rustc_query_system[76c120c7b626130f]::query::plumbing::try_execute_query::<rustc_query_impl[2379cdb3b7fbe0e9]::plumbing::QueryCtxt, rustc_query_system[76c120c7b626130f]::query::caches::DefaultCache<rustc_span[d0f60ce72bde622e]::def_id::LocalDefId, &rustc_middle[f81dc3bd746ca440]::ty::context::TypeckResults>>
  40:     0x7fade4911fec - <rustc_query_impl[2379cdb3b7fbe0e9]::Queries as rustc_middle[f81dc3bd746ca440]::ty::query::QueryEngine>::typeck
  41:     0x7fade301a19e - <rustc_save_analysis[e3c0767218553f8d]::dump_visitor::DumpVisitor as rustc_hir[ffba0bf86b6d8ca8]::intravisit::Visitor>::visit_item
  42:     0x7fade301e2e6 - <rustc_save_analysis[e3c0767218553f8d]::dump_visitor::DumpVisitor as rustc_hir[ffba0bf86b6d8ca8]::intravisit::Visitor>::visit_nested_item
  43:     0x7fade2ffffd7 - rustc_hir[ffba0bf86b6d8ca8]::intravisit::walk_mod::<rustc_save_analysis[e3c0767218553f8d]::dump_visitor::DumpVisitor>
  44:     0x7fade300b2b3 - <rustc_middle[f81dc3bd746ca440]::hir::map::Map>::walk_toplevel_module::<rustc_save_analysis[e3c0767218553f8d]::dump_visitor::DumpVisitor>
  45:     0x7fade3016d03 - <rustc_save_analysis[e3c0767218553f8d]::dump_visitor::DumpVisitor>::process_crate
  46:     0x7fade2fdd31e - <rustc_middle[f81dc3bd746ca440]::dep_graph::dep_node::DepKind as rustc_query_system[76c120c7b626130f]::dep_graph::DepKind>::with_deps::<rustc_save_analysis[e3c0767218553f8d]::process_crate<rustc_save_analysis[e3c0767218553f8d]::DumpHandler>::{closure#0}::{closure#0}, ()>
  47:     0x7fade2ff5478 - <std[22fd8536f279bacf]::thread::local::LocalKey<core[9c864a1268b8bc28]::cell::Cell<bool>>>::with::<rustc_middle[f81dc3bd746ca440]::ty::print::pretty::with_no_trimmed_paths<rustc_save_analysis[e3c0767218553f8d]::process_crate<rustc_save_analysis[e3c0767218553f8d]::DumpHandler>::{closure#0}, ()>::{closure#0}, ()>
  48:     0x7fade2fd096d - rustc_save_analysis[e3c0767218553f8d]::process_crate::<rustc_save_analysis[e3c0767218553f8d]::DumpHandler>
  49:     0x7fade2fd3065 - <rustc_session[6f4d93b48e654429]::session::Session>::time::<(), rustc_driver[b8c5cee21782833e]::run_compiler::{closure#1}::{closure#2}::{closure#3}::{closure#0}>
  50:     0x7fade4e578fe - <rustc_interface[ec08951694d4ef8a]::passes::QueryContext>::enter::<rustc_driver[b8c5cee21782833e]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[9c864a1268b8bc28]::result::Result<(), rustc_errors[1adefd6505a5cf85]::ErrorReported>>
  51:     0x7fade4e559ca - <rustc_interface[ec08951694d4ef8a]::interface::Compiler>::enter::<rustc_driver[b8c5cee21782833e]::run_compiler::{closure#1}::{closure#2}, core[9c864a1268b8bc28]::result::Result<core[9c864a1268b8bc28]::option::Option<rustc_interface[ec08951694d4ef8a]::queries::Linker>, rustc_errors[1adefd6505a5cf85]::ErrorReported>>
  52:     0x7fade4e587e6 - rustc_span[d0f60ce72bde622e]::with_source_map::<core[9c864a1268b8bc28]::result::Result<(), rustc_errors[1adefd6505a5cf85]::ErrorReported>, rustc_interface[ec08951694d4ef8a]::interface::create_compiler_and_run<core[9c864a1268b8bc28]::result::Result<(), rustc_errors[1adefd6505a5cf85]::ErrorReported>, rustc_driver[b8c5cee21782833e]::run_compiler::{closure#1}>::{closure#1}>
  53:     0x7fade4e553ae - rustc_interface[ec08951694d4ef8a]::interface::create_compiler_and_run::<core[9c864a1268b8bc28]::result::Result<(), rustc_errors[1adefd6505a5cf85]::ErrorReported>, rustc_driver[b8c5cee21782833e]::run_compiler::{closure#1}>
  54:     0x7fade4e3a362 - std[22fd8536f279bacf]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ec08951694d4ef8a]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[ec08951694d4ef8a]::interface::run_compiler<core[9c864a1268b8bc28]::result::Result<(), rustc_errors[1adefd6505a5cf85]::ErrorReported>, rustc_driver[b8c5cee21782833e]::run_compiler::{closure#1}>::{closure#0}, core[9c864a1268b8bc28]::result::Result<(), rustc_errors[1adefd6505a5cf85]::ErrorReported>>::{closure#0}, core[9c864a1268b8bc28]::result::Result<(), rustc_errors[1adefd6505a5cf85]::ErrorReported>>
  55:     0x7fade4e38db9 - <<std[22fd8536f279bacf]::thread::Builder>::spawn_unchecked_<rustc_interface[ec08951694d4ef8a]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[ec08951694d4ef8a]::interface::run_compiler<core[9c864a1268b8bc28]::result::Result<(), rustc_errors[1adefd6505a5cf85]::ErrorReported>, rustc_driver[b8c5cee21782833e]::run_compiler::{closure#1}>::{closure#0}, core[9c864a1268b8bc28]::result::Result<(), rustc_errors[1adefd6505a5cf85]::ErrorReported>>::{closure#0}, core[9c864a1268b8bc28]::result::Result<(), rustc_errors[1adefd6505a5cf85]::ErrorReported>>::{closure#1} as core[9c864a1268b8bc28]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  56:     0x7fade282a5c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd7d5c17359d3a784
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/alloc/src/boxed.rs:1854:9
  57:     0x7fade282a5c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he103afaaa5161d8a
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/alloc/src/boxed.rs:1854:9
  58:     0x7fade282a5c3 - std::sys::unix::thread::Thread::new::thread_start::h84b2058a5227adde
                               at /rustc/1ea4851715893ee3f365a8ef09d47165e9a7864f/library/std/src/sys/unix/thread.rs:108:17
  59:     0x7fade2730259 - start_thread
  60:     0x7fade264c5e3 - __GI___clone
  61:                0x0 - <unknown>

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.60.0-nightly (1ea485171 2022-02-01) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `<Bar as Foo>::N == usize`
#1 [typeck] type-checking `main`
end of query stack
error: aborting due to previous error

@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 2, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Feb 5, 2022
@matthiaskrgr
Copy link
Member Author

searched nightlies: from nightly-2021-08-01 to nightly-2022-02-05
regressed nightly: nightly-2022-01-19
searched commit range: ee5d8d3...9ad5d82
regressed commit: 7bc7be8

bisected with cargo-bisect-rustc v0.6.1

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

cargo bisect-rustc --test-dir=/home/matthias/vcs/github/rust_bisect/foo --start=2021-08-01 --end=2022-02-05

cc @JulianKnodt

@JulianKnodt
Copy link
Contributor

Ah yes, I need to implement a ToTrace::Term which was deferred from a previous PR because it caused significant changes in generated output

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

Successfully merging a pull request may close this issue.

3 participants