ICE: normalization works on validated constants: InterpErrorInfo(InterpErrorInfoInner..
#117368
Closed
Description
opened on Oct 29, 2023
File: /tmp/icemaker/92054-2.rs
auto-reduced (treereduce-rust):
#![feature(allocator_api)]
use std::alloc::{Allocator, Global, Layout};
fn main() {
let layout: Layout = None.unwrap();
let ptr: *mut u8 = Global.allocate(layout).unwrap().as_ptr() as _;
}
original:
#![feature(allocator_api)]
use std::alloc::{Allocator, Global, Layout};
fn main() {
let layout: Layout = None.unwrap();
let ptr: *mut u8 = Global.allocate(layout).unwrap().as_ptr() as _;
let slice: &mut [u8] = unsafe { std::slice::from_raw_parts_mut(ptr, 0) };
let box_ = unsafe { Box::from_raw_in(slice, &Global) };
box_.len();
}
Version information
rustc 1.75.0-nightly (ec2b31191 2023-10-29)
binary: rustc
commit-hash: ec2b311914a4880235862f3cd65fe24e92e6d3a5
commit-date: 2023-10-29
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.3
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zmir-opt-level=5 --emit=mir
Program output
warning: unused variable: `ptr`
--> /tmp/icemaker_global_tempdir.I5PpfBX0bbbI/rustc_testrunner_tmpdir_reporting.GkFkdOuNpge8/mvce.rs:7:9
|
7 | let ptr: *mut u8 = Global.allocate(layout).unwrap().as_ptr() as _;
| ^^^ help: if this is intentional, prefix it with an underscore: `_ptr`
|
= note: `#[warn(unused_variables)]` on by default
thread 'rustc' panicked at compiler/rustc_const_eval/src/const_eval/eval_queries.rs:136:38:
normalization works on validated constants: InterpErrorInfo(InterpErrorInfoInner { kind: UndefinedBehavior(InvalidUninitBytes(None)), backtrace: InterpErrorBacktrace { backtrace: None } })
stack backtrace:
0: 0x7fd1d0b68e0c - std::backtrace_rs::backtrace::libunwind::trace::h97c5ae221ff4af4e
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7fd1d0b68e0c - std::backtrace_rs::backtrace::trace_unsynchronized::ha027277d1fadb815
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fd1d0b68e0c - std::sys_common::backtrace::_print_fmt::h5d760ce190688f0c
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/sys_common/backtrace.rs:67:5
3: 0x7fd1d0b68e0c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8d39a7b6c062ca37
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7fd1d0bcb070 - core::fmt::rt::Argument::fmt::ha9e9bba672a73c5d
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/fmt/rt.rs:142:9
5: 0x7fd1d0bcb070 - core::fmt::write::h4f72a7fa55620afd
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/fmt/mod.rs:1117:17
6: 0x7fd1d0b5cc9f - std::io::Write::write_fmt::h500c7720c872cf58
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/io/mod.rs:1763:15
7: 0x7fd1d0b68bf4 - std::sys_common::backtrace::_print::h79835c784b180bca
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7fd1d0b68bf4 - std::sys_common::backtrace::print::h56c6570e03565ef2
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7fd1d0b6b887 - std::panicking::default_hook::{{closure}}::h7d720e7d2cb2f8cd
10: 0x7fd1d0b6b5ef - std::panicking::default_hook::h3c21c026f7b87626
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/panicking.rs:292:9
11: 0x7fd1d36e20b0 - std[2019925e5928c835]::panicking::update_hook::<alloc[519b4005d213e202]::boxed::Box<rustc_driver_impl[6b9e304b7d81f4cd]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7fd1d0b6bfc8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h75682bcacc241217
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/alloc/src/boxed.rs:2021:9
13: 0x7fd1d0b6bfc8 - std::panicking::rust_panic_with_hook::h1103c4993d414e2e
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/panicking.rs:735:13
14: 0x7fd1d0b6bd1e - std::panicking::begin_panic_handler::{{closure}}::h9d6aff87d476d436
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/panicking.rs:609:13
15: 0x7fd1d0b692d6 - std::sys_common::backtrace::__rust_end_short_backtrace::hb7b850d85abc2c7f
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/sys_common/backtrace.rs:170:18
16: 0x7fd1d0b6ba82 - rust_begin_unwind
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/panicking.rs:597:5
17: 0x7fd1d0bc7795 - core::panicking::panic_fmt::h625a1a215342a554
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/panicking.rs:72:14
18: 0x7fd1d0bc7e83 - core::result::unwrap_failed::hb75de5d588e8b66b
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/result.rs:1653:5
19: 0x7fd1d52851fb - rustc_const_eval[42a9e80e84d1e3dd]::const_eval::eval_queries::op_to_const
20: 0x7fd1d367855e - <core[cb084f01bea476a3]::iter::adapters::GenericShunt<core[cb084f01bea476a3]::iter::adapters::map::Map<core[cb084f01bea476a3]::ops::range::Range<usize>, rustc_const_eval[42a9e80e84d1e3dd]::const_eval::try_destructure_mir_constant_for_diagnostics::{closure#0}>, core[cb084f01bea476a3]::option::Option<core[cb084f01bea476a3]::convert::Infallible>> as core[cb084f01bea476a3]::iter::traits::iterator::Iterator>::next
21: 0x7fd1d36b8a24 - rustc_const_eval[42a9e80e84d1e3dd]::const_eval::try_destructure_mir_constant_for_diagnostics
22: 0x7fd1d3ae8124 - rustc_middle[4cf6369af5afa934]::mir::pretty::pretty_print_const_value_tcx
23: 0x7fd1d3ad3ea4 - <rustc_middle[4cf6369af5afa934]::mir::consts::Const as core[cb084f01bea476a3]::fmt::Display>::fmt
24: 0x7fd1d0bcb070 - core::fmt::rt::Argument::fmt::ha9e9bba672a73c5d
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/fmt/rt.rs:142:9
25: 0x7fd1d0bcb070 - core::fmt::write::h4f72a7fa55620afd
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/fmt/mod.rs:1117:17
26: 0x7fd1d3aedaa1 - <rustc_middle[4cf6369af5afa934]::mir::VarDebugInfoContents as core[cb084f01bea476a3]::fmt::Debug>::fmt
27: 0x7fd1d0bcb070 - core::fmt::rt::Argument::fmt::ha9e9bba672a73c5d
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/fmt/rt.rs:142:9
28: 0x7fd1d0bcb070 - core::fmt::write::h4f72a7fa55620afd
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/fmt/mod.rs:1117:17
29: 0x7fd1d3adefd2 - <rustc_middle[4cf6369af5afa934]::mir::VarDebugInfo as core[cb084f01bea476a3]::fmt::Debug>::fmt
30: 0x7fd1d0bcaffe - core::fmt::rt::Argument::fmt::ha9e9bba672a73c5d
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/fmt/rt.rs:142:9
31: 0x7fd1d0bcaffe - core::fmt::run::h2cc9ba3e582eee94
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/fmt/mod.rs:1165:5
32: 0x7fd1d0bcaffe - core::fmt::write::h4f72a7fa55620afd
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/fmt/mod.rs:1133:26
33: 0x7fd1d0bb9b5a - <&mut W as core::fmt::Write::write_fmt::SpecWriteFmt>::spec_write_fmt::hcac0eb106aeddf45
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/fmt/mod.rs:208:17
34: 0x7fd1d0bb9b5a - core::fmt::Write::write_fmt::h54403c645354b189
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/core/src/fmt/mod.rs:212:14
35: 0x7fd1d0bb9b5a - alloc::fmt::format::format_inner::h914981c431117040
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/alloc/src/fmt.rs:610:16
36: 0x7fd1d3addc79 - rustc_middle[4cf6369af5afa934]::mir::pretty::write_scope_tree
37: 0x7fd1d3adea89 - rustc_middle[4cf6369af5afa934]::mir::pretty::write_scope_tree
38: 0x7fd1d3adf684 - rustc_middle[4cf6369af5afa934]::mir::pretty::write_mir_intro
39: 0x7fd1d3adb621 - rustc_middle[4cf6369af5afa934]::mir::pretty::write_mir_pretty::{closure#0}
40: 0x7fd1d3ada1ab - rustc_middle[4cf6369af5afa934]::mir::pretty::write_mir_pretty
41: 0x7fd1d3cec0ee - rustc_mir_transform[f54af46e659a9d12]::dump_mir::emit_mir
42: 0x7fd1d555a6d0 - rustc_interface[afe460e687a4486f]::passes::start_codegen
43: 0x7fd1d555a026 - <rustc_interface[afe460e687a4486f]::queries::Queries>::ongoing_codegen
44: 0x7fd1d55245c5 - std[2019925e5928c835]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[afe460e687a4486f]::util::run_in_thread_with_globals<rustc_interface[afe460e687a4486f]::interface::run_compiler<core[cb084f01bea476a3]::result::Result<(), rustc_span[edbf59eb400d0df8]::ErrorGuaranteed>, rustc_driver_impl[6b9e304b7d81f4cd]::run_compiler::{closure#1}>::{closure#0}, core[cb084f01bea476a3]::result::Result<(), rustc_span[edbf59eb400d0df8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb084f01bea476a3]::result::Result<(), rustc_span[edbf59eb400d0df8]::ErrorGuaranteed>>
45: 0x7fd1d5523833 - <<std[2019925e5928c835]::thread::Builder>::spawn_unchecked_<rustc_interface[afe460e687a4486f]::util::run_in_thread_with_globals<rustc_interface[afe460e687a4486f]::interface::run_compiler<core[cb084f01bea476a3]::result::Result<(), rustc_span[edbf59eb400d0df8]::ErrorGuaranteed>, rustc_driver_impl[6b9e304b7d81f4cd]::run_compiler::{closure#1}>::{closure#0}, core[cb084f01bea476a3]::result::Result<(), rustc_span[edbf59eb400d0df8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cb084f01bea476a3]::result::Result<(), rustc_span[edbf59eb400d0df8]::ErrorGuaranteed>>::{closure#1} as core[cb084f01bea476a3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
46: 0x7fd1d0b76d95 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0f88b616a3537b95
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/alloc/src/boxed.rs:2007:9
47: 0x7fd1d0b76d95 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h19081e0b9995d5f3
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/alloc/src/boxed.rs:2007:9
48: 0x7fd1d0b76d95 - std::sys::unix::thread::Thread::new::thread_start::h65f7538c36d3977f
at /rustc/ec2b311914a4880235862f3cd65fe24e92e6d3a5/library/std/src/sys/unix/thread.rs:108:17
49: 0x7fd1d09409eb - <unknown>
50: 0x7fd1d09c47cc - <unknown>
51: 0x0 - <unknown>
error: 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.75.0-nightly (ec2b31191 2023-10-29) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z mir-opt-level=5 -Z dump-mir-dir=dir
query stack during panic:
end of query stack
warning: 1 warning emitted
Activity