Closed
Description
Code
use std::mem;
struct MyStr(str);
const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
fn main() {}
Meta
rustc --version --verbose
:
rustc 1.52.0-nightly (107896c32 2021-03-15)
binary: rustc
commit-hash: 107896c32d5dda4db508968ff34997a39d286966
commit-date: 2021-03-15
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0
Error output
warning: struct is never constructed: `MyStr`
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:8
|
2 | struct MyStr(str);
| ^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: constant is never used: `MYSTR_NO_INIT`
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:1
|
3 | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: internal compiler error: compiler/rustc_mir/src/interpret/validity.rs:948:17: Unexpected error during validation: unable to turn pointer into raw bytes
thread 'rustc' panicked at 'Box<Any>', /rustc/107896c32d5dda4db508968ff34997a39d286966/library/std/src/panic.rs:59:5
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.52.0-nightly (107896c32 2021-03-15) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `MYSTR_NO_INIT`
#1 [eval_to_const_value_raw] simplifying constant for the type system `MYSTR_NO_INIT`
end of query stack
error: aborting due to previous error; 2 warnings emitted
Backtrace
warning: struct is never constructed: `MyStr`
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:8
|
2 | struct MyStr(str);
| ^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: constant is never used: `MYSTR_NO_INIT`
--> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:1
|
3 | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: internal compiler error: compiler/rustc_mir/src/interpret/validity.rs:948:17: Unexpected error during validation: unable to turn pointer into raw bytes
thread 'rustc' panicked at 'Box<Any>', /rustc/107896c32d5dda4db508968ff34997a39d286966/library/std/src/panic.rs:59:5
stack backtrace:
0: std::panicking::begin_panic
1: std::panic::panic_any
2: rustc_errors::HandlerInner::bug
3: rustc_errors::Handler::bug
4: rustc_middle::ty::context::tls::with_opt
5: rustc_middle::util::bug::opt_span_bug_fmt
6: rustc_middle::util::bug::bug_fmt
7: rustc_mir::interpret::validity::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::validate_operand_internal
8: rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider
9: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::eval_to_allocation_raw>::compute
10: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
11: rustc_data_structures::stack::ensure_sufficient_stack
12: rustc_query_system::query::plumbing::force_query_with_job
13: rustc_query_system::query::plumbing::get_query_impl
14: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw
15: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
16: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::eval_to_const_value_raw>::compute
17: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
18: rustc_data_structures::stack::ensure_sufficient_stack
19: rustc_query_system::query::plumbing::force_query_with_job
20: rustc_query_system::query::plumbing::get_query_impl
21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw
22: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
23: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::eval_to_const_value_raw>::compute
24: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
25: rustc_data_structures::stack::ensure_sufficient_stack
26: rustc_query_system::query::plumbing::force_query_with_job
27: rustc_query_system::query::plumbing::get_query_impl
28: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw
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_poly
31: <rustc_lint::BuiltinCombinedLateLintPass as rustc_lint::passes::LateLintPass>::check_item
32: rustc_hir::intravisit::Visitor::visit_nested_item
33: rustc_hir::intravisit::walk_crate
34: rustc_session::utils::<impl rustc_session::session::Session>::time
35: std::panic::catch_unwind
36: rustc_session::utils::<impl rustc_session::session::Session>::time
37: rustc_interface::passes::analysis
38: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
39: rustc_data_structures::stack::ensure_sufficient_stack
40: rustc_query_system::query::plumbing::force_query_with_job
41: rustc_query_system::query::plumbing::get_query_impl
42: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
43: rustc_interface::passes::QueryContext::enter
44: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
45: rustc_span::with_source_map
46: scoped_tls::ScopedKey<T>::set
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.52.0-nightly (107896c32 2021-03-15) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `MYSTR_NO_INIT`
#1 [eval_to_const_value_raw] simplifying constant for the type system `MYSTR_NO_INIT`
#2 [eval_to_const_value_raw] simplifying constant for the type system `MYSTR_NO_INIT`
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error; 2 warnings emitted
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Category: This is a bug.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.