diff options
author | Haibo Huang <hhb@google.com> | 2020-07-27 09:15:22 -0700 |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2020-07-27 09:15:22 -0700 |
commit | 8b0a20e7d043929696defab3305e160ec97aeb8c (patch) | |
tree | c8d57bedfd859d1e1daa30a527301e719d8bfc01 | |
parent | a51d04878ac35e4e06f4105946b6cce5ae6982fd (diff) | |
download | pin-project-internal-8b0a20e7d043929696defab3305e160ec97aeb8c.tar.gz |
Upgrade rust/crates/pin-project-internal to 0.4.23
Change-Id: If43b307f0a7023fc2f89bd0051555e85e2123fd2
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | Cargo.toml.orig | 2 | ||||
-rw-r--r-- | METADATA | 4 | ||||
-rw-r--r-- | src/lib.rs | 6 | ||||
-rw-r--r-- | src/pin_project/attribute.rs | 23 | ||||
-rw-r--r-- | src/pin_project/derive.rs | 5 |
6 files changed, 20 insertions, 22 deletions
@@ -13,7 +13,7 @@ [package] edition = "2018" name = "pin-project-internal" -version = "0.4.22" +version = "0.4.23" authors = ["Taiki Endo <te316e89@gmail.com>"] description = "An internal crate to support pin_project - do not use directly\n" homepage = "https://github.com/taiki-e/pin-project" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index a973af7..ac5e137 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "pin-project-internal" -version = "0.4.22" +version = "0.4.23" authors = ["Taiki Endo <te316e89@gmail.com>"] edition = "2018" license = "Apache-2.0 OR MIT" @@ -9,11 +9,11 @@ third_party { type: GIT value: "https://github.com/taiki-e/pin-project" } - version: "0.4.22" + version: "0.4.23" license_type: NOTICE last_upgrade_date { year: 2020 month: 7 - day: 10 + day: 27 } } @@ -1,6 +1,6 @@ //! An internal crate to support pin_project - **do not use directly** -#![doc(html_root_url = "https://docs.rs/pin-project-internal/0.4.22")] +#![doc(html_root_url = "https://docs.rs/pin-project-internal/0.4.23")] #![doc(test( no_crate_inject, attr(deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code)) @@ -11,8 +11,6 @@ // mem::take and #[non_exhaustive] requires Rust 1.40 #![allow(clippy::mem_replace_with_default, clippy::manual_non_exhaustive)] #![allow(clippy::needless_doctest_main)] -// https://github.com/rust-lang/rust-clippy/issues/5704 -#![allow(clippy::unnested_or_patterns)] // older compilers require explicit `extern crate`. #[allow(unused_extern_crates)] @@ -134,7 +132,7 @@ use crate::utils::ProjKind; /// contains the content is not overwritten or deallocated without calling /// the content's destructors. /// -/// Safe code doesn't need to worry about this - the only wait to violate +/// Safe code doesn't need to worry about this - the only way to violate /// this requirement is to manually deallocate memory (which is `unsafe`), /// or to overwrite a field with something else. /// Because your custom destructor takes [`Pin`]`<&mut MyStruct>`, it's diff --git a/src/pin_project/attribute.rs b/src/pin_project/attribute.rs index 34e32f5..7945aba 100644 --- a/src/pin_project/attribute.rs +++ b/src/pin_project/attribute.rs @@ -23,21 +23,22 @@ use crate::utils::SliceExt; // proc-macro-derive (`InternalDerive`). pub(super) fn parse_attribute(args: &TokenStream, input: TokenStream) -> Result<TokenStream> { - let Input { attrs: mut tokens, body } = syn::parse2(input)?; + let Input { attrs, body } = syn::parse2(input)?; - tokens.extend(quote!(#[derive(::pin_project::__private::__PinProjectInternalDerive)])); - // Use `__private` to prevent users from trying to control `InternalDerive` - // manually. `__private` does not guarantee compatibility between patch - // versions, so it should be sufficient for this purpose in most cases. - tokens.extend(quote!(#[pin(__private(#args))])); - - tokens.extend(body); - Ok(tokens) + Ok(quote! { + #(#attrs)* + #[derive(::pin_project::__private::__PinProjectInternalDerive)] + // Use `__private` to prevent users from trying to control `InternalDerive` + // manually. `__private` does not guarantee compatibility between patch + // versions, so it should be sufficient for this purpose in most cases. + #[pin(__private(#args))] + #body + }) } #[allow(dead_code)] // https://github.com/rust-lang/rust/issues/56750 struct Input { - attrs: TokenStream, + attrs: Vec<Attribute>, body: TokenStream, } @@ -59,7 +60,7 @@ impl Parse for Input { } else if let Some(attr) = attrs.find("pin_project") { Err(error!(attr, "duplicate #[pin_project] attribute")) } else { - Ok(Self { attrs: quote!(#(#attrs)*), body: input.parse()? }) + Ok(Self { attrs, body: input.parse()? }) } } } diff --git a/src/pin_project/derive.rs b/src/pin_project/derive.rs index 8c31252..56a3d47 100644 --- a/src/pin_project/derive.rs +++ b/src/pin_project/derive.rs @@ -909,8 +909,7 @@ impl<'a> Context<'a> { } } UnpinImpl::Default => { - let mut full_where_clause = - self.orig.generics.where_clause.as_ref().cloned().unwrap(); + let mut full_where_clause = self.orig.generics.where_clause.clone().unwrap(); // Generate a field in our new struct for every // pinned field in the original type. @@ -974,7 +973,7 @@ impl<'a> Context<'a> { // this 'public' type by creating this type in the inside of `const`. #vis struct #struct_ident #proj_generics #where_clause { __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin< - #lifetime, (#(#type_params),*) + #lifetime, (#(::pin_project::__private::PhantomData<#type_params>),*) >, #(#fields,)* |