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: inherent_associated_types, IOOB, snapshot vec #108957

Closed
matthiaskrgr opened this issue Mar 9, 2023 · 3 comments · Fixed by #109410
Closed

ICE: inherent_associated_types, IOOB, snapshot vec #108957

matthiaskrgr opened this issue Mar 9, 2023 · 3 comments · Fixed by #109410
Assignees
Labels
C-bug Category: This is a bug. F-inherent_associated_types `#![feature(inherent_associated_types)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Mar 9, 2023

Code

#![feature(inherent_associated_types)]
#![allow(incomplete_features)]

struct Choose<T>(T);

impl<T: Copy> Choose<T> {
    type Result = Vec<T>;
}

fn main() {
    let _: Choose<&str>::Result = vec!["..."];
}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (900c35403 2023-03-08)
binary: rustc
commit-hash: 900c3540378c8422b8087ffa3db60fa6c8abfcad
commit-date: 2023-03-08
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

<output>
Backtrace

thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', /cargo/registry/src/index.crates.io-6f17d22bba15001f/ena-0.14.1/src/snapshot_vec.rs:199:10
stack backtrace:
   0:     0x7f01d069a53a - std::backtrace_rs::backtrace::libunwind::trace::h5499f6e9ee8d39f8
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f01d069a53a - std::backtrace_rs::backtrace::trace_unsynchronized::h7278d8915e5a8a4f
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f01d069a53a - std::sys_common::backtrace::_print_fmt::h0c7e844ccbe54001
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f01d069a53a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h76f2d4fdd5e6ad12
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f01d06fdcee - core::fmt::write::h1775f2c88ef0e3b9
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/core/src/fmt/mod.rs:1232:17
   5:     0x7f01d068d4e5 - std::io::Write::write_fmt::hfa496b0ed0f58ff3
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/io/mod.rs:1684:15
   6:     0x7f01d069a305 - std::sys_common::backtrace::_print::h995e9f70ef8cb7a5
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f01d069a305 - std::sys_common::backtrace::print::he938621c452cca4c
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f01d069d07f - std::panicking::default_hook::{{closure}}::h54a42fdbf61bd63c
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/panicking.rs:271:22
   9:     0x7f01d069cdbb - std::panicking::default_hook::h237f087925386eb9
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/panicking.rs:290:9
  10:     0x7f01cf4586c5 - <rustc_driver_impl[37bd08e570b8de33]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[9f74edcc8a2533f5]::ops::function::FnOnce<(&core[9f74edcc8a2533f5]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f01d069d8bd - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h86b8a5cdb22895d8
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/alloc/src/boxed.rs:2001:9
  12:     0x7f01d069d8bd - std::panicking::rust_panic_with_hook::h3b3e70d6d2eb55f8
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/panicking.rs:696:13
  13:     0x7f01d069d639 - std::panicking::begin_panic_handler::{{closure}}::hdb26ba8feb23c2d0
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/panicking.rs:583:13
  14:     0x7f01d069a9a6 - std::sys_common::backtrace::__rust_end_short_backtrace::heb4e04cb16e3e639
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f01d069d342 - rust_begin_unwind
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/panicking.rs:579:5
  16:     0x7f01d06fa043 - core::panicking::panic_fmt::h1aa26efd95b582e6
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/core/src/panicking.rs:64:14
  17:     0x7f01d06fa232 - core::panicking::panic_bounds_check::hd383b5be85d8fc1f
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/core/src/panicking.rs:159:5
  18:     0x7f01cd427670 - <ena[f706e7040a3ba6fd]::unify::UnificationTable<ena[f706e7040a3ba6fd]::unify::backing_vec::InPlace<rustc_middle[d952a4eb3363976b]::infer::unify_key::RegionVidKey, &mut alloc[c1cc857fc123d71]::vec::Vec<ena[f706e7040a3ba6fd]::unify::VarValue<rustc_middle[d952a4eb3363976b]::infer::unify_key::RegionVidKey>>, &mut rustc_infer[4dafefd086b6e2df]::infer::undo_log::InferCtxtUndoLogs>>>::uninlined_get_root_key
  19:     0x7f01cd476646 - <rustc_infer[4dafefd086b6e2df]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[4eed4d3f2d6a64c6]::fold::TypeFolder<rustc_middle[d952a4eb3363976b]::ty::context::TyCtxt>>::fold_ty
  20:     0x7f01cd476a17 - <rustc_infer[4dafefd086b6e2df]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[4eed4d3f2d6a64c6]::fold::TypeFolder<rustc_middle[d952a4eb3363976b]::ty::context::TyCtxt>>::fold_ty
  21:     0x7f01cd87cc19 - <rustc_infer[4dafefd086b6e2df]::infer::InferCtxt>::canonicalize_user_type_annotation::<rustc_middle[d952a4eb3363976b]::ty::typeck_results::UserType>
  22:     0x7f01cd4fcd92 - <rustc_hir_typeck[ff4503d8c995715b]::gather_locals::GatherLocalsVisitor as rustc_hir[829d2a01d5dbcc01]::intravisit::Visitor>::visit_local
  23:     0x7f01cd4fcb1d - <rustc_hir_typeck[ff4503d8c995715b]::gather_locals::GatherLocalsVisitor as rustc_hir[829d2a01d5dbcc01]::intravisit::Visitor>::visit_expr
  24:     0x7f01ce375d2e - rustc_hir_typeck[ff4503d8c995715b]::check::check_fn
  25:     0x7f01ce35dd38 - rustc_hir_typeck[ff4503d8c995715b]::typeck
  26:     0x7f01ce4234ec - rustc_query_system[bc9882aaabdaeb26]::query::plumbing::try_execute_query::<rustc_query_impl[d542d75c076a29bb]::queries::typeck, rustc_query_impl[d542d75c076a29bb]::plumbing::QueryCtxt>
  27:     0x7f01cebfca7f - rustc_data_structures[1a1e0f92f2f67e98]::sync::par_for_each_in::<&[rustc_span[312e5fbb5d1460ce]::def_id::LocalDefId], <rustc_middle[d952a4eb3363976b]::hir::map::Map>::par_body_owners<rustc_hir_typeck[ff4503d8c995715b]::typeck_item_bodies::{closure#0}>::{closure#0}>
  28:     0x7f01cebfc83f - rustc_hir_typeck[ff4503d8c995715b]::typeck_item_bodies
  29:     0x7f01cea93ffd - rustc_query_system[bc9882aaabdaeb26]::query::plumbing::try_execute_query::<rustc_query_impl[d542d75c076a29bb]::queries::typeck_item_bodies, rustc_query_impl[d542d75c076a29bb]::plumbing::QueryCtxt>
  30:     0x7f01cea93ceb - <rustc_query_impl[d542d75c076a29bb]::Queries as rustc_middle[d952a4eb3363976b]::ty::query::QueryEngine>::typeck_item_bodies
  31:     0x7f01cd8d1f73 - <rustc_session[ba04d21bdf852ac2]::session::Session>::time::<(), rustc_hir_analysis[db450ef6184d9cb6]::check_crate::{closure#7}>
  32:     0x7f01cd8ce9fd - rustc_hir_analysis[db450ef6184d9cb6]::check_crate
  33:     0x7f01cd8c48e2 - rustc_interface[b840461aee9fca96]::passes::analysis
  34:     0x7f01cec8045d - rustc_query_system[bc9882aaabdaeb26]::query::plumbing::try_execute_query::<rustc_query_impl[d542d75c076a29bb]::queries::analysis, rustc_query_impl[d542d75c076a29bb]::plumbing::QueryCtxt>
  35:     0x7f01cec8015f - <rustc_query_impl[d542d75c076a29bb]::Queries as rustc_middle[d952a4eb3363976b]::ty::query::QueryEngine>::analysis
  36:     0x7f01ceabe0d6 - <rustc_middle[d952a4eb3363976b]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[37bd08e570b8de33]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>>
  37:     0x7f01ce6ae858 - rustc_span[312e5fbb5d1460ce]::with_source_map::<core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>, rustc_interface[b840461aee9fca96]::interface::run_compiler<core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>, rustc_driver_impl[37bd08e570b8de33]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  38:     0x7f01ce6a5fec - std[76763ff83cd4f414]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b840461aee9fca96]::util::run_in_thread_pool_with_globals<rustc_interface[b840461aee9fca96]::interface::run_compiler<core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>, rustc_driver_impl[37bd08e570b8de33]::run_compiler::{closure#1}>::{closure#0}, core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>>
  39:     0x7f01ce6a5a1a - <<std[76763ff83cd4f414]::thread::Builder>::spawn_unchecked_<rustc_interface[b840461aee9fca96]::util::run_in_thread_pool_with_globals<rustc_interface[b840461aee9fca96]::interface::run_compiler<core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>, rustc_driver_impl[37bd08e570b8de33]::run_compiler::{closure#1}>::{closure#0}, core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>>::{closure#1} as core[9f74edcc8a2533f5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7f01d06a77b3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2d50a0adfdb2874f
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/alloc/src/boxed.rs:1987:9
  41:     0x7f01d06a77b3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7afed2ea646a4458
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/alloc/src/boxed.rs:1987:9
  42:     0x7f01d06a77b3 - std::sys::unix::thread::Thread::new::thread_start::h950100cbea36de7e
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys/unix/thread.rs:108:17
  43:     0x7f01cc056bb5 - <unknown>
  44:     0x7f01cc0d8d90 - <unknown>
  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: rustc 1.70.0-nightly (900c35403 2023-03-08) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack

@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-inherent_associated_types `#![feature(inherent_associated_types)]` labels Mar 9, 2023
@fmease
Copy link
Member

