Skip to content

Commit

Permalink
Merge #335
Browse files Browse the repository at this point in the history
335: 0.4: Expand glob imports r=taiki-e a=taiki-e

Backport of ab1f198.

0.4.28 and older versions are failed to compile with syn 1.0.84 and later.

```
error[E0659]: `parse_quote_spanned` is ambiguous
   --> pin-project-internal/src/pin_project/derive.rs:865:67
    |
865 |                 proj_generics.make_where_clause().predicates.push(parse_quote_spanned! { span =>
    |                                                                   ^^^^^^^^^^^^^^^^^^^ ambiguous name
    |
    = note: ambiguous because of a conflict between a `macro_rules` name and a non-`macro_rules` name from another module
note: `parse_quote_spanned` could refer to the macro defined here
   --> pin-project-internal/src/utils.rs:23:1
    |
23  | / macro_rules! parse_quote_spanned {
24  | |     ($span:expr => $($tt:tt)*) => {
25  | |         syn::parse2(quote::quote_spanned!($span => $($tt)*)).unwrap_or_else(|e| panic!("{}", e))
26  | |     };
27  | | }
    | |_^
note: `parse_quote_spanned` could also refer to the macro imported here
   --> pin-project-internal/src/pin_project/derive.rs:7:5
    |
7   |     *,
    |     ^
    = help: use `self::parse_quote_spanned` to refer to this macro unambiguously
```

See ddcd880 for v1.0.

Co-authored-by: Taiki Endo <te316e89@gmail.com>
  • Loading branch information
bors[bot] and taiki-e committed Dec 26, 2021
2 parents 7f91b0a + 1cb267f commit 2b6e71a
Show file tree
Hide file tree
Showing 82 changed files with 1,018 additions and 681 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- uses: taiki-e/github-actions/install-rust@main
with:
toolchain: ${{ matrix.rust }}
component: rustfmt
component: rustfmt,rust-src
- name: Pre Cache cargo-expand
run: |
mkdir -p .github/caching
Expand Down
35 changes: 22 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org).

<!--
NOTE: In this file, do not use the hard wrap in the middle of a sentence for compatibility with GitHub comment style markdown rendering.
-->

## [Unreleased]

## [0.4.29] - 2021-12-26

