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: 'index out of bounds: the len is 8 but the index is 8', compiler/rustc_infer/src/infer/error_reporting/nice_region_error/util.rs:61:22 #86053

Closed
Cancelll opened this issue Jun 6, 2021 · 3 comments · Fixed by #86164
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. F-c_variadic `#![feature(c_variadic)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Cancelll
Copy link

Cancelll commented Jun 6, 2021

Code

fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
}

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (dbe459ded 2021-06-02)
binary: rustc
commit-hash: dbe459dedd33470f2cb28101157de316caaffa66
commit-date: 2021-06-02
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1

Error output

error: expected type, found `,`
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:47
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                               ^ expected type

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:51
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                                   ^^^^ must be the first parameter of an associated function

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:58
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                                          ^^^^ must be the first parameter of an associated function

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:67
  |
1 | ...            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
  |                                    ^^^^ must be the first parameter of an associated function

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:76
  |
1 | ...   ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
  |                                    ^^^^ must be the first parameter of an associated function

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:91
  |
1 | ...elf ,   self ,   self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
  |                                    ^^^^ must be the first parameter of an associated function

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:100
  |
1 | ...elf ,   self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
  |                                    ^^^^ must be the first parameter of an associated function

error: `...` must be the last argument of a C-variadic function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:83
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                                                                   ^^^^

error: only foreign or `unsafe extern "C" functions may be C-variadic
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:83
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                                                                   ^^^^

error: only foreign or `unsafe extern "C" functions may be C-variadic
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:107
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                                                                                           ^^^^

error[E0412]: cannot find type `F` in this scope
  --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:119
   |
1  |   fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : ...
   |                                                                                                                         ^
   |
help: a trait with a similar name exists
   |
1  | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) {
   |                                                                                                                       ^^
help: you might be missing a type parameter
   |
1  | fn ordering4 < 'a , 'b, F     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
   |                       ^^^

error[E0658]: C-variadic functions are unstable
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:1
  |
1 | / fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : F...
2 | | }
  | |_^
  |
  = note: see issue #44930 <https://github.com/rust-lang/rust/issues/44930> for more information
  = help: add `#![feature(c_variadic)]` to the crate attributes to enable

thread 'rustc' panicked at 'index out of bounds: the len is 8 but the index is 8', compiler/rustc_infer/src/infer/error_reporting/nice_region_error/util.rs:61:22
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.54.0-nightly (dbe459ded 2021-06-02) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=3 -Z new-llvm-pass-manager=yes -Z unsound-mir-opts=yes -Z polonius=yes -Z polymorphize=yes -C debuginfo=2 -C opt-level=3 --crate-type staticlib

query stack during panic:
#0 [check_item_well_formed] checking that `ordering4` is well-formed
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 12 previous errors

Some errors have detailed explanations: E0412, E0658.
For more information about an error, try `rustc --explain E0412`.
Backtrace

error: expected type, found `,`
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:47
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                               ^ expected type

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:51
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                                   ^^^^ must be the first parameter of an associated function

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:58
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                                          ^^^^ must be the first parameter of an associated function

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:67
  |
1 | ...            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
  |                                    ^^^^ must be the first parameter of an associated function

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:76
  |
1 | ...   ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
  |                                    ^^^^ must be the first parameter of an associated function

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:91
  |
1 | ...elf ,   self ,   self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
  |                                    ^^^^ must be the first parameter of an associated function

error: unexpected `self` parameter in function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:100
  |
1 | ...elf ,   self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
  |                                    ^^^^ must be the first parameter of an associated function

error: `...` must be the last argument of a C-variadic function
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:83
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                                                                   ^^^^

error: only foreign or `unsafe extern "C" functions may be C-variadic
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:83
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                                                                   ^^^^

error: only foreign or `unsafe extern "C" functions may be C-variadic
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:107
  |
1 | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnO...
  |                                                                                                           ^^^^

error[E0412]: cannot find type `F` in this scope
  --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:119
   |
1  |   fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : ...
   |                                                                                                                         ^
   |
help: a trait with a similar name exists
   |
