Closed
Description
Code
impl X {
fn getn<const N: usize>() -> [u8; N] {
getn::<N>()
}
}
fn getn<const N: cfg_attr>() -> [u8; N] {}
Meta
rustc --version --verbose
:
rustc 1.52.0-nightly (36f1f04f1 2021-03-17)
binary: rustc
commit-hash: 36f1f04f18b89ba4a999bcfd6584663fd6fc1c5d
commit-date: 2021-03-17
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0
Error output
error[E0412]: cannot find type `X` in this scope
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:6
|
1 | impl X {
| ^ not found in this scope
error[E0573]: expected type, found built-in attribute `cfg_attr`
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:6:18
|
6 | fn getn<const N: cfg_attr>() -> [u8; N] {}
| ^^^^^^^^ not a type
error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
|
1 | / impl X {
2 | | fn getn<const N: usize>() -> [u8; N] {
3 | | getn::<N>()
4 | | }
5 | | }
6 | | fn getn<const N: cfg_attr>() -> [u8; N] {}
| |__________________________________________^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`
thread 'rustc' panicked at 'assertion failed: `(left == right)`
left: `[type error]`,
right: `usize`: cannot relate constants of different types', /rustc/36f1f04f18b89ba4a999bcfd6584663fd6fc1c5d/compiler/rustc_middle/src/ty/relate.rs:502:5
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.52.0-nightly (36f1f04f1 2021-03-17) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `<impl at perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1: 5:2>::getn`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0412, E0573, E0601.
For more information about an error, try `rustc --explain E0412`.
Backtrace
error[E0412]: cannot find type `X` in this scope
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:6
|
1 | impl X {
| ^ not found in this scope
error[E0573]: expected type, found built-in attribute `cfg_attr`
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:6:18
|
6 | fn getn<const N: cfg_attr>() -> [u8; N] {}
| ^^^^^^^^ not a type
error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
|
1 | / impl X {
2 | | fn getn<const N: usize>() -> [u8; N] {
3 | | getn::<N>()
4 | | }
5 | | }
6 | | fn getn<const N: cfg_attr>() -> [u8; N] {}
| |__________________________________________^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`
thread 'rustc' panicked at 'assertion failed: `(left == right)`
left: `[type error]`,
right: `usize`: cannot relate constants of different types', /rustc/36f1f04f18b89ba4a999bcfd6584663fd6fc1c5d/compiler/rustc_middle/src/ty/relate.rs:502:5
stack backtrace:
0: rust_begin_unwind
at /rustc/36f1f04f18b89ba4a999bcfd6584663fd6fc1c5d/library/std/src/panicking.rs:493:5
1: core::panicking::panic_fmt
at /rustc/36f1f04f18b89ba4a999bcfd6584663fd6fc1c5d/library/core/src/panicking.rs:92:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
4: rustc_middle::ty::relate::super_relate_consts
5: rustc_infer::infer::combine::<impl rustc_infer::infer::InferCtxt>::super_combine_consts
6: rustc_middle::ty::relate::super_relate_tys
7: rustc_infer::infer::combine::<impl rustc_infer::infer::InferCtxt>::super_combine_tys
8: <rustc_infer::infer::sub::Sub as rustc_middle::ty::relate::TypeRelation>::tys
9: rustc_infer::infer::InferCtxt::commit_if_ok
10: rustc_infer::infer::fudge::<impl rustc_infer::infer::InferCtxt>::fudge_inference_if_ok
11: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
12: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
13: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
14: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
15: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
16: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
17: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
18: rustc_typeck::check::check::check_fn
19: rustc_infer::infer::InferCtxtBuilder::enter
20: rustc_typeck::check::typeck
21: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
22: rustc_query_system::query::plumbing::force_query_with_job
23: rustc_query_system::query::plumbing::get_query_impl
24: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
25: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
26: rustc_typeck::check::typeck_item_bodies
27: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
28: rustc_data_structures::stack::ensure_sufficient_stack
29: rustc_query_system::query::plumbing::force_query_with_job
30: rustc_query_system::query::plumbing::get_query_impl
31: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
32: rustc_session::utils::<impl rustc_session::session::Session>::time
33: rustc_typeck::check_crate
34: rustc_interface::passes::analysis
35: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
36: rustc_data_structures::stack::ensure_sufficient_stack
37: rustc_query_system::query::plumbing::force_query_with_job
38: rustc_query_system::query::plumbing::get_query_impl
39: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
40: rustc_interface::passes::QueryContext::enter
41: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
42: rustc_span::with_source_map
43: scoped_tls::ScopedKey<T>::set
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.52.0-nightly (36f1f04f1 2021-03-17) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `<impl at perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1: 5:2>::getn`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0412, E0573, E0601.
For more information about an error, try `rustc --explain E0412`.
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️High priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.Performance or correctness regression from stable to nightly.