diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-06-24 06:27:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-24 06:27:14 +0200 |
| commit | b24e3df0dfd7f003de2e5d845cf3c755bd3230c1 (patch) | |
| tree | d61f37200870666ff4fd68cf21e6b2c0fc670d59 /src/tools/rustfmt/tests/source | |
| parent | ad0531ae0d69bd251f3f1b027e1b50dff8b22433 (diff) | |
| parent | a426d6fdf020ac0ae54d8bf11924907d3a225116 (diff) | |
| download | rust-b24e3df0dfd7f003de2e5d845cf3c755bd3230c1.tar.gz rust-b24e3df0dfd7f003de2e5d845cf3c755bd3230c1.zip | |
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 https://github.com/rust-lang/rust/pull/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: - https://github.com/rust-lang/rust/issues/123432
Diffstat (limited to 'src/tools/rustfmt/tests/source')
| -rw-r--r-- | src/tools/rustfmt/tests/source/precise-capturing.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/source/precise-capturing.rs b/src/tools/rustfmt/tests/source/precise-capturing.rs new file mode 100644 index 00000000000..b61cceeffe8 --- /dev/null +++ b/src/tools/rustfmt/tests/source/precise-capturing.rs @@ -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 {} |
