-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
A-dyn-compatibilityArea: Dyn compatibility (formerly: object safety)Area: Dyn compatibility (formerly: object safety)A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.F-ptr_metadata`#![feature(ptr_metadata)]``#![feature(ptr_metadata)]`I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
Using the Pointer Metadata feature on nightly, the following code will segfault. This is as much as I managed to minimize the issue over the last hours.
#![feature(ptr_metadata)]
use std::ptr::{Thin};
use std::{fmt::Debug};
trait Parent{}
trait Blanket: Parent + Thin{} //mind the + Thin which causes the SegFault
impl<T: Parent> Blanket for T{}
trait WithDebug: Blanket+Debug {}
impl<T: Blanket + Debug> WithDebug for T {}
#[derive(Debug)]
struct ZST;
impl Parent for ZST{}
fn main() {
let dyn_ref: &dyn WithDebug = &ZST;
println!("segfault {:?}", dyn_ref);
}rustc --version --verbose:
rustc 1.92.0-nightly (6501e64fc 2025-10-23)
binary: rustc
commit-hash: 6501e64fcb02d22b49d6e59d10a7692ec8095619
commit-date: 2025-10-23
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.3
Metadata
Metadata
Assignees
Labels
A-dyn-compatibilityArea: Dyn compatibility (formerly: object safety)Area: Dyn compatibility (formerly: object safety)A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.F-ptr_metadata`#![feature(ptr_metadata)]``#![feature(ptr_metadata)]`I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.