diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2025-04-13 10:33:29 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2025-04-15 20:33:01 +0200 |
| commit | 20649a87d1d7184a24b90bf93bc3cdbe080c2fb5 (patch) | |
| tree | 62c1b37c42bcc895adaa0597f599026529e69f7b | |
| parent | 443547425d83aae889dc56d483221f57c37fa8d3 (diff) | |
| download | rust-20649a87d1d7184a24b90bf93bc3cdbe080c2fb5.tar.gz rust-20649a87d1d7184a24b90bf93bc3cdbe080c2fb5.zip | |
Add `use<>` markers for edition 2024 compatibility
By default, edition 2024 will capture all types and lifetimes present in the function signature when using RPIT, while edition 2021 will capture only the lifetimes present in the RPIT itself. Adding explicit `use<>` markers will disable the edition-specific automatic rules when they differ.
| -rw-r--r-- | tests/ui/manual_async_fn.fixed | 6 | ||||
| -rw-r--r-- | tests/ui/manual_async_fn.rs | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/ui/manual_async_fn.fixed b/tests/ui/manual_async_fn.fixed index ad0266d39e9..a284ca9f625 100644 --- a/tests/ui/manual_async_fn.fixed +++ b/tests/ui/manual_async_fn.fixed @@ -75,7 +75,7 @@ impl S { async fn elided(_: &i32) -> i32 { 42 } // should be ignored -fn elided_not_bound(_: &i32) -> impl Future<Output = i32> { +fn elided_not_bound(_: &i32) -> impl Future<Output = i32> + use<> { async { 42 } } @@ -84,7 +84,7 @@ async fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> i32 { 42 } // should be ignored #[allow(clippy::needless_lifetimes)] -fn explicit_not_bound<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> { +fn explicit_not_bound<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + use<> { async { 42 } } @@ -94,7 +94,7 @@ mod issue_5765 { struct A; impl A { - fn f(&self) -> impl Future<Output = ()> { + fn f(&self) -> impl Future<Output = ()> + use<> { async {} } } diff --git a/tests/ui/manual_async_fn.rs b/tests/ui/manual_async_fn.rs index fe367b4bc7b..188f8a4982c 100644 --- a/tests/ui/manual_async_fn.rs +++ b/tests/ui/manual_async_fn.rs @@ -102,7 +102,7 @@ fn elided(_: &i32) -> impl Future<Output = i32> + '_ { } // should be ignored -fn elided_not_bound(_: &i32) -> impl Future<Output = i32> { +fn elided_not_bound(_: &i32) -> impl Future<Output = i32> + use<> { async { 42 } } @@ -114,7 +114,7 @@ fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + 'a + // should be ignored #[allow(clippy::needless_lifetimes)] -fn explicit_not_bound<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> { +fn explicit_not_bound<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + use<> { async { 42 } } @@ -124,7 +124,7 @@ mod issue_5765 { struct A; impl A { - fn f(&self) -> impl Future<Output = ()> { + fn f(&self) -> impl Future<Output = ()> + use<> { async {} } } |
