Closed
Description
Encountered after refactoring code from #80742 and it doesn't look like the same bug.
Code
#![feature(const_evaluatable_checked)]
#![feature(const_generics)]
use core::marker::PhantomData;
use core::mem::size_of;
struct Object<T: ?Sized, const N: usize> {
_phantom: PhantomData<T>,
}
fn bang<U>(val: U) -> Object<U, { size_of::<U>() }> {
todo!()
}
fn main() {
let _ = bang(0u32);
}
Meta
rustc --version --verbose
:
rustc 1.51.0-nightly (da305a2b0 2021-01-05)
binary: rustc
commit-hash: da305a2b00530aa34dea4e48389204c26fa35dbb
commit-date: 2021-01-05
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
Error output
Compiling icey v0.1.0 (/tmp/icey)
warning: the feature `const_evaluatable_checked` is incomplete and may not be safe to use and/or cause compiler crashes
--> src/main.rs:1:12
|
1 | #![feature(const_evaluatable_checked)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> src/main.rs:2:12
|
2 | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error: internal compiler error: compiler/rustc_middle/src/ich/impls_ty.rs:167:9: ty::TyKind::hash_stable() - can't hash a TyVid _#2t.
thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.51.0-nightly (da305a2b0 2021-01-05) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to previous error; 2 warnings emitted
error: could not compile `icey`
To learn more, run the command again with --verbose.
Backtrace
Compiling icey v0.1.0 (/tmp/icey)
warning: the feature `const_evaluatable_checked` is incomplete and may not be safe to use and/or cause compiler crashes
--> src/main.rs:1:12
|
1 | #![feature(const_evaluatable_checked)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> src/main.rs:2:12
|
2 | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error: internal compiler error: compiler/rustc_middle/src/ich/impls_ty.rs:167:9: ty::TyKind::hash_stable() - can't hash a TyVid _#2t.
thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
stack backtrace:
0: std::panicking::begin_panic
1: rustc_errors::HandlerInner::bug
2: rustc_errors::Handler::bug
3: rustc_middle::ty::context::tls::with_opt
4: rustc_middle::util::bug::opt_span_bug_fmt
5: rustc_middle::util::bug::bug_fmt
6: rustc_middle::ty::sty::_DERIVE_rustc_data_structures_stable_hasher_HashStable_rustc_middle_ich_StableHashingContext_ctx_FOR_InferTy::<impl rustc_data_structures::stable_hasher::HashStable<rustc_middle::ich::hcx::StableHashingContext> for rustc_middle::ty::sty::InferTy>::hash_stable
7: <[T] as rustc_data_structures::stable_hasher::HashStable<CTX>>::hash_stable
8: std::thread::local::LocalKey<T>::with
9: rustc_middle::ich::impls_ty::<impl rustc_data_structures::stable_hasher::HashStable<rustc_middle::ich::hcx::StableHashingContext> for &rustc_middle::ty::list::List<T>>::hash_stable
10: <T as rustc_query_system::dep_graph::dep_node::DepNodeParams<Ctxt>>::to_fingerprint
11: rustc_query_system::dep_graph::dep_node::DepNode<K>::construct
12: rustc_query_system::query::config::QueryVtable<CTX,K,V>::to_dep_node
13: rustc_query_system::query::plumbing::get_query_impl
14: rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations
15: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
16: rustc_infer::infer::fudge::<impl rustc_infer::infer::InferCtxt>::fudge_inference_if_ok
17: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
18: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
19: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
20: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
21: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_decl_initializer
22: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_decl_local
23: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
24: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
25: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
26: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
27: rustc_typeck::check::check::check_fn
28: rustc_infer::infer::InferCtxtBuilder::enter
29: rustc_typeck::check::typeck
30: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute
31: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
32: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
33: rustc_data_structures::stack::ensure_sufficient_stack
34: rustc_query_system::query::plumbing::get_query_impl
35: rustc_query_system::query::plumbing::ensure_query_impl
36: rustc_typeck::check::typeck_item_bodies
37: 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
38: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
39: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
40: rustc_data_structures::stack::ensure_sufficient_stack
41: rustc_query_system::query::plumbing::get_query_impl
42: rustc_typeck::check_crate
43: rustc_interface::passes::analysis
44: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
45: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
46: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
47: rustc_data_structures::stack::ensure_sufficient_stack
48: rustc_query_system::query::plumbing::get_query_impl
49: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
50: rustc_span::with_source_map
51: rustc_interface::interface::create_compiler_and_run
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.51.0-nightly (da305a2b0 2021-01-05) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck] type-checking `main`
#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 previous error; 2 warnings emitted
error: could not compile `icey`
To learn more, run the command again with --verbose.