forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#92917 - jackh726:issue-91762-2, r=nikomatsakis
Don't constrain projection predicates with inference vars in GAT substs cc rust-lang#91762 Not a fix, but a mitigation to prevent a backwards-compatible hazard where we normalize using a predicate only because it's the only one available, but shouldn't. This would constrain an inference variable which didn't really want. We already do this when selecting a projection candidate, which isn't always correct. But changing that is a problem for a different day. Also found out that a suggestion for `await`ing a future was using the wrong substs. r? `@nikomatsakis`
- Loading branch information
Showing
6 changed files
with
60 additions
and
3 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
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); | ||
//~^ type annotations needed | ||
} | ||
} | ||
|
||
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,9 @@ | ||
error[E0282]: type annotations needed | ||
--> $DIR/issue-91762.rs:25:15 | ||
| | ||
LL | ret = <Self::Base as Functor>::fmap(arg); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the associated function `fmap` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0282`. |