fmease commented Mar 9, 2023

Thanks for reporting! I see you took parts of an earlier version of UI test associated-inherent-types/dispatch-on-self-type-0.rs (found in one iteration of #105961) which I had modified precisely because of this ICE, haha. I'm more than aware of this ICE and it's already fixed in a local version of rustc which I am still working on but which I will make public soon.

@rustbot claim

@matthiaskrgr
Copy link
Member Author

Oh.. 😄
I grepped in the repo and for let _: Choose<&str>::Result = vec!["..."]; and couldn't find any file checked in currently.

Im running rustc on an older repo of itself and cut away the unneeded code from the example.

@fmease
Copy link
Member

fmease commented Mar 9, 2023

I grepped in the repo […] and couldn't find any file checked in currently.

Right, that's true. The old version with &str does not exist on master. The new version contains bool instead (no pesky unsolved inference variables 😝).

No worries at all, it's great that you created an issue, I just didn't feel the need to report it as I am actively working on IATs and since I know of several other shortcomings / bugs that are not tracked in GitHub issues but instead mostly in FIXMEs or known-bug UI tests (and a few in my head 😬).

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Mar 15, 2023
@bors bors closed this as completed in 29ac429 May 8, 2023
flip1995 pushed a commit to flip1995/rust that referenced this issue May 20, 2023
…compiler-errors

Introduce `AliasKind::Inherent` for inherent associated types

Allows us to check (possibly generic) inherent associated types for well-formedness.
Type inference now also works properly.

Follow-up to rust-lang#105961. Supersedes rust-lang#108430.
Fixes rust-lang#106722.
Fixes rust-lang#108957.
Fixes rust-lang#109768.
Fixes rust-lang#109789.
Fixes rust-lang#109790.

~Not to be merged before rust-lang#108860 (`AliasKind::Weak`).~

CC `@jackh726`
r? `@compiler-errors`

`@rustbot` label T-types F-inherent_associated_types
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. F-inherent_associated_types `#![feature(inherent_associated_types)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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