-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't match any projection predicates when the obligation has inferen…
…ce types or consts in GAT substs
- Loading branch information
Showing
4 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// check-fail | ||
|
||
// FIXME(generic_associated_types): We almost certaintly want this to pass, but | ||
// it's particularly difficult currently, because we need a way of specifying | ||
// that `<Self::Base as Functor>::With<T> = Self` without using that when we have | ||
// a `U`. See `https://github.com/rust-lang/rust/pull/92728` for a (hacky) | ||
// solution. This might be better to just wait for Chalk. | ||
|
||
#![feature(generic_associated_types)] | ||
|
||
pub trait Functor { | ||
type With<T>; | ||
|
||
fn fmap<T, U>(this: Self::With<T>) -> Self::With<U>; | ||
} | ||
|
||
pub trait FunctorExt<T>: Sized { | ||
type Base: Functor<With<T> = Self>; | ||
|
||
fn fmap<U>(self) { | ||
let arg: <Self::Base as Functor>::With<T>; | ||
let ret: <Self::Base as Functor>::With<U>; | ||
|
||
arg = self; | ||
ret = <Self::Base as Functor>::fmap(arg); | ||
//~^ mismatched types | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-91762.rs:25:45 | ||
| | ||
LL | / pub trait FunctorExt<T>: Sized { | ||
LL | | type Base: Functor<With<T> = Self>; | ||
LL | | | ||
LL | | fn fmap<U>(self) { | ||
... | | ||
LL | | ret = <Self::Base as Functor>::fmap(arg); | ||
| | ^^^ expected associated type, found type parameter `Self` | ||
LL | | | ||
LL | | } | ||
LL | | } | ||
| |_- this type parameter | ||
| | ||
= note: expected associated type `<<Self as FunctorExt<T>>::Base as Functor>::With<_>` | ||
found type parameter `Self` | ||
= note: you might be missing a type parameter or trait bound | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |