-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In suggest_missing_return_type, erase late bound regions after normal…
…izing
- Loading branch information
Showing
3 changed files
with
41 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#![feature(generic_associated_types)] | ||
|
||
trait GatTrait { | ||
type Gat<'a>; | ||
|
||
fn test(&self) -> Self::Gat<'_>; | ||
} | ||
|
||
trait SuperTrait<T> | ||
where | ||
for<'a> Self: GatTrait<Gat<'a> = &'a T>, | ||
{ | ||
fn copy(&self) -> Self::Gat<'_> where T: Copy { | ||
*self.test() | ||
//~^ 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,20 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-88360.rs:14:9 | ||
| | ||
LL | trait SuperTrait<T> | ||
| - this type parameter | ||
... | ||
LL | fn copy(&self) -> Self::Gat<'_> where T: Copy { | ||
| ------------- expected `&T` because of return type | ||
LL | *self.test() | ||
| ^^^^^^^^^^^^ | ||
| | | ||
| expected `&T`, found type parameter `T` | ||
| help: consider borrowing here: `&*self.test()` | ||
| | ||
= note: expected reference `&T` | ||
found type parameter `T` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |