Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 20649a8

Browse files
committed
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.
1 parent 4435474 commit 20649a8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/ui/manual_async_fn.fixed

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl S {
7575
async fn elided(_: &i32) -> i32 { 42 }
7676

7777
// should be ignored
78-
fn elided_not_bound(_: &i32) -> impl Future<Output = i32> {
78+
fn elided_not_bound(_: &i32) -> impl Future<Output = i32> + use<> {
7979
async { 42 }
8080
}
8181

@@ -84,7 +84,7 @@ async fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> i32 { 42 }
8484

8585
// should be ignored
8686
#[allow(clippy::needless_lifetimes)]
87-
fn explicit_not_bound<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> {
87+
fn explicit_not_bound<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + use<> {
8888
async { 42 }
8989
}
9090

@@ -94,7 +94,7 @@ mod issue_5765 {
9494

9595
struct A;
9696
impl A {
97-
fn f(&self) -> impl Future<Output = ()> {
97+
fn f(&self) -> impl Future<Output = ()> + use<> {
9898
async {}
9999
}
100100
}

tests/ui/manual_async_fn.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn elided(_: &i32) -> impl Future<Output = i32> + '_ {
102102
}
103103

104104
// should be ignored
105-
fn elided_not_bound(_: &i32) -> impl Future<Output = i32> {
105+
fn elided_not_bound(_: &i32) -> impl Future<Output = i32> + use<> {
106106
async { 42 }
107107
}
108108

@@ -114,7 +114,7 @@ fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + 'a +
114114

115115
// should be ignored
116116
#[allow(clippy::needless_lifetimes)]
117-
fn explicit_not_bound<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> {
117+
fn explicit_not_bound<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + use<> {
118118
async { 42 }
119119
}
120120

@@ -124,7 +124,7 @@ mod issue_5765 {
124124

125125
struct A;
126126
impl A {
127-
fn f(&self) -> impl Future<Output = ()> {
127+
fn f(&self) -> impl Future<Output = ()> + use<> {
128128
async {}
129129
}
130130
}

0 commit comments

Comments
 (0)