Skip to content

Segfault on nightly with feature Pointer Metadata #148089

@sirati

Description

@sirati

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); }

Rust Playground

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

No one assigned

    Labels

    A-dyn-compatibilityArea: Dyn compatibility (formerly: object safety)A-dyn-traitArea: trait objects, vtable layoutA-trait-systemArea: Trait systemC-bugCategory: This is a bug.F-ptr_metadata`#![feature(ptr_metadata)]`I-unsoundIssue: 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.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions