Skip to content

GAT incomplete inference hack is too eager #256

@lcnr

Description

@lcnr

affects rust2fun https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/crater.20triage.20.3A3/near/554134892 thx @lqd :>

pub trait Higher {
    type Param;
    type Target<T>: Higher<Param = T>;
}
pub trait FlatMap<B> {}

fn flat_map<T, B>(_: T::Target<B>)
where
    T: Higher,{}

fn foo<T, B>(x: T::Target<B>)
where
    T: Higher,
    T: FlatMap<B>,
    T: FlatMap<T::Param>,
    T::Target<B>: Higher<Target<B> = T::Target<B>>,
{
    flat_map::<T, _>(x)
}

errors with

error[E0284]: type annotations needed: cannot satisfy `<T as Higher>::Target<_> normalizes-to <T as Higher>::Target<B>`
  --> <source>:18:22
   |
18 |     flat_map::<T, _>(x)
   |                      ^ cannot satisfy `<T as Higher>::Target<_> normalizes-to <T as Higher>::Target<B>`

Metadata

Metadata

Assignees

Labels

from-craterA regression found via a crater run, not part of our test suite

Type

No type

Projects

Status

in progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions