-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)P-mediumMedium priorityMedium 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.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
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.
qnighy
Metadata
Metadata
Assignees
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)P-mediumMedium priorityMedium 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.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.