Skip to content

Commit 2b6e71a

Browse files
bors[bot]taiki-e
andauthored
Merge #335
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>
2 parents 7f91b0a + 1cb267f commit 2b6e71a

File tree

82 files changed

+1018
-681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1018
-681
lines changed

.github/CODEOWNERS

-1
This file was deleted.

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- uses: taiki-e/github-actions/install-rust@main
3838
with:
3939
toolchain: ${{ matrix.rust }}
40-
component: rustfmt
40+
component: rustfmt,rust-src
4141
- name: Pre Cache cargo-expand
4242
run: |
4343
mkdir -p .github/caching

CHANGELOG.md

+22-13
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ All notable changes to this project will be documented in this file.
44

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

7+
<!--
8+
NOTE: In this file, do not use the hard wrap in the middle of a sentence for compatibility with GitHub comment style markdown rendering.
9+
-->
10+
711
## [Unreleased]
812

13+
## [0.4.29] - 2021-12-26
14+
15+
- [Fix compile error with `syn` 1.0.84 and later.](https://github.com/taiki-e/pin-project/pull/335)
16+
917
## [0.4.28] - 2021-03-28
1018

1119
- [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.
1220

13-
(Note: 1.0 does not have this problem.)
21+
(NOTE: 1.0 does not have this problem.)
1422

1523
## [0.4.27] - 2020-10-11
1624

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

2533
- [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.
2634

27-
(Note: 1.0.0-alpha.1 already contains this change.)
35+
(NOTE: 1.0.0-alpha.1 already contains this change.)
2836

2937
## [0.4.24] - 2020-09-26
3038

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

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

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

164-
*[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)*
172+
*[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)*
165173

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

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

196204
## [0.4.11] - 2020-05-07
197205

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

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

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

250258
## [0.4.3] - 2019-10-15
251259

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

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

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

262270
## [0.4.2] - 2019-09-29
263271

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

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

268276
## [0.4.1] - 2019-09-26
269277

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

272280
- [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)
273281

274282
## [0.4.0] - 2019-09-25
275283

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

278286
- [**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.
279287

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

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

405-
- Made `#[project]` attribute disabled by default.
413+
- Make `#[project]` attribute disabled by default.
406414

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

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

417425
## [0.3.3] - 2019-07-15
418426

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

421429
- Diagnostic improvements.
422430

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

491499
## [0.1.0] - 2019-01-08
492500

493-
**Note: This release has been yanked.**
501+
**NOTE:** This release has been yanked.
494502

495503
Initial release
496504

497-
[Unreleased]: https://github.com/taiki-e/pin-project/compare/v0.4.28...HEAD
505+
[Unreleased]: https://github.com/taiki-e/pin-project/compare/v0.4.29...v0.4
506+
[0.4.29]: https://github.com/taiki-e/pin-project/compare/v0.4.28...v0.4.29
498507
[0.4.28]: https://github.com/taiki-e/pin-project/compare/v0.4.27...v0.4.28
499508
[0.4.27]: https://github.com/taiki-e/pin-project/compare/v0.4.26...v0.4.27
500509
[0.4.26]: https://github.com/taiki-e/pin-project/compare/v0.4.25...v0.4.26

Cargo.toml

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
[package]
22
name = "pin-project"
3-
version = "0.4.28"
4-
authors = ["Taiki Endo <te316e89@gmail.com>"]
3+
version = "0.4.29"
54
edition = "2018"
5+
rust-version = "1.34"
66
license = "Apache-2.0 OR MIT"
77
repository = "https://github.com/taiki-e/pin-project"
8-
documentation = "https://docs.rs/pin-project"
98
keywords = ["pin", "macros", "attribute"]
109
categories = ["no-std", "rust-patterns"]
1110
exclude = ["/.*", "/ci", "/tools"]
@@ -28,9 +27,13 @@ members = [
2827
]
2928

3029
[dependencies]
31-
pin-project-internal = { version = "=0.4.28", path = "pin-project-internal", default-features = false }
30+
pin-project-internal = { version = "=0.4.29", path = "pin-project-internal", default-features = false }
3231

3332
[dev-dependencies]
3433
pin-project-auxiliary-macro = { path = "tests/ui/auxiliary" }
3534
rustversion = "1.0"
3635
trybuild = "1.0"
36+
37+
# For test on MSRV.
38+
ryu = "=1.0.6"
39+
serde_json = "=1.0.72"

pin-project-internal/Cargo.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
[package]
22
name = "pin-project-internal"
3-
version = "0.4.28"
4-
authors = ["Taiki Endo <te316e89@gmail.com>"]
3+
version = "0.4.29"
54
edition = "2018"
5+
rust-version = "1.34"
66
license = "Apache-2.0 OR MIT"
77
repository = "https://github.com/taiki-e/pin-project"
8-
documentation = "https://docs.rs/pin-project-internal"
98
keywords = ["pin", "macros", "attribute"]
109
categories = ["no-std", "rust-patterns"]
1110
description = """

pin-project-internal/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
))]
77
#![warn(unsafe_code)]
88
#![warn(rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
9-
#![warn(clippy::all, clippy::default_trait_access)]
9+
#![warn(clippy::default_trait_access, clippy::wildcard_imports)]
1010
// mem::take and #[non_exhaustive] requires Rust 1.40
1111
#![allow(clippy::mem_replace_with_default, clippy::manual_non_exhaustive)]
1212
#![allow(clippy::needless_doctest_main)]

pin-project-internal/src/pin_project/attribute.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use proc_macro2::TokenStream;
22
use quote::quote;
33
use syn::{
44
parse::{Parse, ParseStream},
5-
*,
5+
Attribute, Result, Token, Visibility,
66
};
77

88
use super::PIN;

pin-project-internal/src/pin_project/derive.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ use proc_macro2::{Delimiter, Group, Span, TokenStream};
22
use quote::{format_ident, quote, quote_spanned, ToTokens};
33
use syn::{
44
parse::{Parse, ParseStream},
5+
parse_quote,
56
spanned::Spanned,
7+
token,
68
visit_mut::VisitMut,
7-
*,
9+
Attribute, Data, DataEnum, DataStruct, DeriveInput, Error, Field, Fields, FieldsNamed,
10+
FieldsUnnamed, Generics, Ident, Index, Lifetime, LifetimeDef, Meta, MetaList, NestedMeta,
11+
Result, Token, Type, Variant, Visibility, WhereClause,
812
};
913

1014
use super::PIN;

pin-project-internal/src/pinned_drop.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
use proc_macro2::TokenStream;
22
use quote::{quote, ToTokens};
3-
use syn::{spanned::Spanned, visit_mut::VisitMut, *};
3+
use syn::{
4+
parse_quote, spanned::Spanned, visit_mut::VisitMut, Error, FnArg, GenericArgument, Ident,
5+
ImplItem, ImplItemMethod, ItemImpl, Pat, Path, PathArguments, Result, ReturnType, Token, Type,
6+
TypePath, TypeReference,
7+
};
48

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

pin-project-internal/src/project.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
use proc_macro2::{Span, TokenStream};
22
use quote::ToTokens;
33
use syn::{
4+
parse_quote,
45
visit_mut::{self, VisitMut},
5-
*,
6+
Expr, ExprLet, ExprMatch, Ident, ImplItem, Item, ItemFn, ItemImpl, ItemUse, Lifetime, Local,
7+
Pat, PatBox, PatIdent, PatOr, PatPath, PatReference, PatStruct, PatTupleStruct, PatType, Path,
8+
PathArguments, PathSegment, Result, Stmt, Type, TypePath, UseTree,
69
};
710

811
use crate::utils::{

pin-project-internal/src/utils.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ use proc_macro2::{Group, Spacing, Span, TokenStream, TokenTree};
44
use quote::{format_ident, quote, quote_spanned, ToTokens};
55
use syn::{
66
parse::{Parse, ParseBuffer, ParseStream},
7+
parse_quote,
78
punctuated::Punctuated,
9+
token,
810
visit_mut::{self, VisitMut},
9-
*,
11+
Attribute, ExprPath, ExprStruct, Generics, Ident, Item, Lifetime, LifetimeDef, Macro, PatPath,
12+
PatStruct, PatTupleStruct, Path, PathArguments, PredicateType, QSelf, Result, Token, Type,
13+
TypeParamBound, TypePath, Variant, Visibility, WherePredicate,
1014
};
1115

1216
pub(crate) type Variants = Punctuated<Variant, Token![,]>;

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
attr(deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code))
4343
))]
4444
#![warn(missing_docs, rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
45-
#![warn(clippy::all, clippy::default_trait_access)]
45+
#![warn(clippy::default_trait_access, clippy::wildcard_imports)]
4646
// mem::take and #[non_exhaustive] requires Rust 1.40
4747
#![allow(clippy::mem_replace_with_default, clippy::manual_non_exhaustive)]
4848
#![allow(clippy::needless_doctest_main)]

tests/doc/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "doctest"
33
version = "0.1.0"
4-
authors = ["Taiki Endo <te316e89@gmail.com>"]
54
edition = "2018"
65
publish = false
76

tests/doc/lib.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
no_crate_inject,
44
attr(deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code))
55
))]
6-
#![cfg_attr(doctest, feature(external_doc))]
76

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

12-
#[cfg(doctest)]
13-
#[doc(include = "../../README.md")]
11+
// https://github.com/rust-lang/rust/issues/82768
12+
#[cfg_attr(doctest, cfg_attr(doctest, doc = include_str!("../../README.md")))]
1413
const _README: () = ();

tests/expand/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "expandtest"
33
version = "0.1.0"
4-
authors = ["Taiki Endo <te316e89@gmail.com>"]
54
edition = "2018"
65
publish = false
76

tests/lint.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
single_use_lifetimes,
1818
trivial_casts,
1919
trivial_numeric_casts,
20-
unaligned_references,
2120
unreachable_pub,
2221
unused_extern_crates,
2322
unused_import_braces,

tests/no-core/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "no-core"
33
version = "0.1.0"
4-
authors = ["Taiki Endo <te316e89@gmail.com>"]
54
edition = "2018"
65
publish = false
76

tests/no-std/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "no-std"
33
version = "0.1.0"
4-
authors = ["Taiki Endo <te316e89@gmail.com>"]
54
edition = "2018"
65
publish = false
76

tests/rust-2015/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "rust-2015"
33
version = "0.1.0"
4-
authors = ["Taiki Endo <te316e89@gmail.com>"]
54
edition = "2015"
65
publish = false
76

tests/ui/auxiliary/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "pin-project-auxiliary-macro"
33
version = "0.0.0"
4-
authors = ["Taiki Endo <te316e89@gmail.com>"]
54
edition = "2018"
65
publish = false
76

tests/ui/cfg/cfg_attr-resolve.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0599]: no method named `project` found for struct `Pin<&mut Foo<u8>>` in the current scope
2-
--> $DIR/cfg_attr-resolve.rs:10:31
2+
--> tests/ui/cfg/cfg_attr-resolve.rs:10:31
33
|
44
10 | let _x = Pin::new(&mut x).project(); //~ ERROR E0599
55
| ^^^^^^^ method not found in `Pin<&mut Foo<u8>>`

tests/ui/cfg/cfg_attr-type-mismatch.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/cfg_attr-type-mismatch.rs:19:27
2+
--> tests/ui/cfg/cfg_attr-type-mismatch.rs:19:27
33
|
44
19 | let _: Pin<&mut u8> = x.inner; //~ ERROR E0308
55
| ------------ ^^^^^^^ expected struct `Pin`, found `&mut u8`
@@ -10,7 +10,7 @@ error[E0308]: mismatched types
1010
found mutable reference `&mut u8`
1111

1212
error[E0308]: mismatched types
13-
--> $DIR/cfg_attr-type-mismatch.rs:23:22
13+
--> tests/ui/cfg/cfg_attr-type-mismatch.rs:23:22
1414
|
1515
23 | let _: &mut u8 = x.inner; //~ ERROR E0308
1616
| ------- ^^^^^^^

0 commit comments

Comments
 (0)