1  | fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) {
   |                                                                                                                       ^^
help: you might be missing a type parameter
   |
1  | fn ordering4 < 'a , 'b, F     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
   |                       ^^^

error[E0658]: C-variadic functions are unstable
 --> default_finding_folder_rust/crash_20210604_133458_002a/delta/perses_result/mutant.rs:1:1
  |
1 | / fn ordering4 < 'a , 'b     > ( a :            ,   self , self ,   self ,   self , ... ,   self ,   self , ... ) where F : F...
2 | | }
  | |_^
  |
  = note: see issue #44930 <https://github.com/rust-lang/rust/issues/44930> for more information
  = help: add `#![feature(c_variadic)]` to the crate attributes to enable

thread 'rustc' panicked at 'index out of bounds: the len is 8 but the index is 8', compiler/rustc_infer/src/infer/error_reporting/nice_region_error/util.rs:61:22
stack backtrace:
   0: rust_begin_unwind
             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/dbe459dedd33470f2cb28101157de316caaffa66/library/core/src/panicking.rs:69:5
   3: rustc_infer::infer::error_reporting::nice_region_error::util::<impl rustc_infer::infer::error_reporting::nice_region_error::NiceRegionError>::find_param_with_region
   4: rustc_infer::infer::error_reporting::nice_region_error::NiceRegionError::try_report_from_nll
   5: rustc_infer::infer::error_reporting::nice_region_error::NiceRegionError::try_report
   6: rustc_infer::infer::error_reporting::nice_region_error::<impl rustc_infer::infer::InferCtxt>::try_report_nice_region_error
   7: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::report_region_errors
   8: rustc_infer::infer::InferCtxt::resolve_regions_and_report_errors
   9: rustc_typeck::check::regionck::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::regionck_item
  10: rustc_typeck::check::inherited::InheritedBuilder::enter
  11: rustc_typeck::check::wfcheck::check_item_fn
  12: rustc_typeck::check::wfcheck::check_item_well_formed
  13: rustc_query_system::query::plumbing::get_query_impl
  14: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_item_well_formed
  15: <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc_hir::intravisit::Visitor>::visit_item
  16: rustc_data_structures::sync::par_for_each_in
  17: rustc_hir::hir::Crate::par_visit_all_item_likes
  18: rustc_session::session::Session::track_errors
  19: rustc_typeck::check_crate
  20: rustc_interface::passes::analysis
  21: rustc_query_system::query::plumbing::get_query_impl
  22: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  23: rustc_interface::passes::QueryContext::enter
  24: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.54.0-nightly (dbe459ded 2021-06-02) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=3 -Z new-llvm-pass-manager=yes -Z unsound-mir-opts=yes -Z polonius=yes -Z polymorphize=yes -C debuginfo=2 -C opt-level=3 --crate-type staticlib

query stack during panic:
#0 [check_item_well_formed] checking that `ordering4` is well-formed
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 12 previous errors

Some errors have detailed explanations: E0412, E0658.
For more information about an error, try `rustc --explain E0412`.

@Cancelll Cancelll added the C-bug Category: This is a bug. label Jun 6, 2021
@Cancelll
Copy link
Author

Cancelll commented Jun 6, 2021

Sorry, it seems that I selected a wrong issue template. This should be a Internal Compiler Error issue.

@jonas-schievink jonas-schievink added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-prioritize Issue: Indicates that prioritization has been requested for this issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-diagnostics Area: Messages for errors, warnings, and lints labels Jun 6, 2021
@hellow554
Copy link
Contributor

hellow554 commented Jun 7, 2021

Not so cryptic ;)

trait H<T> {}

unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), ...) {}

fn main() {}

the keys for the ICE are the double reference with the second one not being a 'static lifetime (the first one can be static or not, doesn't matter), a trait and the "variadic argument". This should compile but the output clearly says that it's unstable atm.

@JohnTitor JohnTitor added the F-c_variadic `#![feature(c_variadic)]` label Jun 8, 2021
@apiraino
Copy link
Contributor

apiraino commented Jun 8, 2021

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jun 8, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Jun 11, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 12, 2021
@bors bors closed this as completed in cb3c4ee Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. F-c_variadic `#![feature(c_variadic)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority 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