Closed
Description
I tried this code:
fn hi() -> impl Sized { std::ptr::null::<u8>() }
fn main() {
let b: Box<dyn Fn() -> Box<u8>> = Box::new(hi);
let boxed = b();
let null = *boxed;
println!("{null:?}");
}
I expected to see this happen: Compiler error, since impl Sized
cannot be coerced to Box<u8>
.
Instead, this happened: Code compiles, segfault
Meta
rustc --version --verbose
:
rustc 1.64.0-nightly (2f3ddd9f5 2022-06-27)
binary: rustc
commit-hash: 2f3ddd9f594adf9773547aa7cedb43c4ac8ffd2f
commit-date: 2022-06-27
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessCritical priorityRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.
Activity
JakobDegen commentedon Jun 28, 2022
This regressed in 1.61, unfortunately my wifi is not currently up for running a proper bisect.
@rustbot label +regression-from-stable-to-stable
oli-obk commentedon Jun 28, 2022
likely cause is one of the uses of
take_opaque_type
without actually registering the hidden types5225225 commentedon Jun 28, 2022
searched nightlies: from nightly-2022-01-01 to nightly-2022-06-26
regressed nightly: nightly-2022-03-31
searched commit range: 9c06e1b...c5cf08d
regressed commit: f132bcf
bisected with cargo-bisect-rustc v0.6.1
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
So yeah, it looks to be #94081
evaluate_obligation
query if new opaque types were registered #98614Dylan-DPC commentedon Jun 30, 2022
marking it as critical based on the prioritisation group discussion
apiraino commentedon Jun 30, 2022
Correct link for WG-prioritization Zulip discussion
rust: update to version 1.62.1.
lang/rust: update to version 1.62.1.