Closed
Description
Most likely related to #59500 ?
Simplified reproduction:
pub type FuncWrapper = Box<dyn Fn() + 'static>;
pub trait IntoFuncWrapper {
fn into_func(self) -> FuncWrapper;
}
impl<F> IntoFuncWrapper for F where F: Fn() + 'static {
fn into_func(self) -> FuncWrapper { Box::new(self) }
}
impl IntoFuncWrapper for FuncWrapper {
fn into_func(self) -> FuncWrapper { self }
}
fn main() { }
Before: compiles on stable, beta, previous nightly
On latest nightly:
error[E0119]: conflicting implementations of trait `IntoFuncWrapper` for type `std::boxed::Box<(dyn std::ops::Fn() + 'static)>`:
--> src/main.rs:11:1
|
7 | impl<F> IntoFuncWrapper for F where F: Fn() + 'static {
| ----------------------------------------------------- first implementation here
...
11 | impl IntoFuncWrapper for FuncWrapper {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<(dyn std::ops::Fn() + 'static)>`
error: aborting due to previous error
I do not know whether that was expected and should be fixed on my side, or is it an unintended breakage.
Metadata
Metadata
Assignees
Labels
Area: Closures (`|…| { … }`)Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language teamRelevant to the library API team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.