Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0f86b22

Browse files
committedJan 18, 2024
Make sure refinement still works
1 parent 500443f commit 0f86b22

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed
 

‎tests/ui/async-await/in-trait/async-example-desugared-boxed.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
use std::future::Future;
55
use std::pin::Pin;
66

7-
trait MyTrait {
7+
#[allow(async_fn_in_trait)]
8+
pub trait MyTrait {
89
async fn foo(&self) -> i32;
910
}
1011

1112
impl MyTrait for i32 {
13+
#[warn(refining_impl_trait)]
1214
fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>> {
15+
//~^ WARN impl trait in impl method signature does not match trait method signature
1316
Box::pin(async { *self })
1417
}
1518
}

‎tests/ui/async-await/in-trait/async-example-desugared-manual.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
use std::future::Future;
55
use std::task::Poll;
66

7-
trait MyTrait {
7+
#[allow(async_fn_in_trait)]
8+
pub trait MyTrait {
89
async fn foo(&self) -> i32;
910
}
1011

11-
struct MyFuture;
12+
pub struct MyFuture;
1213
impl Future for MyFuture {
1314
type Output = i32;
1415
fn poll(self: std::pin::Pin<&mut Self>, _: &mut std::task::Context<'_>) -> Poll<Self::Output> {
@@ -17,7 +18,9 @@ impl Future for MyFuture {
1718
}
1819

1920
impl MyTrait for u32 {
21+
#[warn(refining_impl_trait)]
2022
fn foo(&self) -> MyFuture {
23+
//~^ WARN impl trait in impl method signature does not match trait method signature
2124
MyFuture
2225
}
2326
}

0 commit comments

Comments
 (0)
Please sign in to comment.