| 1 | mod types { |
| 2 | use inherent::inherent; |
| 3 | |
| 4 | trait Trait { |
| 5 | fn f<T: ?Sized>(self); |
| 6 | // A default method |
| 7 | fn g(&self) {} |
| 8 | |
| 9 | #[rustversion::since(1.75)] |
| 10 | async fn a(&self); |
| 11 | } |
| 12 | |
| 13 | pub struct Struct; |
| 14 | |
| 15 | #[inherent] |
| 16 | impl Trait for Struct { |
| 17 | pub fn f<T: ?Sized>(self) {} |
| 18 | pub fn g(&self); |
| 19 | |
| 20 | #[rustversion::since(1.75)] |
| 21 | pub async fn a(&self) {} |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | #[test] |
| 26 | fn test() { |
| 27 | // types::Trait is not in scope. |
| 28 | let s = types::Struct; |
| 29 | s.g(); |
| 30 | s.f::<str>(); |
| 31 | } |
| 32 | |
| 33 | #[rustversion::since(1.75)] |
| 34 | #[test] |
| 35 | fn test_async() { |
| 36 | fn assert_future<T: std::future::Future<Output = ()>>(_: T) {} |
| 37 | |
| 38 | let s = types::Struct; |
| 39 | assert_future(s.a()); |
| 40 | } |