-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.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/SoundnessP-highHigh priorityHigh priorityT-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
First reported in https://users.rust-lang.org/t/unexpected-behaviors-of-trait-bounds/12286/3
STR
pub trait Partial: Copy {
}
pub trait Complete: Partial {
}
impl<T> Partial for T where T: Complete {}
impl<T> Complete for T {}
fn copy<P: Partial>(p: P) -> (P, P) {
(p, p)
}
fn main() {
let (p, q) = copy("hello".to_string());
drop(p);
println!("{}", q);
}
cc @nikomatsakis - let's discuss this when you are back from vacation (unless @aturon can come up with a solution?)
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.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/SoundnessP-highHigh priorityHigh priorityT-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.