-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Interaction between Pin soundness and arbitrary self types #157067
Copy link
Copy link
Open
Labels
A-pinArea: PinArea: PinC-bugCategory: This is a bug.Category: This is a bug.F-arbitrary_self_types`#![feature(arbitrary_self_types)]``#![feature(arbitrary_self_types)]`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/Soundnessneeds-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Description
Metadata
Metadata
Assignees
Labels
A-pinArea: PinArea: PinC-bugCategory: This is a bug.Category: This is a bug.F-arbitrary_self_types`#![feature(arbitrary_self_types)]``#![feature(arbitrary_self_types)]`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/Soundnessneeds-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
In the above piece of code, I'm able to convert a
&mut Foo<u32>into aPin<&mut Foo<u32>>even though the typeFoo<u32>is!Unpin.I'm not sure if you can concretely abuse this to trigger UB right now, but it seems bad.
Related test case:
rust/tests/ui/coercion/pin-dyn-dispatch-sound.rs
Lines 1 to 19 in b5e038d
rust/tests/ui/coercion/pin-dyn-dispatch-sound.stderr
Lines 1 to 6 in b5e038d