forked from rust-lang/rustfmt
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #126754 - compiler-errors:use-rustfmt, r=calebcartwright
Implement `use<>` formatting in rustfmt This PR implements formatting for precise-capturing `use<>` syntax as proposed in rust-lang/rust#126753. The syntax is implemented as-if the `use<>` bound were a trait bound but with the `use` keyword as its path segment identifier. I opted to develop this in the rust-lang/rust tree since I'm not certain when the next rustfmt subtree sync is going to be, and I'd rather not block landing nightly support for `use<>` on something I have no control over. If ``@rust-lang/rustfmt`` would rather I move this PR over to that repository, then I would at least like to know when the next rustfmt->rust subtree sync is going to be, since stabilizing `precise_capturing` without formatting will be disruptive. This implementation is otherwise rather straightforward. Tracking: - rust-lang/rust#123432
- Loading branch information
Showing
5 changed files
with
105 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
fn hello() -> impl | ||
use<'a> + Sized {} | ||
|
||
fn all_three() -> impl Sized + use<'a> + 'a; | ||
|
||
fn pathological() -> impl use<'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, | ||
'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, | ||
'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, | ||
'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a, 'a> + Sized {} |
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,55 @@ | ||
fn hello() -> impl use<'a> + Sized {} | ||
|
||
fn all_three() -> impl Sized + use<'a> + 'a; | ||
|
||
fn pathological() -> impl use< | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
'a, | ||
> + Sized { | ||
} |