diff options
author | Haibo Huang <hhb@google.com> | 2020-05-18 15:51:06 -0700 |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2020-05-18 15:51:06 -0700 |
commit | 2960bb3286f62288b139b5251c4fae8af4b229da (patch) | |
tree | f05ba22a13d80ded5528edd1bf8a9e0aa5451a51 /tests/ui | |
parent | 6f3e9271b123f94f158b1f000c996a558351320f (diff) | |
download | pin-project-2960bb3286f62288b139b5251c4fae8af4b229da.tar.gz |
Upgrade rust/crates/pin-project to 0.4.17platform-tools-30.0.3platform-tools-30.0.2
Test: None
Change-Id: Ief1c86f13cbb3473c76f2435a0198c7e3efbd2cf
Diffstat (limited to 'tests/ui')
-rw-r--r-- | tests/ui/pin_project/conflict-naming.rs | 6 | ||||
-rw-r--r-- | tests/ui/pin_project/conflict-naming.stderr | 21 | ||||
-rw-r--r-- | tests/ui/pin_project/invalid.rs | 30 | ||||
-rw-r--r-- | tests/ui/pin_project/invalid.stderr | 150 | ||||
-rw-r--r-- | tests/ui/pin_project/visibility.rs | 30 | ||||
-rw-r--r-- | tests/ui/pin_project/visibility.stderr | 40 | ||||
-rw-r--r-- | tests/ui/unstable-features/trivial_bounds-bug.stderr | 5 | ||||
-rw-r--r-- | tests/ui/unstable-features/trivial_bounds-feature-gate.stderr | 5 |
8 files changed, 238 insertions, 49 deletions
diff --git a/tests/ui/pin_project/conflict-naming.rs b/tests/ui/pin_project/conflict-naming.rs new file mode 100644 index 0000000..1cb50b4 --- /dev/null +++ b/tests/ui/pin_project/conflict-naming.rs @@ -0,0 +1,6 @@ +use pin_project::pin_project; + +#[pin_project(project = A, project_ref = A)] //~ ERROR E0428,E0308 +struct Struct(#[pin] ()); + +fn main() {} diff --git a/tests/ui/pin_project/conflict-naming.stderr b/tests/ui/pin_project/conflict-naming.stderr new file mode 100644 index 0000000..bbac1eb --- /dev/null +++ b/tests/ui/pin_project/conflict-naming.stderr @@ -0,0 +1,21 @@ +error[E0428]: the name `A` is defined multiple times + --> $DIR/conflict-naming.rs:3:1 + | +3 | #[pin_project(project = A, project_ref = A)] //~ ERROR E0428,E0308 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | `A` redefined here + | previous definition of the type `A` here + | + = note: `A` must be defined only once in the type namespace of this module + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> $DIR/conflict-naming.rs:3:1 + | +3 | #[pin_project(project = A, project_ref = A)] //~ ERROR E0428,E0308 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability + | + = note: expected mutable reference `&mut ()` + found reference `&()` + = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/pin_project/invalid.rs b/tests/ui/pin_project/invalid.rs index 1d05608..d7911df 100644 --- a/tests/ui/pin_project/invalid.rs +++ b/tests/ui/pin_project/invalid.rs @@ -118,6 +118,18 @@ mod pin_project_argument { #[pin_project(PinnedDrop, UnsafeUnpin, PinnedDrop, UnsafeUnpin)] //~ ERROR duplicate `PinnedDrop` argument struct Duplicate4(#[pin] ()); + #[pin_project(project = A, project = B)] //~ ERROR duplicate `project` argument + struct DuplicateProject(#[pin] ()); + + #[pin_project(project_ref = A, project_ref = B)] //~ ERROR duplicate `project_ref` argument + struct DuplicateProjectRef(#[pin] ()); + + #[pin_project(project_replace = A, project_replace = B)] //~ ERROR duplicate `project_replace` argument + struct DuplicateProjectReplace(#[pin] ()); + + #[pin_project(project_replace = A)] //~ ERROR `project_replace` argument can only be used together with `Replace` argument + struct ProjectReplaceWithoutReplace(#[pin] ()); + #[pin_project(PinnedDrop, Replace)] //~ ERROR arguments `PinnedDrop` and `Replace` are mutually exclusive struct PinnedDropWithReplace1(#[pin] ()); @@ -135,6 +147,24 @@ mod pin_project_argument { #[pin_project(Unpin)] //~ ERROR unexpected argument struct NotUnpin2(#[pin] ()); + + #[pin_project(project)] //~ ERROR expected `=` + struct Project1(#[pin] ()); + + #[pin_project(project = )] //~ ERROR unexpected end of input, expected identifier + struct Project2(#[pin] ()); + + #[pin_project(project_ref)] //~ ERROR expected `=` + struct ProjectRef1(#[pin] ()); + + #[pin_project(project_ref = )] //~ ERROR unexpected end of input, expected identifier + struct ProjectRef2(#[pin] ()); + + #[pin_project(project_replace)] //~ ERROR expected `=` + struct ProjectReplace1(#[pin] ()); + + #[pin_project(project_replace = )] //~ ERROR unexpected end of input, expected identifier + struct ProjectReplace2(#[pin] ()); } mod pin_project_attribute { diff --git a/tests/ui/pin_project/invalid.stderr b/tests/ui/pin_project/invalid.stderr index 95b57f0..82026aa 100644 --- a/tests/ui/pin_project/invalid.stderr +++ b/tests/ui/pin_project/invalid.stderr @@ -118,111 +118,183 @@ error: duplicate `PinnedDrop` argument 118 | #[pin_project(PinnedDrop, UnsafeUnpin, PinnedDrop, UnsafeUnpin)] //~ ERROR duplicate `PinnedDrop` argument | ^^^^^^^^^^ +error: duplicate `project` argument + --> $DIR/invalid.rs:121:32 + | +121 | #[pin_project(project = A, project = B)] //~ ERROR duplicate `project` argument + | ^^^^^^^ + +error: duplicate `project_ref` argument + --> $DIR/invalid.rs:124:36 + | +124 | #[pin_project(project_ref = A, project_ref = B)] //~ ERROR duplicate `project_ref` argument + | ^^^^^^^^^^^ + +error: duplicate `project_replace` argument + --> $DIR/invalid.rs:127:40 + | +127 | #[pin_project(project_replace = A, project_replace = B)] //~ ERROR duplicate `project_replace` argument + | ^^^^^^^^^^^^^^^ + +error: `project_replace` argument can only be used together with `Replace` argument + --> $DIR/invalid.rs:130:19 + | +130 | #[pin_project(project_replace = A)] //~ ERROR `project_replace` argument can only be used together with `Replace` argument + | ^^^^^^^^^^^^^^^ + error: arguments `PinnedDrop` and `Replace` are mutually exclusive - --> $DIR/invalid.rs:121:19 + --> $DIR/invalid.rs:133:19 | -121 | #[pin_project(PinnedDrop, Replace)] //~ ERROR arguments `PinnedDrop` and `Replace` are mutually exclusive +133 | #[pin_project(PinnedDrop, Replace)] //~ ERROR arguments `PinnedDrop` and `Replace` are mutually exclusive | ^^^^^^^^^^ error: arguments `PinnedDrop` and `Replace` are mutually exclusive - --> $DIR/invalid.rs:124:41 + --> $DIR/invalid.rs:136:41 | -124 | #[pin_project(Replace, UnsafeUnpin, PinnedDrop)] //~ ERROR arguments `PinnedDrop` and `Replace` are mutually exclusive +136 | #[pin_project(Replace, UnsafeUnpin, PinnedDrop)] //~ ERROR arguments `PinnedDrop` and `Replace` are mutually exclusive | ^^^^^^^^^^ error: arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive - --> $DIR/invalid.rs:127:19 + --> $DIR/invalid.rs:139:19 | -127 | #[pin_project(UnsafeUnpin, !Unpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive +139 | #[pin_project(UnsafeUnpin, !Unpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive | ^^^^^^^^^^^ error: arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive - --> $DIR/invalid.rs:130:39 + --> $DIR/invalid.rs:142:39 | -130 | #[pin_project(!Unpin, PinnedDrop, UnsafeUnpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive +142 | #[pin_project(!Unpin, PinnedDrop, UnsafeUnpin)] //~ ERROR arguments `UnsafeUnpin` and `!Unpin` are mutually exclusive | ^^^^^^^^^^^ error: unexpected end of input, expected `Unpin` - --> $DIR/invalid.rs:133:5 + --> $DIR/invalid.rs:145:5 | -133 | #[pin_project(!)] //~ ERROR unexpected end of input, expected `Unpin` +145 | #[pin_project(!)] //~ ERROR unexpected end of input, expected `Unpin` | ^^^^^^^^^^^^^^^^^ | = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: unexpected argument: Unpin - --> $DIR/invalid.rs:136:19 + --> $DIR/invalid.rs:148:19 | -136 | #[pin_project(Unpin)] //~ ERROR unexpected argument +148 | #[pin_project(Unpin)] //~ ERROR unexpected argument | ^^^^^ +error: expected `=` + --> $DIR/invalid.rs:151:5 + | +151 | #[pin_project(project)] //~ ERROR expected `=` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unexpected end of input, expected identifier + --> $DIR/invalid.rs:154:5 + | +154 | #[pin_project(project = )] //~ ERROR unexpected end of input, expected identifier + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `=` + --> $DIR/invalid.rs:157:5 + | +157 | #[pin_project(project_ref)] //~ ERROR expected `=` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unexpected end of input, expected identifier + --> $DIR/invalid.rs:160:5 + | +160 | #[pin_project(project_ref = )] //~ ERROR unexpected end of input, expected identifier + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected `=` + --> $DIR/invalid.rs:163:5 + | +163 | #[pin_project(project_replace)] //~ ERROR expected `=` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unexpected end of input, expected identifier + --> $DIR/invalid.rs:166:5 + | +166 | #[pin_project(project_replace = )] //~ ERROR unexpected end of input, expected identifier + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + error: duplicate #[pin_project] attribute - --> $DIR/invalid.rs:144:5 + --> $DIR/invalid.rs:174:5 | -144 | #[pin_project] //~ ERROR duplicate #[pin_project] attribute +174 | #[pin_project] //~ ERROR duplicate #[pin_project] attribute | ^^^^^^^^^^^^^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/invalid.rs:152:19 + --> $DIR/invalid.rs:182:19 | -152 | struct Struct {} //~ ERROR may not be used on structs with zero fields +182 | struct Struct {} //~ ERROR may not be used on structs with zero fields | ^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/invalid.rs:155:23 + --> $DIR/invalid.rs:185:23 | -155 | struct TupleStruct(); //~ ERROR may not be used on structs with zero fields +185 | struct TupleStruct(); //~ ERROR may not be used on structs with zero fields | ^^ error: #[pin_project] attribute may not be used on structs with zero fields - --> $DIR/invalid.rs:158:12 + --> $DIR/invalid.rs:188:12 | -158 | struct UnitStruct; //~ ERROR may not be used on structs with zero fields +188 | struct UnitStruct; //~ ERROR may not be used on structs with zero fields | ^^^^^^^^^^ error: #[pin_project] attribute may not be used on enums without variants - --> $DIR/invalid.rs:161:20 + --> $DIR/invalid.rs:191:20 | -161 | enum EnumEmpty {} //~ ERROR may not be used on enums without variants +191 | enum EnumEmpty {} //~ ERROR may not be used on enums without variants | ^^ error: #[pin_project] attribute may not be used on enums with discriminants - --> $DIR/invalid.rs:165:13 + --> $DIR/invalid.rs:195:13 | -165 | V = 2, //~ ERROR may not be used on enums with discriminants +195 | V = 2, //~ ERROR may not be used on enums with discriminants | ^ error: #[pin_project] attribute may not be used on enums with zero fields - --> $DIR/invalid.rs:170:9 + --> $DIR/invalid.rs:200:9 | -170 | / Unit, //~ ERROR may not be used on enums with zero fields -171 | | Tuple(), -172 | | Struct {}, +200 | / Unit, //~ ERROR may not be used on enums with zero fields +201 | | Tuple(), +202 | | Struct {}, | |__________________^ error: #[pin_project] attribute may only be used on structs or enums - --> $DIR/invalid.rs:176:5 + --> $DIR/invalid.rs:206:5 | -176 | / union Union { -177 | | //~^ ERROR may only be used on structs or enums -178 | | f: (), -179 | | } +206 | / union Union { +207 | | //~^ ERROR may only be used on structs or enums +208 | | f: (), +209 | | } | |_____^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/invalid.rs:187:12 + --> $DIR/invalid.rs:217:12 | -187 | #[repr(packed)] +217 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/invalid.rs:191:12 + --> $DIR/invalid.rs:221:12 | -191 | #[repr(packed)] +221 | #[repr(packed)] | ^^^^^^ error: #[pin_project] attribute may not be used on #[repr(packed)] types - --> $DIR/invalid.rs:195:12 + --> $DIR/invalid.rs:225:12 | -195 | #[repr(packed)] +225 | #[repr(packed)] | ^^^^^^ diff --git a/tests/ui/pin_project/visibility.rs b/tests/ui/pin_project/visibility.rs index 4f0cb1b..7dce6ab 100644 --- a/tests/ui/pin_project/visibility.rs +++ b/tests/ui/pin_project/visibility.rs @@ -49,4 +49,34 @@ pub mod pub_crate_use { }; } +mod pub_renamed { + use pin_project::pin_project; + + #[pin_project(project = DProj, project_ref = DProjRef)] + pub struct Default(()); + + #[pin_project(Replace, project = RProj, project_ref = RProjRef, project_replace = RProjOwn)] + pub struct Replace(()); +} +pub mod pub_renamed_use { + #[rustfmt::skip] + pub use crate::pub_renamed::DProj; //~ ERROR E0365 + #[rustfmt::skip] + pub use crate::pub_renamed::DProjRef; //~ ERROR E0365 + #[rustfmt::skip] + pub use crate::pub_renamed::RProj; //~ ERROR E0365 + #[rustfmt::skip] + pub use crate::pub_renamed::RProjOwn; //~ ERROR E0365 + #[rustfmt::skip] + pub use crate::pub_renamed::RProjRef; //~ ERROR E0365 + + // Confirm that the visibility of the original type is not changed. + pub use crate::pub_renamed::{Default, Replace}; +} +pub mod pub_renamed_use2 { + // Ok + #[allow(unused_imports)] + pub(crate) use crate::pub_renamed::{DProj, DProjRef, RProj, RProjOwn, RProjRef}; +} + fn main() {} diff --git a/tests/ui/pin_project/visibility.stderr b/tests/ui/pin_project/visibility.stderr index 1ea60d7..cab0e2e 100644 --- a/tests/ui/pin_project/visibility.stderr +++ b/tests/ui/pin_project/visibility.stderr @@ -37,3 +37,43 @@ error[E0365]: `__ReplaceProjectionRef` is private, and cannot be re-exported | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `__ReplaceProjectionRef` | = note: consider declaring type or module `__ReplaceProjectionRef` with `pub` + +error[E0365]: `DProj` is private, and cannot be re-exported + --> $DIR/visibility.rs:63:13 + | +63 | pub use crate::pub_renamed::DProj; //~ ERROR E0365 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `DProj` + | + = note: consider declaring type or module `DProj` with `pub` + +error[E0365]: `DProjRef` is private, and cannot be re-exported + --> $DIR/visibility.rs:65:13 + | +65 | pub use crate::pub_renamed::DProjRef; //~ ERROR E0365 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `DProjRef` + | + = note: consider declaring type or module `DProjRef` with `pub` + +error[E0365]: `RProj` is private, and cannot be re-exported + --> $DIR/visibility.rs:67:13 + | +67 | pub use crate::pub_renamed::RProj; //~ ERROR E0365 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProj` + | + = note: consider declaring type or module `RProj` with `pub` + +error[E0365]: `RProjOwn` is private, and cannot be re-exported + --> $DIR/visibility.rs:69:13 + | +69 | pub use crate::pub_renamed::RProjOwn; //~ ERROR E0365 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjOwn` + | + = note: consider declaring type or module `RProjOwn` with `pub` + +error[E0365]: `RProjRef` is private, and cannot be re-exported + --> $DIR/visibility.rs:71:13 + | +71 | pub use crate::pub_renamed::RProjRef; //~ ERROR E0365 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-export of private `RProjRef` + | + = note: consider declaring type or module `RProjRef` with `pub` diff --git a/tests/ui/unstable-features/trivial_bounds-bug.stderr b/tests/ui/unstable-features/trivial_bounds-bug.stderr index 7ddf10c..8370c45 100644 --- a/tests/ui/unstable-features/trivial_bounds-bug.stderr +++ b/tests/ui/unstable-features/trivial_bounds-bug.stderr @@ -3,8 +3,3 @@ error[E0277]: `std::marker::PhantomPinned` cannot be unpinned | 13 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 | ^^^^^ the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - ::: /Users/taiki/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/marker.rs:736:1 - | -736 | pub auto trait Unpin {} - | -------------------- required by this bound in `std::marker::Unpin` diff --git a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr index 31196a2..70450dc 100644 --- a/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr +++ b/tests/ui/unstable-features/trivial_bounds-feature-gate.stderr @@ -12,11 +12,6 @@ error[E0277]: `std::marker::PhantomPinned` cannot be unpinned | 8 | impl Unpin for A where PhantomPinned: Unpin {} //~ ERROR E0277 | ^^^^^ the trait `std::marker::Unpin` is not implemented for `std::marker::PhantomPinned` - | - ::: /Users/taiki/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/marker.rs:736:1 - | -736 | pub auto trait Unpin {} - | -------------------- required by this bound in `std::marker::Unpin` error[E0277]: `std::marker::PhantomPinned` cannot be unpinned --> $DIR/trivial_bounds-feature-gate.rs:16:5 |