diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c135cd7b0e..5eb9c31890 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,6 +79,19 @@ jobs: echo "Run ./eng/scripts/cargo_readme.sh to update readmes" && exit 1 fi + nightly: + name: Test Nightly + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + override: true + - name: check `into_future` feature + run: cargo check --all --features into_future + test-services: name: Services Tests runs-on: ubuntu-20.04 diff --git a/sdk/core/Cargo.toml b/sdk/core/Cargo.toml index 1fc5971a98..cc6605cf0b 100644 --- a/sdk/core/Cargo.toml +++ b/sdk/core/Cargo.toml @@ -29,7 +29,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" url = "2.2" uuid = { version = "1.0" } -pin-project = "1.0.10" +pin-project = "1.0" paste = "1.0" # Add dependency to getrandom to enable WASM support diff --git a/sdk/core/src/macros.rs b/sdk/core/src/macros.rs index 328f815f0d..708d60924d 100644 --- a/sdk/core/src/macros.rs +++ b/sdk/core/src/macros.rs @@ -124,7 +124,7 @@ macro_rules! operation { // Construct the builder. (@builder // The name of the operation and any generic params along with their constraints - $name:ident<$($generic:ident: $first_constraint:ident $(+ $constraint:ident)* ),*>, + $name:ident<$($generic:ident: $first_constraint:ident $(+ $constraint:ident)* ),* $(+ $lt:lifetime)?>, // The client client: $client:ty, // The required fields that will be used in the constructor @@ -170,7 +170,7 @@ macro_rules! operation { } }; // Construct a builder and the `Future` related code - ($name:ident<$($generic:ident: $first_constraint:ident $(+ $constraint:ident)* ),*>, + ($name:ident<$($generic:ident: $first_constraint:ident $(+ $constraint:ident)* ),* $(+ $lt:lifetime)?>, client: $client:ty, @required $($required:ident: $rtype:ty,)* @@ -180,7 +180,7 @@ macro_rules! operation { $($nosetter:ident: $nstype:ty),* ) => { $crate::operation! { - @builder $name<$($generic: $first_constraint $(+ $constraint)*),*>, + @builder $name<$($generic: $first_constraint $(+ $constraint)*),* $(+ $lt)*>, client: $client, @required $($required: $rtype,)* @@ -192,7 +192,7 @@ macro_rules! operation { $crate::future!($name); azure_core::__private::paste! { #[cfg(feature = "into_future")] - impl std::future::IntoFuture for [<$name Builder>] { + impl <$($generic: $first_constraint $(+ $constraint)*)* $(+ $lt)*> std::future::IntoFuture for [<$name Builder>]<$($generic),*> { type IntoFuture = $name; type Output = <$name as std::future::Future>::Output; fn into_future(self) -> Self::IntoFuture { @@ -251,13 +251,13 @@ macro_rules! operation { } }; // `operation! { CreateDocument, client: UserClient, ?consistency_level: ConsistencyLevel, ??other_field: bool }` - ($name:ident<$($generic:ident: $first_constraint:ident $(+ $constraint:ident)*),*>, + ($name:ident<$($generic:ident: $first_constraint:ident $(+ $constraint:ident)*),* $(+ $lt:lifetime)?>, client: $client:ty, $($required:ident: $rtype:ty,)* $(?$optional:ident: $otype:ty,)* $(#[skip] $nosetter:ident: $nstype:ty),*) => { $crate::operation!{ - $name<$($generic: $first_constraint $(+ $constraint)*),*>, + $name<$($generic: $first_constraint $(+ $constraint)*),* $(+ $lt)*>, client: $client, @required $($required: $rtype,)* diff --git a/sdk/core/src/pageable.rs b/sdk/core/src/pageable.rs index fb52441df7..56406d3284 100644 --- a/sdk/core/src/pageable.rs +++ b/sdk/core/src/pageable.rs @@ -1,6 +1,5 @@ use futures::stream::unfold; use futures::Stream; -use pin_project::pin_project; /// Helper macro for unwrapping `Result`s into the right types /// that `futures::stream::unfold` expects. @@ -19,15 +18,25 @@ macro_rules! r#try { /// for conditionally compiling with a `Send` constraint or not. macro_rules! declare { ($($extra:tt)*) => { - /// A pageable stream that yields items of type `T` - /// - /// Internally uses the Azure specific continuation header to - /// make repeated requests to Azure yielding a new page each time. - #[pin_project] - pub struct Pageable { - #[pin] - stream: std::pin::Pin> $($extra)*>>, + // The use of a module here is a hack to get around the fact that `pin_project` + // generates a method `project_ref` which is never used and generates a warning. + // The module allows us to declare that `dead_code` is allowed but only for + // the `Pageable` type. + mod pageable { + #![allow(dead_code)] + use super::*; + /// A pageable stream that yields items of type `T` + /// + /// Internally uses the Azure specific continuation header to + /// make repeated requests to Azure yielding a new page each time. + #[pin_project::pin_project] + // This is to surpress the unused `project_ref` warning + pub struct Pageable { + #[pin] + pub(crate) stream: std::pin::Pin> $($extra)*>>, + } } + pub use pageable::Pageable; impl Pageable where diff --git a/sdk/data_cosmos/src/lib.rs b/sdk/data_cosmos/src/lib.rs index 29f62df766..40e3c2cb7c 100644 --- a/sdk/data_cosmos/src/lib.rs +++ b/sdk/data_cosmos/src/lib.rs @@ -1,7 +1,6 @@ #![allow(clippy::enum_variant_names)] #![allow(clippy::new_without_default)] #![allow(clippy::module_inception)] -#![cfg_attr(feature = "into_future", feature(into_future))] /*! # The Cosmos DB crate. diff --git a/sdk/data_cosmos/src/operations/create_document.rs b/sdk/data_cosmos/src/operations/create_document.rs index be6494a06f..f6b20686c3 100644 --- a/sdk/data_cosmos/src/operations/create_document.rs +++ b/sdk/data_cosmos/src/operations/create_document.rs @@ -12,7 +12,7 @@ use std::convert::TryFrom; use azure_core::{collect_pinned_stream, Response as HttpResponse}; operation! { - CreateDocument, + CreateDocument, client: CollectionClient, document: D, ?is_upsert: bool, diff --git a/sdk/data_cosmos/src/operations/replace_document.rs b/sdk/data_cosmos/src/operations/replace_document.rs index 045b2e9a6e..3031f2f7e6 100644 --- a/sdk/data_cosmos/src/operations/replace_document.rs +++ b/sdk/data_cosmos/src/operations/replace_document.rs @@ -12,7 +12,7 @@ use chrono::{DateTime, Utc}; use serde::Serialize; operation! { - ReplaceDocument, + ReplaceDocument, client: DocumentClient, document: D, ?indexing_directive: IndexingDirective, diff --git a/sdk/data_tables/src/lib.rs b/sdk/data_tables/src/lib.rs index ab46a48acb..ea63c7b78d 100644 --- a/sdk/data_tables/src/lib.rs +++ b/sdk/data_tables/src/lib.rs @@ -1,5 +1,3 @@ -#![cfg_attr(feature = "into_future", feature(into_future))] - #[macro_use] extern crate log; #[macro_use] diff --git a/sdk/storage_blobs/src/lib.rs b/sdk/storage_blobs/src/lib.rs index 4b0cccd04c..7b270f0d37 100644 --- a/sdk/storage_blobs/src/lib.rs +++ b/sdk/storage_blobs/src/lib.rs @@ -1,5 +1,3 @@ -#![cfg_attr(feature = "into_future", feature(into_future))] - #[macro_use] extern crate serde_derive; #[macro_use]