Skip to content

Commit 4999226

Browse files
committed
Update tests
1 parent 4eb014a commit 4999226

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/lib.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@
115115
//! // Generic associated types, the return values are moved to here.
116116
//! // NOTE: all #[send] methods also get the `Send` trait bound.
117117
//! type OpenFuture<'a>: ::core::future::Future<Output = Result<FileDescriptor, Errno>> +
118-
//! ::core::marker::Send + 'a;
119-
//! type ReadFuture<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a;
120-
//! type WriteFuture<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a;
121-
//! type CloseFuture<'a>: ::core::future::Future<Output = Result<(), Errno>> + 'a;
118+
//! ::core::marker::Send + 'a where Self: 'a;
119+
//! type ReadFuture<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a where Self: 'a;
120+
//! type WriteFuture<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a where Self: 'a;
121+
//! type CloseFuture<'a>: ::core::future::Future<Output = Result<(), Errno>> + 'a where Self: 'a;
122122
//! }
123123
//! ```
124124
//!
@@ -133,10 +133,10 @@
133133
//! # fn read<'a>(&'a self, fd: FileDescriptor, buf: &'a mut [u8]) -> Self::ReadFuture<'a>;
134134
//! # fn write<'a>(&'a self, fd: FileDescriptor, buf: &'a [u8]) -> Self::WriteFuture<'a>;
135135
//! # fn close<'a>(&'a self, fd: FileDescriptor) -> Self::CloseFuture<'a>;
136-
//! # type OpenFuture<'a>: ::core::future::Future<Output = Result<FileDescriptor, Errno>> + Send + 'a;
137-
//! # type ReadFuture<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a;
138-
//! # type WriteFuture<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a;
139-
//! # type CloseFuture<'a>: ::core::future::Future<Output = Result<(), Errno>> + 'a;
136+
//! # type OpenFuture<'a>: ::core::future::Future<Output = Result<FileDescriptor, Errno>> + Send + 'a where Self: 'a;
137+
//! # type ReadFuture<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a where Self: 'a;
138+
//! # type WriteFuture<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a where Self: 'a;
139+
//! # type CloseFuture<'a>: ::core::future::Future<Output = Result<(), Errno>> + 'a where Self: 'a;
140140
//! # }
141141
//! # const ENOENT: Errno = Errno;
142142
//! # const EBADF: Errno = Errno;
@@ -188,13 +188,15 @@
188188
189189
extern crate proc_macro;
190190

191+
use std::iter::FromIterator;
191192
use std::str::FromStr;
192193
use std::{iter, mem};
193194

194195
use proc_macro2::{Span, TokenStream};
195196
use quote::quote;
196197
use syn::punctuated::Punctuated;
197-
use syn::token;
198+
use syn::token::Where;
199+
use syn::{token, PredicateType, WhereClause, WherePredicate};
198200
use syn::{
199201
AngleBracketedGenericArguments, AttrStyle, Attribute, Binding, Block, Expr, ExprAsync, FnArg,
200202
GenericArgument, GenericParam, Generics, Ident, ImplItem, ImplItemType, ItemImpl, ItemTrait,

src/tests.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ fn correct_trait_output() {
1616
fn write<'a>(&'a mut self, fd: usize, buf: &'a [u8]) -> Self::__real_async_trait_impl_TypeFor_write<'a>;
1717
fn close<'a>(&'a mut self, fd: usize) -> Self::__real_async_trait_impl_TypeFor_close<'a>;
1818

19-
type __real_async_trait_impl_TypeFor_open<'a>: ::core::future::Future<Output = Result<usize, Errno>> + ::core::marker::Send + 'a;
20-
type __real_async_trait_impl_TypeFor_read<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a;
21-
type __real_async_trait_impl_TypeFor_write<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a;
22-
type __real_async_trait_impl_TypeFor_close<'a>: ::core::future::Future<Output = Result<(), Errno>> + 'a;
19+
type __real_async_trait_impl_TypeFor_open<'a>: ::core::future::Future<Output = Result<usize, Errno>> + ::core::marker::Send + 'a where Self: 'a;
20+
type __real_async_trait_impl_TypeFor_read<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a where Self: 'a;
21+
type __real_async_trait_impl_TypeFor_write<'a>: ::core::future::Future<Output = Result<usize, Errno>> + 'a where Self: 'a;
22+
type __real_async_trait_impl_TypeFor_close<'a>: ::core::future::Future<Output = Result<(), Errno>> + 'a where Self: 'a;
2323
}
2424
};
2525
let actual_output = crate::real_async_trait2(proc_macro2::TokenStream::new(), input);
@@ -65,10 +65,10 @@ fn correct_impl_output() {
6565
async move { Ok(()) }
6666
}
6767

68-
type __real_async_trait_impl_TypeFor_open<'a> = __real_async_trait_impl_ExistentialTypeFor_open<'a>;
69-
type __real_async_trait_impl_TypeFor_read<'a> = __real_async_trait_impl_ExistentialTypeFor_read<'a>;
70-
type __real_async_trait_impl_TypeFor_write<'a> = __real_async_trait_impl_ExistentialTypeFor_write<'a>;
71-
type __real_async_trait_impl_TypeFor_close<'a> = __real_async_trait_impl_ExistentialTypeFor_close<'a>;
68+
type __real_async_trait_impl_TypeFor_open<'a> = __real_async_trait_impl_ExistentialTypeFor_open<'a> where Self: 'a;
69+
type __real_async_trait_impl_TypeFor_read<'a> = __real_async_trait_impl_ExistentialTypeFor_read<'a> where Self: 'a;
70+
type __real_async_trait_impl_TypeFor_write<'a> = __real_async_trait_impl_ExistentialTypeFor_write<'a> where Self: 'a;
71+
type __real_async_trait_impl_TypeFor_close<'a> = __real_async_trait_impl_ExistentialTypeFor_close<'a> where Self: 'a;
7272
}
7373
type __real_async_trait_impl_ExistentialTypeFor_open<'a> = impl ::core::future::Future<Output = Result<usize, Errno>> + ::core::marker::Send + 'a;
7474
type __real_async_trait_impl_ExistentialTypeFor_read<'a> = impl ::core::future::Future<Output = Result<usize, Errno>> + 'a;

0 commit comments

Comments
 (0)