Closed
Description
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.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-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`.
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Area: saving results of analyses such as inference and borrowck results to a file.Category: This is a bug.`#![feature(const_generics)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.