-
Notifications
You must be signed in to change notification settings - Fork 13.3k
associated type not normalized when a where-clause is present #28895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The root cause is that selection picks the where-clause candidate over any impl candidate, and this does not allow projection to make progress. This looks to be hard to fix. |
Yes, this is to some extent a known limitation and the "expected result", but I would still classify it as a bug. |
(Note: Deleted and reposted since I screwed up the first version, and realized I could minimize it more) I hit this case while trying to work around #68375 - I'm pretty sure it's the same bug pub trait Data {
type Elem;
}
pub struct ViewRepr<A>(A);
impl<'a, A> Data for ViewRepr<&'a A> {
type Elem = A;
}
type ArrayBase<S> = ArrayBaseInner<S, <S as Data>::Elem>;
pub struct ArrayBaseInner<S: Data<Elem = Elem>, Elem> {
ptr: *mut Elem,
d: S,
}
fn std1d<'a>(_: ArrayBase<ViewRepr<&'a f64>>) {}
fn map_axis<'a, F>(f: F)
where
F: FnMut(ArrayBase<ViewRepr<&'a f64>>)
{}
fn std() {
map_axis(std1d);
}
|
Nope, you have a return value in |
Oops, you're right, minification mistake. Fixed that above, it doesn't substantially change the error message. |
@gmorenz this is because of the lifetime parameter. Because the associated type could depend on the choice of lifetime parameter, it doesn't get normalized. That does seem related to this Issue. |
Triage: no change |
Current output:
|
Affected Versions
At least 1.3, 1.4,
rustc 1.5.0-nightly (11a612795 2015-10-04)
STR
Expected Result
the code should compile
Actual Result
cc @nikomatsakis
The text was updated successfully, but these errors were encountered: