-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
The following code works on stable, but not on the latest master. I believe it is valid.
trait ParallelIterator {
type Item;
fn drive_unindexed<C>(self, consumer: C) -> C::Result
where C: Consumer<Self::Item>;
}
pub trait Consumer<ITEM> {
type Result;
}
pub struct Enumerate<M> {
base: M,
}
impl<M> ParallelIterator for Enumerate<M>
where M: ParallelIterator,
{
type Item = (usize, M::Item);
fn drive_unindexed<C>(self, consumer: C) -> C::Result
where C: Consumer<Self::Item>
{
panic!()
}
}
fn main() { }
On master I get:
lunch-box. rustc ~/tmp/reduce.rs
/home/nmatsakis/tmp/reduce.rs:3:5: 4:39 error: the trait bound `C: Consumer<Self>` is not satisfied [E0277]
/home/nmatsakis/tmp/reduce.rs:3 fn drive_unindexed<C>(self, consumer: C) -> C::Result
^
/home/nmatsakis/tmp/reduce.rs:3:5: 4:39 help: run `rustc --explain E0277` to see a detailed explanation
/home/nmatsakis/tmp/reduce.rs:3:5: 4:39 help: consider adding a `where C: Consumer<Self>` bound
/home/nmatsakis/tmp/reduce.rs:20:5: 24:6 error: the trait bound `C: Consumer<Enumerate<M>>` is not satisfied [E0277]
/home/nmatsakis/tmp/reduce.rs:20 fn drive_unindexed<C>(self, consumer: C) -> C::Result
^
/home/nmatsakis/tmp/reduce.rs:20:5: 24:6 help: run `rustc --explain E0277` to see a detailed explanation
/home/nmatsakis/tmp/reduce.rs:20:5: 24:6 help: consider adding a `where C: Consumer<Enumerate<M>>` bound
error: aborting due to 2 previous errors
Metadata
Metadata
Assignees
Labels
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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
nikomatsakis commentedon May 12, 2016
(This affects the latest Rayon.)
nikomatsakis commentedon May 12, 2016
Note that the error messages are talking about
Consumer<Self>
.nikomatsakis commentedon May 12, 2016
Really this is enough to show the problem:
nikomatsakis commentedon May 12, 2016
This DOES compile, which gives a pretty good clue:
nikomatsakis commentedon May 12, 2016
cc @eddyb any PRs that you've seen whih might affect how
C::Result
is resolved?metajack commentedon May 12, 2016
This is blocking a Servo upgrade of rustc currently. We seem to be stuck around 2016-05-07 until this is fixed.
nikomatsakis commentedon May 12, 2016
Seems likely to be a problem in the resolve refactoring. Basically the
Self::Item
inConsumer<Self::Item>
gets translated toSelf
.cc @jseyfried the problem seems to lie in resolve
nikomatsakis commentedon May 12, 2016
never mind, I think the problem is in astconv
eddyb commentedon May 12, 2016
Got to love nondescript cleanup commits.
This broke saving the final
Def
, which was completely hidden by theast_ty_to_ty_cache
, until I removed that recently.It wasn't a problem with expression paths because those don't use the resulting
Def
for anything and instead insert their own resolved method or associated constantDef
.alexcrichton commentedon May 12, 2016
I've also noticed that this crate fails on the current nightly for presumably similar reasons
Auto merge of #33596 - nikomatsakis:issue-33586-regr-assoc-type-path,…