-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-DSTsArea: Dynamically-sized types (DSTs)Area: Dynamically-sized types (DSTs)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.
Description
Example
struct Foo<T: ?Sized + Bar> {
a: u8,
b: T
}
trait Bar {
fn get(&self) -> usize;
}
struct BarImpl {
i: usize
}
impl Bar for BarImpl {
fn get(&self) -> usize {
self.i
}
}
fn main() {
let f = Foo { a:1, b: BarImpl { i: 5 } };
assert!(f.b.get() == 5); // succeeds
let f = &f as &Foo<Bar>;
assert!(f.b.get() == 5); // assert fails
}
Metadata
Metadata
Assignees
Labels
A-DSTsArea: Dynamically-sized types (DSTs)Area: Dynamically-sized types (DSTs)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.