-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
TAIT + next-solver will allow constructing a unit struct without mentioning its type, causing pinned-init to be unsound. #153535
Copy link
Copy link
Open
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-inferenceArea: Type inferenceArea: Type inferenceA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-rust-for-linuxRelevant for the Rust-for-Linux projectRelevant for the Rust-for-Linux projectC-bugCategory: This is a bug.Category: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`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-langRelevant to the language teamRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)The Rustc Trait System Refactor Initiative (-Znext-solver)
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-inferenceArea: Type inferenceArea: Type inferenceA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-rust-for-linuxRelevant for the Rust-for-Linux projectRelevant for the Rust-for-Linux projectC-bugCategory: This is a bug.Category: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`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-langRelevant to the language teamRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)The Rustc Trait System Refactor Initiative (-Znext-solver)
Type
Fields
Give feedbackNo fields configured for issues without a type.
I have also described this issue at rust-lang/rfcs#3444 (comment)
The
pinned-initcrate has a macro whose soundness relies on having a type that cannot be constructed outside the macro, due to the type's name being impossible to mention.The TAIT feature, along with the next-solver, allows writing a struct literal without mentioning the type name.
Therefore, TAIT with the next-solver will cause the
pinned-initcrate to become unsound.The below code creates an uninitialized
Box<i32>with thepinned-initcrate version 0.0.10, and with the-Znext-solverflag enabled. It causes a segmentation fault in my testing.cc @rust-lang/rust-for-linux (owner of the
pinned-initcrate)cc @lcnr
Meta
rustc --version --verbose: