diff options
author | Haibo Huang <hhb@google.com> | 2021-02-24 11:40:40 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-02-24 11:40:40 +0000 |
commit | 4c40602bf80eca48019304f42f69f48891eb1175 (patch) | |
tree | 3b108f0fc8966ce237c53fd1c18facdfe745fea1 | |
parent | e5c88c8063478babc31c4083e7f49431f5a9904f (diff) | |
parent | ac57a6a56366f99294dcb82bb538fe11165ff661 (diff) | |
download | pin-project-internal-4c40602bf80eca48019304f42f69f48891eb1175.tar.gz |
Upgrade rust/crates/pin-project-internal to 1.0.5 am: 48e23c5fa2 am: 50c26141bb am: 011e39e3be am: ac57a6a563
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/pin-project-internal/+/1581971
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I11f1ba9a1ecc1b52ceed366015b06dd0dd04e09c
-rw-r--r-- | .cargo_vcs_info.json | 5 | ||||
-rw-r--r-- | Android.bp | 47 | ||||
-rw-r--r-- | Cargo.toml | 7 | ||||
-rw-r--r-- | Cargo.toml.orig | 8 | ||||
-rw-r--r-- | METADATA | 10 | ||||
-rw-r--r-- | TEST_MAPPING | 8 | ||||
-rw-r--r-- | src/lib.rs | 39 | ||||
-rw-r--r-- | src/pin_project/derive.rs | 20 | ||||
-rw-r--r-- | src/pin_project/mod.rs | 5 | ||||
-rw-r--r-- | src/utils.rs | 3 |
10 files changed, 70 insertions, 82 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json new file mode 100644 index 0000000..68cf6e8 --- /dev/null +++ b/.cargo_vcs_info.json @@ -0,0 +1,5 @@ +{ + "git": { + "sha1": "5707cf226c74b81387f498bb5d6896d978fccd4a" + } +} @@ -1,43 +1,5 @@ // This file is generated by cargo2android.py --run --dependencies --tests. -package { - default_applicable_licenses: [ - "external_rust_crates_pin-project-internal_license", - ], -} - -// Added automatically by a large-scale-change that took the approach of -// 'apply every license found to every target'. While this makes sure we respect -// every license restriction, it may not be entirely correct. -// -// e.g. GPL in an MIT project might only apply to the contrib/ directory. -// -// Please consider splitting the single license below into multiple licenses, -// taking care not to lose any license_kind information, and overriding the -// default license using the 'licenses: [...]' property on targets as needed. -// -// For unused files, consider creating a 'filegroup' with "//visibility:private" -// to attach the license to, and including a comment whether the files may be -// used in the current project. -// -// large-scale-change included anything that looked like it might be a license -// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. -// -// Please consider removing redundant or irrelevant files from 'license_text:'. -// http://go/android-license-faq -license { - name: "external_rust_crates_pin-project-internal_license", - visibility: [":__subpackages__"], - license_kinds: [ - "SPDX-license-identifier-Apache-2.0", - "SPDX-license-identifier-MIT", - ], - license_text: [ - "LICENSE-APACHE", - "LICENSE-MIT", - ], -} - rust_proc_macro { name: "libpin_project_internal", crate_name: "pin_project_internal", @@ -56,16 +18,21 @@ rust_test_host { srcs: ["src/lib.rs"], test_suites: ["general-tests"], auto_gen_config: true, + test_options: { + unit_test: true, + }, edition: "2018", rustlibs: [ "libproc_macro2", "libquote", "libsyn", ], + proc_macros: ["librustversion"], } // dependent_library ["feature_list"] // proc-macro2-1.0.24 "default,proc-macro" -// quote-1.0.7 "default,proc-macro" -// syn-1.0.48 "clone-impls,default,derive,full,parsing,printing,proc-macro,quote,visit-mut" +// quote-1.0.8 "default,proc-macro" +// rustversion-1.0.4 +// syn-1.0.60 "clone-impls,default,derive,full,parsing,printing,proc-macro,quote,visit-mut" // unicode-xid-0.2.1 "default" @@ -13,10 +13,9 @@ [package] edition = "2018" name = "pin-project-internal" -version = "1.0.2" +version = "1.0.5" authors = ["Taiki Endo <te316e89@gmail.com>"] description = "Implementation detail of the `pin-project` crate.\n" -homepage = "https://github.com/taiki-e/pin-project" documentation = "https://docs.rs/pin-project-internal" keywords = ["pin", "macros", "attribute"] categories = ["no-std", "rust-patterns"] @@ -34,5 +33,7 @@ version = "1" version = "1" [dependencies.syn] -version = "1.0.44" +version = "1.0.56" features = ["full", "visit-mut"] +[dev-dependencies.rustversion] +version = "1" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 0f018e8..ab5102c 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,11 +1,10 @@ [package] name = "pin-project-internal" -version = "1.0.2" +version = "1.0.5" authors = ["Taiki Endo <te316e89@gmail.com>"] edition = "2018" license = "Apache-2.0 OR MIT" repository = "https://github.com/taiki-e/pin-project" -homepage = "https://github.com/taiki-e/pin-project" documentation = "https://docs.rs/pin-project-internal" keywords = ["pin", "macros", "attribute"] categories = ["no-std", "rust-patterns"] @@ -22,5 +21,8 @@ proc-macro = true [dependencies] proc-macro2 = "1" quote = "1" -syn = { version = "1.0.44", features = ["full", "visit-mut"] } +syn = { version = "1.0.56", features = ["full", "visit-mut"] } +[dev-dependencies] +pin-project = { path = ".." } +rustversion = "1" @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/pin-project-internal/pin-project-internal-1.0.2.crate" + value: "https://static.crates.io/crates/pin-project-internal/pin-project-internal-1.0.5.crate" } - version: "1.0.2" + version: "1.0.5" license_type: NOTICE last_upgrade_date { - year: 2020 - month: 11 - day: 18 + year: 2021 + month: 2 + day: 9 } } diff --git a/TEST_MAPPING b/TEST_MAPPING new file mode 100644 index 0000000..7e10dd0 --- /dev/null +++ b/TEST_MAPPING @@ -0,0 +1,8 @@ +// Generated by update_crate_tests.py for tests that depend on this crate. +{ + "presubmit": [ + { + "name": "futures-util_device_test_src_lib" + } + ] +} @@ -1,22 +1,15 @@ //! Implementation detail of the `pin-project` crate. - **do not use directly** -#![doc(html_root_url = "https://docs.rs/pin-project-internal/1.0.2")] #![doc(test( no_crate_inject, - attr(deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code)) + attr( + deny(warnings, rust_2018_idioms, single_use_lifetimes), + allow(dead_code, unused_variables) + ) ))] #![warn(unsafe_code)] #![warn(future_incompatible, rust_2018_idioms, single_use_lifetimes, unreachable_pub)] #![warn(clippy::all, clippy::default_trait_access)] -// mem::take, #[non_exhaustive], and Option::{as_deref, as_deref_mut} require Rust 1.40, -// matches! requires Rust 1.42, str::{strip_prefix, strip_suffix} requires Rust 1.45 -#![allow( - clippy::mem_replace_with_default, - clippy::manual_non_exhaustive, - clippy::option_as_ref_deref, - clippy::match_like_matches_macro, - clippy::manual_strip -)] #![allow(clippy::needless_doctest_main)] // older compilers require explicit `extern crate`. @@ -168,9 +161,10 @@ use proc_macro::TokenStream; /// `#[pin_project]` can be used on structs and enums. /// /// ```rust -/// use pin_project::pin_project; /// use std::pin::Pin; /// +/// use pin_project::pin_project; +/// /// #[pin_project] /// struct Struct<T, U> { /// #[pin] @@ -188,9 +182,10 @@ use proc_macro::TokenStream; /// ``` /// /// ```rust -/// use pin_project::pin_project; /// use std::pin::Pin; /// +/// use pin_project::pin_project; +/// /// #[pin_project] /// struct TupleStruct<T, U>(#[pin] T, U); /// @@ -207,9 +202,10 @@ use proc_macro::TokenStream; /// returned from the method. /// /// ```rust -/// use pin_project::pin_project; /// use std::pin::Pin; /// +/// use pin_project::pin_project; +/// /// #[pin_project(project = EnumProj)] /// enum Enum<T, U> { /// Tuple(#[pin] T), @@ -263,9 +259,10 @@ use proc_macro::TokenStream; /// consuming the [`Pin`]. /// /// ```rust -/// use pin_project::pin_project; /// use std::pin::Pin; /// +/// use pin_project::pin_project; +/// /// #[pin_project] /// struct Struct<T> { /// #[pin] @@ -299,9 +296,10 @@ use proc_macro::TokenStream; /// field. /// /// ```rust -/// use pin_project::pin_project; /// use std::marker::PhantomPinned; /// +/// use pin_project::pin_project; +/// /// #[pin_project] /// struct Struct<T> { /// field: T, @@ -373,9 +371,10 @@ use proc_macro::TokenStream; /// For example: /// /// ```rust -/// use pin_project::{pin_project, pinned_drop}; /// use std::{fmt::Debug, pin::Pin}; /// +/// use pin_project::{pin_project, pinned_drop}; +/// /// #[pin_project(PinnedDrop)] /// struct PrintOnDrop<T: Debug, U: Debug> { /// #[pin] @@ -425,9 +424,10 @@ use proc_macro::TokenStream; /// For example: /// /// ```rust -/// use pin_project::pin_project; /// use std::{marker::PhantomData, pin::Pin}; /// +/// use pin_project::pin_project; +/// /// #[pin_project(project_replace)] /// struct Struct<T, U> { /// #[pin] @@ -515,9 +515,10 @@ pub fn pin_project(args: TokenStream, input: TokenStream) -> TokenStream { /// # Examples /// /// ```rust -/// use pin_project::{pin_project, pinned_drop}; /// use std::pin::Pin; /// +/// use pin_project::{pin_project, pinned_drop}; +/// /// #[pin_project(PinnedDrop)] /// struct PrintOnDrop { /// #[pin] diff --git a/src/pin_project/derive.rs b/src/pin_project/derive.rs index 63cd142..4d7d7d8 100644 --- a/src/pin_project/derive.rs +++ b/src/pin_project/derive.rs @@ -102,6 +102,7 @@ impl GenerateTokens { fn global_allowed_lints() -> TokenStream { quote! { #[allow(box_pointers)] // This lint warns use of the `Box` type. + #[allow(deprecated)] #[allow(explicit_outlives_requirements)] // https://github.com/rust-lang/rust/issues/60993 #[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058 #[allow(unreachable_pub)] // This lint warns `pub` field in private struct. @@ -133,6 +134,7 @@ fn proj_allowed_lints(kind: TypeKind) -> (TokenStream, TokenStream, TokenStream) let proj_ref = quote! { #global_allowed_lints #[allow(dead_code)] // This lint warns unused fields/variants. + #[allow(clippy::ref_option_ref)] // This lint warns `&Option<&<ty>>`. #[allow(clippy::type_repetition_in_bounds)] // https://github.com/rust-lang/rust-clippy/issues/4326 }; let proj_own = quote! { @@ -390,7 +392,6 @@ fn parse_struct( #proj_ref_ident #proj_body }; let proj_own_body = quote! { - let __self_ptr: *mut Self = self.get_unchecked_mut(); let Self #proj_pat = &mut *__self_ptr; #proj_own_body }; @@ -472,7 +473,6 @@ fn parse_enum( } }; let proj_own_body = quote! { - let __self_ptr: *mut Self = self.get_unchecked_mut(); match &mut *__self_ptr { #proj_own_arms } @@ -643,13 +643,6 @@ fn proj_own_body( // First, extract all the unpinned fields. let __result = #proj_own #proj_move; - // Destructors will run in reverse order, so next create a guard to overwrite - // `self` with the replacement value without calling destructors. - let __guard = ::pin_project::__private::UnsafeOverwriteGuard { - target: __self_ptr, - value: ::pin_project::__private::ManuallyDrop::new(__replacement), - }; - // Now create guards to drop all the pinned fields. // // Due to a compiler bug (https://github.com/rust-lang/rust/issues/47949) @@ -961,6 +954,15 @@ fn make_proj_impl( quote! { #sig { unsafe { + let __self_ptr: *mut Self = self.get_unchecked_mut(); + + // Destructors will run in reverse order, so next create a guard to overwrite + // `self` with the replacement value without calling destructors. + let __guard = ::pin_project::__private::UnsafeOverwriteGuard { + target: __self_ptr, + value: ::pin_project::__private::ManuallyDrop::new(__replacement), + }; + #proj_own_body } } diff --git a/src/pin_project/mod.rs b/src/pin_project/mod.rs index 380b586..2dce78f 100644 --- a/src/pin_project/mod.rs +++ b/src/pin_project/mod.rs @@ -3,14 +3,15 @@ mod attribute; mod derive; use proc_macro2::TokenStream; +use syn::Error; /// The annotation for pinned type. const PIN: &str = "pin"; pub(crate) fn attribute(args: &TokenStream, input: TokenStream) -> TokenStream { - attribute::parse_attribute(args, input).unwrap_or_else(|e| e.to_compile_error()) + attribute::parse_attribute(args, input).unwrap_or_else(Error::into_compile_error) } pub(crate) fn derive(input: TokenStream) -> TokenStream { - derive::parse_derive(input).unwrap_or_else(|e| e.to_compile_error()) + derive::parse_derive(input).unwrap_or_else(Error::into_compile_error) } diff --git a/src/utils.rs b/src/utils.rs index fe1bf35..37f35ba 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,6 +1,7 @@ +use std::{iter::FromIterator, mem}; + use proc_macro2::{Group, Spacing, Span, TokenStream, TokenTree}; use quote::{quote, quote_spanned, ToTokens}; -use std::{iter::FromIterator, mem}; use syn::{ parse::{Parse, ParseBuffer, ParseStream}, parse_quote, |