-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #95754 - compiler-errors:binder-assoc-ty, r=nagisa
Better error for `for<...>` on associated type bound With GATs just around the corner, we'll probably see more people trying out `Trait<for<'a> Assoc<'a> = ..>`. This PR improves the syntax error slightly, and also makes it slightly easier to make this into real syntax in the future. Feel free to push back if the reviewer thinks this should have a suggestion on how to fix it (i.e. push the `for<'a>` outside of the angle brackets), but that can also be handled in a follow-up PR.
- Loading branch information
Showing
4 changed files
with
56 additions
and
13 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,11 @@ | ||
#![feature(generic_associated_types)] | ||
|
||
trait Trait { | ||
type Bound<'a>; | ||
} | ||
|
||
fn foo() where Trait<for<'a> Bound<'a> = &'a ()> { | ||
//~^ ERROR `for<...>` is not allowed on associated type bounds | ||
} | ||
|
||
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,8 @@ | ||
error: `for<...>` is not allowed on associated type bounds | ||
--> $DIR/binder-on-bound.rs:7:22 | ||
| | ||
LL | fn foo() where Trait<for<'a> Bound<'a> = &'a ()> { | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|