Closed
Description
Sorry if this is a duplicate. I tried to search but failed to fine a duplicate one.
Code
fn sof<usize>() -> usize {}
fn test<T>() {
let _: [u8; sof::<T>()];
}
Meta
rustc --version --verbose
:
rustc 1.50.0-nightly (fa4163942 2020-12-14)
binary: rustc
commit-hash: fa416394275d2468d104b8f72ac31b1ddf7ee52e
commit-date: 2020-12-14
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly
Error output
warning: type parameter `usize` should have an upper camel case name
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:8
|
1 | fn sof<usize>() -> usize {}
| ^^^^^ help: convert the identifier to upper camel case (notice the capitalization): `Usize`
|
= note: `#[warn(non_camel_case_types)]` on by default
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 | / fn sof<usize>() -> usize {}
2 | | fn test<T>() {
3 | | let _: [u8; sof::<T>()];
4 | | }
| |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`
error[E0308]: mismatched types
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:20
|
1 | fn sof<usize>() -> usize {}
| --- ----- ^^^^^ expected type parameter `usize`, found `()`
| | |
| | this type parameter
| implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type parameter `usize`
found unit type `()`
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:23
|
1 | fn sof<usize>() -> usize {}
| ----- required by this bound in `sof`
2 | fn test<T>() {
| - this type parameter needs to be `Sized`
3 | let _: [u8; sof::<T>()];
| ^ doesn't have a size known at compile-time
|
help: consider relaxing the implicit `Sized` restriction
|
1 | fn sof<usize: ?Sized>() -> usize {}
| ^^^^^^^^
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_middle/src/ty/mod.rs:893:14
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.50.0-nightly (fa4163942 2020-12-14) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `test::{constant#0}`
#1 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#0}`
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted
Some errors have detailed explanations: E0277, E0308, E0601.
For more information about an error, try `rustc --explain E0277`.
Backtrace
warning: type parameter `usize` should have an upper camel case name
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:8
|
1 | fn sof<usize>() -> usize {}
| ^^^^^ help: convert the identifier to upper camel case (notice the capitalization): `Usize`
|
= note: `#[warn(non_camel_case_types)]` on by default
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 | / fn sof<usize>() -> usize {}
2 | | fn test<T>() {
3 | | let _: [u8; sof::<T>()];
4 | | }
| |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`
error[E0308]: mismatched types
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:20
|
1 | fn sof<usize>() -> usize {}
| --- ----- ^^^^^ expected type parameter `usize`, found `()`
| | |
| | this type parameter
| implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected type parameter `usize`
found unit type `()`
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:23
|
1 | fn sof<usize>() -> usize {}
| ----- required by this bound in `sof`
2 | fn test<T>() {
| - this type parameter needs to be `Sized`
3 | let _: [u8; sof::<T>()];
| ^ doesn't have a size known at compile-time
|
help: consider relaxing the implicit `Sized` restriction
|
1 | fn sof<usize: ?Sized>() -> usize {}
| ^^^^^^^^
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_middle/src/ty/mod.rs:893:14
stack backtrace:
0: rust_begin_unwind
at /rustc/fa416394275d2468d104b8f72ac31b1ddf7ee52e/library/std/src/panicking.rs:493:5
1: core::panicking::panic_fmt
at /rustc/fa416394275d2468d104b8f72ac31b1ddf7ee52e/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/fa416394275d2468d104b8f72ac31b1ddf7ee52e/library/core/src/panicking.rs:69:5
3: rustc_middle::ty::Generics::param_at
4: rustc_middle::ty::error::<impl rustc_middle::ty::context::TyCtxt>::note_and_explain_type_err
5: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::note_type_err
6: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::report_and_explain_type_error
7: rustc_infer::infer::InferCtxt::report_mismatched_types
8: rustc_typeck::check::demand::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::demand_coerce_diag
9: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_coercable_to_type
10: rustc_infer::infer::InferCtxtBuilder::enter
11: rustc_typeck::check::typeck
12: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
13: rustc_data_structures::stack::ensure_sufficient_stack
14: rustc_query_system::query::plumbing::get_query_impl
15: rustc_middle::ty::context::TyCtxt::typeck_opt_const_arg
16: rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider
17: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_allocation_raw>::compute
18: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
19: rustc_query_system::query::plumbing::get_query_impl
20: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
21: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute
22: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
23: rustc_query_system::query::plumbing::get_query_impl
24: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
25: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute
26: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
27: rustc_data_structures::stack::ensure_sufficient_stack
28: rustc_query_system::query::plumbing::get_query_impl
29: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
30: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
31: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const
32: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
33: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty
34: rustc_data_structures::stack::ensure_sufficient_stack
35: rustc_trait_selection::traits::project::normalize
36: <rustc_infer::infer::InferCtxt as rustc_trait_selection::infer::InferCtxtExt>::partially_normalize_associated_types_in
37: rustc_typeck::check::inherited::Inherited::normalize_associated_types_in
38: <rustc_typeck::check::fn_ctxt::FnCtxt as rustc_typeck::astconv::AstConv>::normalize_ty
39: <dyn rustc_typeck::astconv::AstConv>::ast_ty_to_ty_inner
40: <rustc_typeck::check::gather_locals::GatherLocalsVisitor as rustc_hir::intravisit::Visitor>::visit_local
41: rustc_hir::intravisit::walk_expr
42: rustc_typeck::check::check::check_fn
43: rustc_infer::infer::InferCtxtBuilder::enter
44: rustc_typeck::check::typeck
45: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute
46: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
47: rustc_data_structures::stack::ensure_sufficient_stack
48: rustc_query_system::query::plumbing::get_query_impl
49: rustc_query_system::query::plumbing::ensure_query_impl
50: rustc_typeck::check::typeck_item_bodies
51: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_item_bodies>::compute
52: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
53: rustc_data_structures::stack::ensure_sufficient_stack
54: rustc_query_system::query::plumbing::get_query_impl
55: rustc_typeck::check_crate
56: rustc_interface::passes::analysis
57: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
58: rustc_query_system::dep_graph::graph::DepGraph<K>::with_eval_always_task
59: rustc_data_structures::stack::ensure_sufficient_stack
60: rustc_query_system::query::plumbing::get_query_impl
61: rustc_interface::passes::QueryContext::enter
62: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
63: rustc_span::with_source_map
64: rustc_interface::interface::create_compiler_and_run
65: 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.50.0-nightly (fa4163942 2020-12-14) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `test::{constant#0}`
#1 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#0}`
#2 [eval_to_const_value_raw] simplifying constant for the type system `test::{constant#0}`
#3 [eval_to_const_value_raw] simplifying constant for the type system `test::{constant#0}`
#4 [typeck] type-checking `test`
#5 [typeck_item_bodies] type-checking all item bodies
#6 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted
Some errors have detailed explanations: E0277, E0308, E0601.
For more information about an error, try `rustc --explain E0277`.
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium 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 one stable version to another.