aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-07-27 09:15:10 -0700
committerChih-Hung Hsieh <chh@google.com>2020-07-27 12:25:28 -0700
commitc9e44565a7c05c4325d8de85598fc4ecded70d58 (patch)
tree8dda06cd32bb36663b6e07187b5a8e8d65660422 /tests
parentd58366dc4a1a1ec807bb02dfc7928051799130ac (diff)
downloadpin-project-c9e44565a7c05c4325d8de85598fc4ecded70d58.tar.gz
Upgrade rust/crates/pin-project to 0.4.23
* Keep local change in src/lib.rs: // ANDROID: Use std to allow building as a dylib. Test: make Change-Id: I5d5a43c5ad9e42c7ecaeb163bc9a25da2ab233a4
Diffstat (limited to 'tests')
-rw-r--r--tests/lint.rs23
-rw-r--r--tests/lint.txt12
-rw-r--r--tests/sized.rs13
-rw-r--r--tests/ui/pin_project/project_replace_unsized.stderr23
-rw-r--r--tests/ui/pin_project/project_replace_unsized_locals.stderr11
-rw-r--r--tests/ui/pinned_drop/self.stderr2
6 files changed, 48 insertions, 36 deletions
diff --git a/tests/lint.rs b/tests/lint.rs
index 25cb649..e152930 100644
--- a/tests/lint.rs
+++ b/tests/lint.rs
@@ -1,13 +1,11 @@
#![warn(rust_2018_idioms, single_use_lifetimes)]
#![warn(future_incompatible, nonstandard_style, rust_2018_compatibility, unused)]
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
-
-#[allow(unknown_lints)] // for old compilers
-#[warn(
+#![allow(unknown_lints)] // for old compilers
+#![warn(
absolute_paths_not_starting_with_crate,
anonymous_parameters,
box_pointers,
- confusable_idents,
deprecated_in_future,
elided_lifetimes_in_paths,
explicit_outlives_requirements,
@@ -38,6 +36,9 @@
// unused_crate_dependencies: unrelated
// unsafe_code: checked in forbid_unsafe module
// unsafe_block_in_unsafe_fn: unstable
+
+// Check interoperability with rustc and clippy lints.
+
pub mod basic {
include!("include/basic.rs");
}
@@ -51,17 +52,23 @@ pub mod forbid_unsafe {
pub mod clippy {
use pin_project::pin_project;
+ #[rustversion::attr(before(1.37), allow(single_use_lifetimes))] // https://github.com/rust-lang/rust/issues/53738
#[pin_project(project_replace)]
+ #[derive(Debug)]
pub struct MutMutStruct<'a, T, U> {
#[pin]
pub pinned: &'a mut T,
pub unpinned: &'a mut U,
}
+ #[rustversion::attr(before(1.37), allow(single_use_lifetimes))] // https://github.com/rust-lang/rust/issues/53738
#[pin_project(project_replace)]
+ #[derive(Debug)]
pub struct MutMutTupleStruct<'a, T, U>(#[pin] &'a mut T, &'a mut U);
+ #[rustversion::attr(before(1.37), allow(single_use_lifetimes))] // https://github.com/rust-lang/rust/issues/53738
#[pin_project(project_replace)]
+ #[derive(Debug)]
pub enum MutMutEnum<'a, T, U> {
Struct {
#[pin]
@@ -73,6 +80,7 @@ pub mod clippy {
}
#[pin_project(project_replace)]
+ #[derive(Debug)]
pub struct TypeRepetitionInBoundsStruct<T, U>
where
Self: Sized,
@@ -83,11 +91,13 @@ pub mod clippy {
}
#[pin_project(project_replace)]
+ #[derive(Debug)]
pub struct TypeRepetitionInBoundsTupleStruct<T, U>(#[pin] T, U)
where
Self: Sized;
#[pin_project(project_replace)]
+ #[derive(Debug)]
pub enum TypeRepetitionInBoundsEnum<T, U>
where
Self: Sized,
@@ -102,6 +112,7 @@ pub mod clippy {
}
#[pin_project(project_replace)]
+ #[derive(Debug)]
pub struct UsedUnderscoreBindingStruct<T, U> {
#[pin]
pub _pinned: T,
@@ -109,6 +120,7 @@ pub mod clippy {
}
#[pin_project(project_replace)]
+ #[derive(Debug)]
pub enum UsedUnderscoreBindingEnum<T, U> {
Struct {
#[pin]
@@ -118,7 +130,8 @@ pub mod clippy {
}
}
-#[rustversion::attr(not(since(2020-06-12)), ignore)]
+#[allow(box_pointers)]
+#[rustversion::attr(not(nightly), ignore)]
#[test]
fn check_lint_list() {
use std::{env, process::Command, str};
diff --git a/tests/lint.txt b/tests/lint.txt
index 5110d4b..4205786 100644
--- a/tests/lint.txt
+++ b/tests/lint.txt
@@ -13,7 +13,6 @@ Lint checks provided by rustc:
absolute-paths-not-starting-with-crate allow fully qualified paths that start with a module name instead of `crate`, `self`, or an extern crate name
anonymous-parameters allow detects anonymous parameters
box-pointers allow use of owned (Box type) heap memory
- confusable-idents allow detects visually confusable pairs between identifiers
deprecated-in-future allow detects use of items that will be deprecated in a future version
elided-lifetimes-in-paths allow hidden lifetime parameters in types are deprecated
explicit-outlives-requirements allow outlives requirements can be inferred
@@ -47,20 +46,25 @@ Lint checks provided by rustc:
asm-sub-register warn using only a subset of a register for inline asm inputs
bare-trait-objects warn suggest using `dyn Trait` for trait objects
bindings-with-variant-name warn detects pattern bindings with the same name as one of the matched variants
+ cenum-impl-drop-cast warn a C-like enum implementing Drop is cast
+ clashing-extern-declarations warn detects when an extern fn has been declared with the same name but different types
coherence-leak-check warn distinct impls distinguished only by the leak-check code
+ confusable-idents warn detects visually confusable pairs between identifiers
dead-code warn detect unused, unexported items
deprecated warn detects use of deprecated items
ellipsis-inclusive-range-patterns warn `...` range patterns are deprecated
exported-private-dependencies warn public interface leaks type from a private dependency
illegal-floating-point-literal-pattern warn floating-point literals cannot be used in patterns
improper-ctypes warn proper use of libc types in foreign modules
+ improper-ctypes-definitions warn proper use of libc types in foreign item definitions
incomplete-features warn incomplete features that may function improperly in some or all cases
inline-no-sanitize warn detects incompatible use of `#[inline(always)]` and `#[no_sanitize(...)]`
intra-doc-link-resolution-failure warn failures in resolving intra-doc link targets
- invalid-codeblock-attribute warn codeblock attribute looks a lot like a known one
+ invalid-codeblock-attributes warn codeblock attribute looks a lot like a known one
invalid-value warn an invalid value is being created (such as a NULL reference)
irrefutable-let-patterns warn detects irrefutable patterns in if-let and while-let statements
late-bound-lifetime-arguments warn detects generic lifetime arguments in path segments with late bound lifetime parameters
+ mixed-script-confusables warn detects Unicode scripts whose mixed script confusables codepoints are solely used
mutable-borrow-reservation-conflict warn reservation of a two-phased borrow conflicts with other shared borrows
non-camel-case-types warn types, variants, traits and type parameters should have camel case names
non-shorthand-field-patterns warn using `Struct { x: x }` instead of `Struct { x }` in a pattern
@@ -128,11 +132,11 @@ Lint groups provided by rustc:
name sub-lints
---- ---------
warnings all lints that are set to issue warnings
- future-incompatible keyword-idents, anonymous-parameters, illegal-floating-point-literal-pattern, private-in-public, pub-use-of-private-extern-crate, invalid-type-param-default, safe-packed-borrows, patterns-in-fns-without-body, missing-fragment-specifier, late-bound-lifetime-arguments, order-dependent-trait-objects, coherence-leak-check, tyvar-behind-raw-pointer, absolute-paths-not-starting-with-crate, unstable-name-collisions, where-clauses-object-safety, proc-macro-derive-resolution-fallback, macro-expanded-macro-exports-accessed-by-absolute-paths, ill-formed-attribute-input, conflicting-repr-hints, ambiguous-associated-items, mutable-borrow-reservation-conflict, indirect-structural-match, soft-unstable, array-into-iter
+ future-incompatible keyword-idents, anonymous-parameters, illegal-floating-point-literal-pattern, private-in-public, pub-use-of-private-extern-crate, invalid-type-param-default, safe-packed-borrows, patterns-in-fns-without-body, missing-fragment-specifier, late-bound-lifetime-arguments, order-dependent-trait-objects, coherence-leak-check, tyvar-behind-raw-pointer, absolute-paths-not-starting-with-crate, unstable-name-collisions, where-clauses-object-safety, proc-macro-derive-resolution-fallback, macro-expanded-macro-exports-accessed-by-absolute-paths, ill-formed-attribute-input, conflicting-repr-hints, ambiguous-associated-items, mutable-borrow-reservation-conflict, indirect-structural-match, soft-unstable, cenum-impl-drop-cast, array-into-iter
nonstandard-style non-camel-case-types, non-snake-case, non-upper-case-globals
rust-2018-compatibility keyword-idents, anonymous-parameters, tyvar-behind-raw-pointer, absolute-paths-not-starting-with-crate
rust-2018-idioms bare-trait-objects, unused-extern-crates, ellipsis-inclusive-range-patterns, elided-lifetimes-in-paths, explicit-outlives-requirements
- rustdoc intra-doc-link-resolution-failure, invalid-codeblock-attribute, missing-doc-code-examples, private-doc-tests
+ rustdoc intra-doc-link-resolution-failure, invalid-codeblock-attributes, missing-doc-code-examples, private-doc-tests
unused unused-imports, unused-variables, unused-assignments, dead-code, unused-mut, unreachable-code, unreachable-patterns, overlapping-patterns, unused-must-use, unused-unsafe, path-statements, unused-attributes, unused-macros, unused-allocation, unused-doc-comments, unused-extern-crates, unused-features, unused-labels, unused-parens, unused-braces, redundant-semicolons
diff --git a/tests/sized.rs b/tests/sized.rs
new file mode 100644
index 0000000..9fd7e2b
--- /dev/null
+++ b/tests/sized.rs
@@ -0,0 +1,13 @@
+#![warn(rust_2018_idioms, single_use_lifetimes)]
+#![allow(dead_code)]
+
+use pin_project::pin_project;
+
+#[pin_project]
+struct Foo<'a, I: ?Sized, Item>
+where
+ I: Iterator,
+{
+ iter: &'a mut I,
+ item: Option<Item>,
+}
diff --git a/tests/ui/pin_project/project_replace_unsized.stderr b/tests/ui/pin_project/project_replace_unsized.stderr
index c3a3be7..0395c4e 100644
--- a/tests/ui/pin_project/project_replace_unsized.stderr
+++ b/tests/ui/pin_project/project_replace_unsized.stderr
@@ -6,11 +6,12 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
4 | struct Struct<T: ?Sized> {
| - this type parameter needs to be `std::marker::Sized`
|
- = help: within `Struct<T>`, the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `Struct<T>`
- = note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
+help: function arguments must have a statically known size, borrowed types always have a known size
+ |
+3 | #[pin_project(&project_replace)] //~ ERROR E0277
+ | ^
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/project_replace_unsized.rs:5:5
@@ -19,9 +20,6 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
| - this type parameter needs to be `std::marker::Sized`
5 | x: T,
| ^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/project_replace_unsized.rs:3:1
@@ -31,8 +29,6 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
4 | struct Struct<T: ?Sized> {
| - this type parameter needs to be `std::marker::Sized`
|
- = help: within `__StructProjectionOwned<T>`, the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `__StructProjectionOwned<T>`
= note: structs must have a statically known size to be initialized
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -45,11 +41,12 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
9 | struct TupleStruct<T: ?Sized>(T);
| - this type parameter needs to be `std::marker::Sized`
|
- = help: within `TupleStruct<T>`, the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `TupleStruct<T>`
- = note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
+help: function arguments must have a statically known size, borrowed types always have a known size
+ |
+8 | #[pin_project(&project_replace)] //~ ERROR E0277
+ | ^
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/project_replace_unsized.rs:8:1
@@ -59,8 +56,6 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
9 | struct TupleStruct<T: ?Sized>(T);
| - this type parameter needs to be `std::marker::Sized`
|
- = help: the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the size for values of type `T` cannot be known at compilation time
@@ -71,7 +66,5 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
| |
| doesn't have a size known at compile-time
|
- = help: the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all function arguments must have a statically known size
= help: unsized locals are gated as an unstable feature
diff --git a/tests/ui/pin_project/project_replace_unsized_locals.stderr b/tests/ui/pin_project/project_replace_unsized_locals.stderr
index 1616904..1266c4d 100644
--- a/tests/ui/pin_project/project_replace_unsized_locals.stderr
+++ b/tests/ui/pin_project/project_replace_unsized_locals.stderr
@@ -7,8 +7,6 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
| | this type parameter needs to be `std::marker::Sized`
| doesn't have a size known at compile-time
|
- = help: within `__StructProjectionOwned<T>`, the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `__StructProjectionOwned<T>`
= note: the return type of a function must have a statically known size
@@ -19,9 +17,6 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
| - this type parameter needs to be `std::marker::Sized`
7 | x: T,
| ^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/project_replace_unsized_locals.rs:5:1
@@ -31,8 +26,6 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
6 | struct Struct<T: ?Sized> {
| - this type parameter needs to be `std::marker::Sized`
|
- = help: within `__StructProjectionOwned<T>`, the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `__StructProjectionOwned<T>`
= note: structs must have a statically known size to be initialized
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -46,8 +39,6 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
| | this type parameter needs to be `std::marker::Sized`
| doesn't have a size known at compile-time
|
- = help: within `__TupleStructProjectionOwned<T>`, the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `__TupleStructProjectionOwned<T>`
= note: the return type of a function must have a statically known size
@@ -59,6 +50,4 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
11 | struct TupleStruct<T: ?Sized>(T);
| - this type parameter needs to be `std::marker::Sized`
|
- = help: the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/pinned_drop/self.stderr b/tests/ui/pinned_drop/self.stderr
index 2a71b0a..4ac0e63 100644
--- a/tests/ui/pinned_drop/self.stderr
+++ b/tests/ui/pinned_drop/self.stderr
@@ -31,7 +31,7 @@ error[E0423]: expected value, found struct `S`
| |_____- `S` defined here
...
38 | let _: Self = Self; //~ ERROR E0423
- | ^^^^ did you mean `S { /* fields */ }`?
+ | ^^^^ help: use struct literal syntax instead: `S { x: val }`
error[E0308]: mismatched types
--> $DIR/self.rs:37:25