- [Fix compile error with `syn` 1.0.84 and later.](https://github.com/taiki-e/pin-project/pull/335)

## [0.4.28] - 2021-03-28

- [Fix `unused_must_use` warning on unused borrows, which will be added to rustc in the future.](https://github.com/taiki-e/pin-project/pull/322) See [#322](https://github.com/taiki-e/pin-project/pull/322) for more details.

(Note: 1.0 does not have this problem.)
(NOTE: 1.0 does not have this problem.)

## [0.4.27] - 2020-10-11

Expand All @@ -24,13 +32,13 @@ This project adheres to [Semantic Versioning](https://semver.org).

- [Suppress `drop_bounds` lint, which will be added to rustc in the future.](https://github.com/taiki-e/pin-project/pull/273) See [#272](https://github.com/taiki-e/pin-project/issues/272) for more details.

(Note: 1.0.0-alpha.1 already contains this change.)
(NOTE: 1.0.0-alpha.1 already contains this change.)

## [0.4.24] - 2020-09-26

- [Fix compatibility of generated code with `forbid(future_incompatible)`.](https://github.com/taiki-e/pin-project/pull/282)

Note: This does not guarantee compatibility with `forbid(future_incompatible)` in the future.
NOTE: This does not guarantee compatibility with `forbid(future_incompatible)` in the future.
If rustc adds a new lint, we may not be able to keep this.

## [0.4.23] - 2020-07-27
Expand Down Expand Up @@ -161,7 +169,7 @@ This project adheres to [Semantic Versioning](https://semver.org).
}
```

*[Note: This raises the minimum supported Rust version of this crate from Rust 1.33 to Rust 1.34.](https://github.com/taiki-e/pin-project/pull/219#pullrequestreview-408644187)*
*[NOTE: This raises the minimum supported Rust version of this crate from Rust 1.33 to Rust 1.34.](https://github.com/taiki-e/pin-project/pull/219#pullrequestreview-408644187)*

- [Fix an issue where duplicate `#[project]` attributes were ignored.](https://github.com/taiki-e/pin-project/pull/218)

Expand Down Expand Up @@ -195,7 +203,7 @@ This project adheres to [Semantic Versioning](https://semver.org).

## [0.4.11] - 2020-05-07

**Note: This release has been yanked.** See [#206](https://github.com/taiki-e/pin-project/issues/206) for details.
**NOTE:** This release has been yanked. See [#206](https://github.com/taiki-e/pin-project/issues/206) for details.

- [Fix an issue that `#[project]` on non-statement expression does not work without unstable features.](https://github.com/taiki-e/pin-project/pull/197)

Expand Down Expand Up @@ -249,7 +257,7 @@ This project adheres to [Semantic Versioning](https://semver.org).

## [0.4.3] - 2019-10-15

**Note: This release has been yanked.** See [#148](https://github.com/taiki-e/pin-project/pull/148) for details.
**NOTE:** This release has been yanked. See [#148](https://github.com/taiki-e/pin-project/pull/148) for details.

- [`#[pin_project]` can now interoperate with `#[cfg_attr()]`.](https://github.com/taiki-e/pin-project/pull/135)

Expand All @@ -261,19 +269,19 @@ This project adheres to [Semantic Versioning](https://semver.org).

## [0.4.2] - 2019-09-29

**Note: This release has been yanked.** See [#148](https://github.com/taiki-e/pin-project/pull/148) for details.
**NOTE:** This release has been yanked. See [#148](https://github.com/taiki-e/pin-project/pull/148) for details.

- [Fix support for DSTs(Dynamically Sized Types).](https://github.com/taiki-e/pin-project/pull/113)

## [0.4.1] - 2019-09-26

**Note: This release has been yanked.** See [#148](https://github.com/taiki-e/pin-project/pull/148) for details.
**NOTE:** This release has been yanked. See [#148](https://github.com/taiki-e/pin-project/pull/148) for details.

- [Fix an issue that caused an error when using `#[pin_project]` on a type that has `#[pin]` + `!Unpin` field with no generics or lifetime.](https://github.com/taiki-e/pin-project/pull/111)

## [0.4.0] - 2019-09-25

**Note: This release has been yanked.** See [#148](https://github.com/taiki-e/pin-project/pull/148) for details.
**NOTE:** This release has been yanked. See [#148](https://github.com/taiki-e/pin-project/pull/148) for details.

- [**Pin projection has become a safe operation.**](https://github.com/taiki-e/pin-project/pull/18) In the absence of other unsafe code that you write, it is impossible to cause undefined behavior.

Expand Down Expand Up @@ -402,7 +410,7 @@ Changes since the 0.4.0-beta.1 release:

- `Unpin` impls must be specified with an impl of `UnsafeUnpin`, instead of implementing the normal `Unpin` trait.

- Made `#[project]` attribute disabled by default.
- Make `#[project]` attribute disabled by default.

See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project/issues/21).

Expand All @@ -416,7 +424,7 @@ See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project

## [0.3.3] - 2019-07-15

**Note: This release has been yanked.** See [#16](https://github.com/taiki-e/pin-project/issues/16) for details.
**NOTE:** This release has been yanked. See [#16](https://github.com/taiki-e/pin-project/issues/16) for details.

- Diagnostic improvements.

Expand Down Expand Up @@ -490,11 +498,12 @@ See also [tracking issue for 0.4 release](https://github.com/taiki-e/pin-project

## [0.1.0] - 2019-01-08

**Note: This release has been yanked.**
**NOTE:** This release has been yanked.

Initial release

[Unreleased]: https://github.com/taiki-e/pin-project/compare/v0.4.28...HEAD
[Unreleased]: https://github.com/taiki-e/pin-project/compare/v0.4.29...v0.4
[0.4.29]: https://github.com/taiki-e/pin-project/compare/v0.4.28...v0.4.29
[0.4.28]: https://github.com/taiki-e/pin-project/compare/v0.4.27...v0.4.28
[0.4.27]: https://github.com/taiki-e/pin-project/compare/v0.4.26...v0.4.27
[0.4.26]: https://github.com/taiki-e/pin-project/compare/v0.4.25...v0.4.26
Expand Down
11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[package]
name = "pin-project"
version = "0.4.28"
authors = ["Taiki Endo <te316e89@gmail.com>"]
version = "0.4.29"
edition = "2018"
rust-version = "1.34"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/taiki-e/pin-project"
documentation = "https://docs.rs/pin-project"
keywords = ["pin", "macros", "attribute"]
categories = ["no-std", "rust-patterns"]
exclude = ["/.*", "/ci", "/tools"]
Expand All @@ -28,9 +27,13 @@ members = [
]

[dependencies]
pin-project-internal = { version = "=0.4.28", path = "pin-project-internal", default-features = false }
pin-project-internal = { version = "=0.4.29", path = "pin-project-internal", default-features = false }

[dev-dependencies]
pin-project-auxiliary-macro = { path = "tests/ui/auxiliary" }
rustversion = "1.0"
trybuild = "1.0"

# For test on MSRV.
ryu = "=1.0.6"
serde_json = "=1.0.72"
5 changes: 2 additions & 3 deletions pin-project-internal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[package]
name = "pin-project-internal"
version = "0.4.28"
authors = ["Taiki Endo <te316e89@gmail.com>"]
version = "0.4.29"
edition = "2018"
rust-version = "1.34"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/taiki-e/pin-project"
documentation = "https://docs.rs/pin-project-internal"
keywords = ["pin", "macros", "attribute"]
categories = ["no-std", "rust-patterns"]
description = """
Expand Down
2 changes: 1 addition & 1 deletion pin-project-internal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
))]
#![warn(unsafe_code)]
#![warn(rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
#![warn(clippy::all, clippy::default_trait_access)]
#![warn(clippy::default_trait_access, clippy::wildcard_imports)]
// mem::take and #[non_exhaustive] requires Rust 1.40
#![allow(clippy::mem_replace_with_default, clippy::manual_non_exhaustive)]
#![allow(clippy::needless_doctest_main)]
Expand Down
2 changes: 1 addition & 1 deletion pin-project-internal/src/pin_project/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use proc_macro2::TokenStream;
use quote::quote;
use syn::{
parse::{Parse, ParseStream},
*,
Attribute, Result, Token, Visibility,
};

use super::PIN;
Expand Down
6 changes: 5 additions & 1 deletion pin-project-internal/src/pin_project/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ use proc_macro2::{Delimiter, Group, Span, TokenStream};
use quote::{format_ident, quote, quote_spanned, ToTokens};
use syn::{
parse::{Parse, ParseStream},
parse_quote,
spanned::Spanned,
token,
visit_mut::VisitMut,
*,
Attribute, Data, DataEnum, DataStruct, DeriveInput, Error, Field, Fields, FieldsNamed,
FieldsUnnamed, Generics, Ident, Index, Lifetime, LifetimeDef, Meta, MetaList, NestedMeta,
Result, Token, Type, Variant, Visibility, WhereClause,
};

use super::PIN;
Expand Down
6 changes: 5 additions & 1 deletion pin-project-internal/src/pinned_drop.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};
use syn::{spanned::Spanned, visit_mut::VisitMut, *};
use syn::{
parse_quote, spanned::Spanned, visit_mut::VisitMut, Error, FnArg, GenericArgument, Ident,
ImplItem, ImplItemMethod, ItemImpl, Pat, Path, PathArguments, Result, ReturnType, Token, Type,
TypePath, TypeReference,
};

use crate::utils::{parse_as_empty, prepend_underscore_to_self, ReplaceReceiver, SliceExt};

Expand Down
5 changes: 4 additions & 1 deletion pin-project-internal/src/project.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use proc_macro2::{Span, TokenStream};
use quote::ToTokens;
use syn::{
parse_quote,
visit_mut::{self, VisitMut},
*,
Expr, ExprLet, ExprMatch, Ident, ImplItem, Item, ItemFn, ItemImpl, ItemUse, Lifetime, Local,
Pat, PatBox, PatIdent, PatOr, PatPath, PatReference, PatStruct, PatTupleStruct, PatType, Path,
PathArguments, PathSegment, Result, Stmt, Type, TypePath, UseTree,
};

use crate::utils::{
Expand Down
6 changes: 5 additions & 1 deletion pin-project-internal/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ use proc_macro2::{Group, Spacing, Span, TokenStream, TokenTree};
use quote::{format_ident, quote, quote_spanned, ToTokens};
use syn::{
parse::{Parse, ParseBuffer, ParseStream},
parse_quote,
punctuated::Punctuated,
token,
visit_mut::{self, VisitMut},
*,
Attribute, ExprPath, ExprStruct, Generics, Ident, Item, Lifetime, LifetimeDef, Macro, PatPath,
PatStruct, PatTupleStruct, Path, PathArguments, PredicateType, QSelf, Result, Token, Type,
TypeParamBound, TypePath, Variant, Visibility, WherePredicate,
};

pub(crate) type Variants = Punctuated<Variant, Token![,]>;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
attr(deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code))
))]
#![warn(missing_docs, rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
#![warn(clippy::all, clippy::default_trait_access)]
#![warn(clippy::default_trait_access, clippy::wildcard_imports)]
// mem::take and #[non_exhaustive] requires Rust 1.40
#![allow(clippy::mem_replace_with_default, clippy::manual_non_exhaustive)]
#![allow(clippy::needless_doctest_main)]
Expand Down
1 change: 0 additions & 1 deletion tests/doc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "doctest"
version = "0.1.0"
authors = ["Taiki Endo <te316e89@gmail.com>"]
edition = "2018"
publish = false

Expand Down
7 changes: 3 additions & 4 deletions tests/doc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
no_crate_inject,
attr(deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code))
))]
#![cfg_attr(doctest, feature(external_doc))]

// As `feature(external_doc)` and `doc-comment` do not work with `cfg(test)`,
// As `doc = include_str!` and `doc-comment` do not work with `cfg(test)`,
// and `cfg(doctest)` requires 1.40, these tests are split into this crate until
// MSRV increases.

#[cfg(doctest)]
#[doc(include = "../../README.md")]
// https://github.com/rust-lang/rust/issues/82768
#[cfg_attr(doctest, cfg_attr(doctest, doc = include_str!("../../README.md")))]
const _README: () = ();
1 change: 0 additions & 1 deletion tests/expand/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "expandtest"
version = "0.1.0"
authors = ["Taiki Endo <te316e89@gmail.com>"]
edition = "2018"
publish = false

Expand Down
1 change: 0 additions & 1 deletion tests/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unaligned_references,
unreachable_pub,
unused_extern_crates,
unused_import_braces,
Expand Down
1 change: 0 additions & 1 deletion tests/no-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "no-core"
version = "0.1.0"
authors = ["Taiki Endo <te316e89@gmail.com>"]
edition = "2018"
publish = false

Expand Down
1 change: 0 additions & 1 deletion tests/no-std/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "no-std"
version = "0.1.0"
authors = ["Taiki Endo <te316e89@gmail.com>"]
edition = "2018"
publish = false

Expand Down
1 change: 0 additions & 1 deletion tests/rust-2015/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "rust-2015"
version = "0.1.0"
authors = ["Taiki Endo <te316e89@gmail.com>"]
edition = "2015"
publish = false

Expand Down
1 change: 0 additions & 1 deletion tests/ui/auxiliary/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "pin-project-auxiliary-macro"
version = "0.0.0"
authors = ["Taiki Endo <te316e89@gmail.com>"]
edition = "2018"
publish = false

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/cfg/cfg_attr-resolve.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0599]: no method named `project` found for struct `Pin<&mut Foo<u8>>` in the current scope
--> $DIR/cfg_attr-resolve.rs:10:31
--> tests/ui/cfg/cfg_attr-resolve.rs:10:31
|
10 | let _x = Pin::new(&mut x).project(); //~ ERROR E0599
| ^^^^^^^ method not found in `Pin<&mut Foo<u8>>`
4 changes: 2 additions & 2 deletions tests/ui/cfg/cfg_attr-type-mismatch.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/cfg_attr-type-mismatch.rs:19:27
--> tests/ui/cfg/cfg_attr-type-mismatch.rs:19:27
|
19 | let _: Pin<&mut u8> = x.inner; //~ ERROR E0308
| ------------ ^^^^^^^ expected struct `Pin`, found `&mut u8`
Expand All @@ -10,7 +10,7 @@ error[E0308]: mismatched types
found mutable reference `&mut u8`

error[E0308]: mismatched types
--> $DIR/cfg_attr-type-mismatch.rs:23:22
--> tests/ui/cfg/cfg_attr-type-mismatch.rs:23:22
|
23 | let _: &mut u8 = x.inner; //~ ERROR E0308
| ------- ^^^^^^^
Expand Down
Loading

0 comments on commit 2b6e71a

Please sign in to comment.