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: ./src/test/ui/inference/infer-arg-test.rs: not yet impemented with -Zsave-analysis #89066

Closed
matthiaskrgr opened this issue Sep 18, 2021 · 1 comment · Fixed by #92312
Closed
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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

./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.57.0-nightly (6c33a0a2e 2021-09-18)
binary: rustc
commit-hash: 6c33a0a2ec8a32016fcb35342ae9d08087e38d5c
commit-date: 2021-09-18
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0

Error output

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

error[E0107]: this struct takes 2 generic arguments but 3 generic arguments were supplied
  --> ./src/test/ui/inference/infer-arg-test.rs:18:10
   |
18 |   let a: All<_, _, _>;
   |          ^^^       - help: remove this generic argument
   |          |
   |          expected 2 generic arguments
   |
note: struct defined here, with 2 generic parameters: `T`, `N`
  --> ./src/test/ui/inference/infer-arg-test.rs:3:8
   |
3  | struct All<'a, T, const N: usize> {
   |        ^^^     -        -

thread 'rustc' panicked at 'not yet implemented', compiler/rustc_typeck/src/astconv/mod.rs:462:29
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.57.0-nightly (6c33a0a2e 2021-09-18) 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 6 previous errors

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

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

error[E0107]: this struct takes 2 generic arguments but 3 generic arguments were supplied
  --> ./src/test/ui/inference/infer-arg-test.rs:18:10
   |
18 |   let a: All<_, _, _>;
   |          ^^^       - help: remove this generic argument
   |          |
   |          expected 2 generic arguments
   |
note: struct defined here, with 2 generic parameters: `T`, `N`
  --> ./src/test/ui/inference/infer-arg-test.rs:3:8
   |
3  | struct All<'a, T, const N: usize> {
   |        ^^^     -        -

