-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-specializationArea: Trait impl specializationArea: Trait impl specializationA-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.F-specialization`#![feature(specialization)]``#![feature(specialization)]`S-types-deferredStatus: Identified as a valid potential future enhancement that is not currently being worked onStatus: Identified as a valid potential future enhancement that is not currently being worked onT-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.T-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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
It is potentially somewhat surprising that the following impls are accepted:
#![feature(specialization)]
trait Foo {
fn bar();
}
impl<T> Foo for T {
fn bar() { } // no default
}
impl Foo for i32 {
// OK so long as we define no items:
// fn bar() { }
}
fn main() {}
The original example was unearthed by @eddyb and @varkor as part of a PR.
To be clear, I don't see this as a soundness problem per se. Just a question of what we think it ought to do.
cc @aturon
schneiderfelipe and boozook
Metadata
Metadata
Assignees
Labels
A-specializationArea: Trait impl specializationArea: Trait impl specializationA-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.F-specialization`#![feature(specialization)]``#![feature(specialization)]`S-types-deferredStatus: Identified as a valid potential future enhancement that is not currently being worked onStatus: Identified as a valid potential future enhancement that is not currently being worked onT-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.T-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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.