-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-specializationArea: Trait impl specializationArea: Trait impl specializationF-min_specialization`#![feature(min_specialization)]``#![feature(min_specialization)]`T-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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
I tried this code:
#![feature(min_specialization)]
pub trait Foo {
fn foo(&self);
}
impl<T> Foo for T {
default fn foo(&self) {}
}
impl Foo for Box<dyn Foo> {
fn foo(&self) {}
}
This failed to compile with
error: cannot specialize on `'static` lifetime
--> src/lib.rs:15:1
|
15 | impl Foo for Box<dyn Foo> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
This seems weird since there isn't a visible lifetime anywhere. The error should explain that the 'static
lifetime is implicit on dyn Foo
and suggest adding a lifetime parameter.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-specializationArea: Trait impl specializationArea: Trait impl specializationF-min_specialization`#![feature(min_specialization)]``#![feature(min_specialization)]`T-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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.