thread 'rustc' panicked at 'not yet implemented', compiler/rustc_typeck/src/astconv/mod.rs:462:29
stack backtrace:
   0:     0x7f4f60a6251c - std::backtrace_rs::backtrace::libunwind::trace::h2ab374bc2a3b7023
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f4f60a6251c - std::backtrace_rs::backtrace::trace_unsynchronized::h128cb5178b04dc46
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f4f60a6251c - std::sys_common::backtrace::_print_fmt::h5344f9eefca2041f
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f4f60a6251c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h213003bc5c7acf04
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f4f60ac07dc - core::fmt::write::h78bf85fc3e93663f
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/core/src/fmt/mod.rs:1126:17
   5:     0x7f4f60a53405 - std::io::Write::write_fmt::he619515c888f21a5
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/io/mod.rs:1667:15
   6:     0x7f4f60a65a80 - std::sys_common::backtrace::_print::hf706674f77848203
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f4f60a65a80 - std::sys_common::backtrace::print::hf0b6c7a88804ec56
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f4f60a65a80 - std::panicking::default_hook::{{closure}}::h2dde766cd83a333a
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/panicking.rs:210:50
   9:     0x7f4f60a65637 - std::panicking::default_hook::h501e3b2e134eb149
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/panicking.rs:227:9
  10:     0x7f4f61245f51 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::he756f1e8c1181d3b
  11:     0x7f4f60a66299 - std::panicking::rust_panic_with_hook::hc09e869c4cf00885
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/panicking.rs:628:17
  12:     0x7f4f60a65d22 - std::panicking::begin_panic_handler::{{closure}}::hc2c6d70142458fc8
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/panicking.rs:519:13
  13:     0x7f4f60a629c4 - std::sys_common::backtrace::__rust_end_short_backtrace::had58f7c459a1cd6e
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f4f60a65cb9 - rust_begin_unwind
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/panicking.rs:517:5
  15:     0x7f4f60a2b861 - core::panicking::panic_fmt::hf443e5eeb6cc9eab
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/core/src/panicking.rs:103:14
  16:     0x7f4f60a2b7ad - core::panicking::panic::h50b51d19800453c0
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/core/src/panicking.rs:50:5
  17:     0x7f4f625f0360 - <<dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck::astconv::CreateSubstsForGenericArgsCtxt>::provided_kind::hd27533ba044dfdb1
  18:     0x7f4f625ed8a1 - <dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path::hdc70fffec5683393
  19:     0x7f4f625e7a24 - <dyn rustc_typeck::astconv::AstConv>::ast_path_substs_for_ty::h475721814acfe140
  20:     0x7f4f625e8387 - <dyn rustc_typeck::astconv::AstConv>::ast_path_to_ty::h7d884b8259ee57d2
  21:     0x7f4f625f0889 - <dyn rustc_typeck::astconv::AstConv>::ast_ty_to_ty_inner::h3bd2d155d3a92192
  22:     0x7f4f62620e9a - <rustc_typeck::check::gather_locals::GatherLocalsVisitor as rustc_hir::intravisit::Visitor>::visit_local::h49b7cf8e3b7265c2
  23:     0x7f4f62597e76 - rustc_hir::intravisit::walk_expr::h2aa3efa9f6724d3f
  24:     0x7f4f62648153 - rustc_typeck::check::check::check_fn::h22859037fe91ae06
  25:     0x7f4f625ff58d - rustc_infer::infer::InferCtxtBuilder::enter::h6497f632ea603058
  26:     0x7f4f625a66ba - rustc_typeck::check::typeck::h30e85507fb0c045e
  27:     0x7f4f6298589f - rustc_query_system::query::plumbing::try_execute_query::h962ee77e1a4e17d7
  28:     0x7f4f62a0078c - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck::h2edc91f1d8d9a428
  29:     0x7f4f61296fd3 - rustc_save_analysis::dump_visitor::DumpVisitor::nest_typeck_results::hc61e603166c7031b
  30:     0x7f4f6129dfa2 - <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_hir::intravisit::Visitor>::visit_item::h3c1542be36f664dd
  31:     0x7f4f61295fb6 - rustc_hir::intravisit::Visitor::visit_nested_item::hed32e44f3e7a9e0d
  32:     0x7f4f612845e7 - rustc_hir::intravisit::walk_mod::hda2665ecb6d5bb12
  33:     0x7f4f612925a3 - rustc_middle::hir::map::Map::walk_toplevel_module::h5e3c39f11bf1c883
  34:     0x7f4f6129b965 - rustc_save_analysis::dump_visitor::DumpVisitor::process_crate::he52095d5868ac37c
  35:     0x7f4f61276262 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h5135873aa9381dc0
  36:     0x7f4f61278257 - std::thread::local::LocalKey<T>::with::hedc911502788cc56
  37:     0x7f4f6124b287 - rustc_save_analysis::process_crate::h6bb0baa6752a5ec0
  38:     0x7f4f61254967 - rustc_session::utils::<impl rustc_session::session::Session>::time::h88db1609c8457239
  39:     0x7f4f62e13637 - rustc_interface::passes::QueryContext::enter::hcdbb877939d5b3f6
  40:     0x7f4f62dfa901 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h5e6d4aaebb0cf9be
  41:     0x7f4f62de7f9c - rustc_span::with_source_map::h599a6f9fdaefef48
  42:     0x7f4f62dfa22c - scoped_tls::ScopedKey<T>::set::he21a81a9bfc3d569
  43:     0x7f4f62de96ba - std::sys_common::backtrace::__rust_begin_short_backtrace::h81ba4b768f16a523
  44:     0x7f4f62de6865 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h83206074d599cea9
  45:     0x7f4f60a72e33 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h59eef3b9c8a82350
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/alloc/src/boxed.rs:1636:9
  46:     0x7f4f60a72e33 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb5bbe017c347469c
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/alloc/src/boxed.rs:1636:9
  47:     0x7f4f60a72e33 - std::sys::unix::thread::Thread::new::thread_start::h62931528f61e35f5
                               at /rustc/6c33a0a2ec8a32016fcb35342ae9d08087e38d5c/library/std/src/sys/unix/thread.rs:106:17
  48:     0x7f4f6097f259 - start_thread
  49:     0x7f4f608945e3 - __GI___clone
  50:                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.57.0-nightly (6c33a0a2e 2021-09-18) 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 6 previous errors

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

@matthiaskrgr matthiaskrgr 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 Sep 18, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Sep 23, 2021
@Alexendoo
Copy link
Member

No longer ICEs since #91847

@Alexendoo Alexendoo added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Dec 14, 2021
BGR360 added a commit to BGR360/rust that referenced this issue Dec 28, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 5, 2022
Mark-Simulacrum pushed a commit to BGR360/rust that referenced this issue Jan 28, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 29, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 29, 2022
@bors bors closed this as completed in d08e816 Jan 29, 2022
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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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