-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.P-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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
I have some code that looks a bit like this:
use std::borrow::Borrow;
pub struct Data<TBody>(TBody);
pub fn collect(_: impl IntoIterator<Item = impl Borrow<Data<impl AsRef<[u8]>>>>) {
unimplemented!()
}
On 1.32.0
(and the current beta 1.33.0-beta.4 2019-01-24 635817b9db20ecdcd036
) this compiles successfully.
On the current nightly 1.34.0-nightly 2019-01-28 d8a0dd7ae88023bd09fa
this fails with:
error[E0666]: nested `impl Trait` is not allowed
--> src/main.rs:5:61
|
5 | pub fn collect(_: impl IntoIterator<Item = impl Borrow<Data<impl AsRef<[u8]>>>>) {
| -----------------^^^^^^^^^^^^^^^^--
| | |
| | nested `impl Trait` here
| outer `impl Trait`
A workaround is just to use generics. Did we mean to change the rules around nested impl trait here?
nblumhardt, goffrie, paulusx and stepancheg
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.P-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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.