Closed
Description
Code
code from ./src/test/ui/inference/infer-arg-test.rs
#![feature(generic_arg_infer)]
struct All<'a, T, const N: usize> {
v: &'a T,
}
struct BadInfer<_>;
//~^ ERROR expected identifier
//~| ERROR parameter `_` is never used
fn all_fn<'a, T, const N: usize>() {}
fn bad_infer_fn<_>() {}
//~^ ERROR expected identifier
fn main() {
let a: All<_, _, _>;
all_fn();
let v: [u8; _];
//~^ ERROR in expressions
let v: [u8; 10] = [0; _];
//~^ ERROR in expressions
}
Meta
rustc --version --verbose
:
rustc 1.56.0-nightly (2faabf579 2021-07-27)
binary: rustc
commit-hash: 2faabf579323f5252329264cc53ba9ff803429a3
commit-date: 2021-07-27
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1
Error output
rustc ./src/test/ui/inference/infer-arg-test.rs --emit=mir -Zsave-analysis
error: expected identifier, found reserved identifier `_`
--> ./src/test/ui/inference/infer-arg-test.rs:7:17
|
7 | struct BadInfer<_>;
| ^ expected identifier, found reserved identifier
error: expected identifier, found reserved identifier `_`
--> ./src/test/ui/inference/infer-arg-test.rs:13:17
|
13 | fn bad_infer_fn<_>() {}
| ^ expected identifier, found reserved identifier
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> ./src/test/ui/inference/infer-arg-test.rs:20:15
|
20 | let v: [u8; _];
| ^ `_` not allowed here
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> ./src/test/ui/inference/infer-arg-test.rs:22:25
|
22 | let v: [u8; 10] = [0; _];
| ^ `_` not allowed here
error[E0392]: parameter `_` is never used
--> ./src/test/ui/inference/infer-arg-test.rs:7:17
|
7 | struct BadInfer<_>;
| ^ unused parameter
|
= help: consider removing `_`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `_` to be a const parameter, use `const _: usize` instead
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 18446744073709551615', compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs:666:17
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.56.0-nightly (2faabf579 2021-07-27) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z save-analysis
query stack during panic:
#0 [typeck] type-checking `main`
end of query stack
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0392`.
Backtrace
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 18446744073709551615', compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs:666:17
stack backtrace:
0: 0x7f22f9fe6f50 - std::backtrace_rs::backtrace::libunwind::trace::h99dbb39dca18857d
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
1: 0x7f22f9fe6f50 - std::backtrace_rs::backtrace::trace_unsynchronized::h832861927e9cfedf
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f22f9fe6f50 - std::sys_common::backtrace::_print_fmt::h3d18154c77dcf310
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:67:5
3: 0x7f22f9fe6f50 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he312f4ad5b9bb346
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:46:22
4: 0x7f22fa054bbc - core::fmt::write::h9a6d9c74526a6c1b
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/core/src/fmt/mod.rs:1115:17
5: 0x7f22f9fd8835 - std::io::Write::write_fmt::h6aced00850e8186f
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/io/mod.rs:1665:15
6: 0x7f22f9feac6b - std::sys_common::backtrace::_print::h65d996766de40da4
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:49:5
7: 0x7f22f9feac6b - std::sys_common::backtrace::print::h40df9727e635f303
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:36:9
8: 0x7f22f9feac6b - std::panicking::default_hook::{{closure}}::hd2da4327dea91a51
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:208:50
9: 0x7f22f9fea741 - std::panicking::default_hook::h3d55120ad6ada158
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:225:9
10: 0x7f22fa7c7611 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::h6c854bb74ca75dad
11: 0x7f22f9feb499 - std::panicking::rust_panic_with_hook::hf85dd0bb545e3b55
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:626:17
12: 0x7f22f9feaf57 - std::panicking::begin_panic_handler::{{closure}}::h736ae969434da9fa
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:519:13
13: 0x7f22f9fe742c - std::sys_common::backtrace::__rust_end_short_backtrace::h6133bb80b1d6c3e0
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:141:18
14: 0x7f22f9feaeb9 - rust_begin_unwind
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:515:5
15: 0x7f22f9fb5f81 - core::panicking::panic_fmt::hcf5f6d96e1dd7099
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/core/src/panicking.rs:92:14
16: 0x7f22f9fb5f42 - core::panicking::panic_bounds_check::hc3a71010bf41c72d
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/core/src/panicking.rs:69:5
17: 0x7f22faba6329 - rustc_typeck::structured_errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs::suggest_removing_args_or_generics::{{closure}}::hf7f6b556e6f9c75c
18: 0x7f22faba77e2 - <rustc_typeck::structured_errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs as rustc_typeck::structured_errors::StructuredDiagnostic>::diagnostic_common::h7ab3352e03ddc8a9
19: 0x7f22faba7b4e - rustc_typeck::structured_errors::StructuredDiagnostic::diagnostic::h00dc74c119a018fe
20: 0x7f22fba28175 - rustc_typeck::astconv::generics::<impl dyn rustc_typeck::astconv::AstConv>::check_generic_arg_count::hdc263cf6ac832da9
21: 0x7f22fba32a19 - <dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path::hd223e8d65f743a51
22: 0x7f22fba28524 - <dyn rustc_typeck::astconv::AstConv>::ast_path_substs_for_ty::h264b3d7889f50819
23: 0x7f22fba28e97 - <dyn rustc_typeck::astconv::AstConv>::ast_path_to_ty::hbbd3b7dc3215ba55
24: 0x7f22fba3a393 - <dyn rustc_typeck::astconv::AstConv>::ast_ty_to_ty_inner::h4287f9a779db609e
25: 0x7f22fba5431a - <rustc_typeck::check::gather_locals::GatherLocalsVisitor as rustc_hir::intravisit::Visitor>::visit_local::hfc9845ae20023576
26: 0x7f22fb9db7c6 - rustc_hir::intravisit::walk_expr::h79b2d984788f036d
27: 0x7f22fba82a5c - rustc_typeck::check::check::check_fn::hc694e9e945ca264d
28: 0x7f22fba15151 - rustc_infer::infer::InferCtxtBuilder::enter::h6225979c81d985d9
29: 0x7f22fb9f76a6 - rustc_typeck::check::typeck::h35dd1273fa5e7037
30: 0x7f22fbe57f7c - rustc_query_system::query::plumbing::get_query_impl::h7bdc67bd72f2b503
31: 0x7f22fbeb895b - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck::hf8cdf7a1cbec959c
32: 0x7f22fa816e7f - rustc_save_analysis::dump_visitor::DumpVisitor::nest_typeck_results::h4175b523f4f3a47c
33: 0x7f22fa81e4cf - <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_hir::intravisit::Visitor>::visit_item::hc0277f0c7da69c10
34: 0x7f22fa816486 - rustc_hir::intravisit::Visitor::visit_nested_item::he1fbdba27ada54dd
35: 0x7f22fa803c3a - rustc_hir::intravisit::walk_crate::hd2830244a51e54e5
36: 0x7f22fa81bdd6 - rustc_save_analysis::dump_visitor::DumpVisitor::process_crate::h460950e7d4f34bfa
37: 0x7f22fa7f71bb - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h220f1c9e41af2c61
38: 0x7f22fa7f93a7 - std::thread::local::LocalKey<T>::with::h57ebcb278e092aba
39: 0x7f22fa7c94f7 - rustc_save_analysis::process_crate::h3981e5848b01d68d
40: 0x7f22fa7d4f47 - rustc_session::utils::<impl rustc_session::session::Session>::time::h16fd035cc296538b
41: 0x7f22fc2af5dc - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h3903b65ffca1d745
42: 0x7f22fc29d98c - rustc_span::with_source_map::hdc8c4c7d7611fe77
43: 0x7f22fc2b00ba - rustc_interface::interface::create_compiler_and_run::hbe7a78745769ff96
44: 0x7f22fc2a2e19 - scoped_tls::ScopedKey<T>::set::ha164143a03306a1b
45: 0x7f22fc29eeba - std::sys_common::backtrace::__rust_begin_short_backtrace::h4dd3c27220dda569
46: 0x7f22fc29e335 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h546778848e9193e6
47: 0x7f22f9ff7a27 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h09f167e08fc945ff
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/alloc/src/boxed.rs:1572:9
48: 0x7f22f9ff7a27 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf814fe85eeb118e0
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/alloc/src/boxed.rs:1572:9
49: 0x7f22f9ff7a27 - std::sys::unix::thread::Thread::new::thread_start::hb71b17934c5f5e68
at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys/unix/thread.rs:91:17
50: 0x7f22f9f03259 - start_thread
51: 0x7f22f9e185e3 - __GI___clone
52: 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.56.0-nightly (2faabf579 2021-07-27) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z save-analysis
query stack during panic:
#0 [typeck] type-checking `main`
end of query stack
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0392`.