Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
12
third-party/vendor/pin-project-lite/tests/auxiliary/mod.rs
vendored
Normal file
12
third-party/vendor/pin-project-lite/tests/auxiliary/mod.rs
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#![allow(dead_code, unused_macros)]
|
||||
|
||||
macro_rules! assert_unpin {
|
||||
($ty:ty) => {
|
||||
static_assertions::assert_impl_all!($ty: Unpin);
|
||||
};
|
||||
}
|
||||
macro_rules! assert_not_unpin {
|
||||
($ty:ty) => {
|
||||
static_assertions::assert_not_impl_all!($ty: Unpin);
|
||||
};
|
||||
}
|
||||
16
third-party/vendor/pin-project-lite/tests/compiletest.rs
vendored
Normal file
16
third-party/vendor/pin-project-lite/tests/compiletest.rs
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#![cfg(not(miri))]
|
||||
#![cfg(not(careful))]
|
||||
#![warn(rust_2018_idioms, single_use_lifetimes)]
|
||||
|
||||
use std::env;
|
||||
|
||||
#[rustversion::attr(not(nightly), ignore)]
|
||||
#[test]
|
||||
fn ui() {
|
||||
if env::var_os("CI").is_none() {
|
||||
env::set_var("TRYBUILD", "overwrite");
|
||||
}
|
||||
|
||||
let t = trybuild::TestCases::new();
|
||||
t.compile_fail("tests/ui/**/*.rs");
|
||||
}
|
||||
169
third-party/vendor/pin-project-lite/tests/drop_order.rs
vendored
Normal file
169
third-party/vendor/pin-project-lite/tests/drop_order.rs
vendored
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
#![warn(rust_2018_idioms, single_use_lifetimes)]
|
||||
|
||||
// Refs: https://doc.rust-lang.org/reference/destructors.html
|
||||
|
||||
use std::{cell::Cell, panic, pin::Pin, thread};
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
struct D<'a>(&'a Cell<usize>, usize);
|
||||
|
||||
impl Drop for D<'_> {
|
||||
fn drop(&mut self) {
|
||||
if !thread::panicking() {
|
||||
let old = self.0.replace(self.1);
|
||||
assert_eq!(old, self.1 - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = StructPinnedProj]
|
||||
#[project_ref = StructPinnedProjRef]
|
||||
#[project_replace = StructPinnedProjReplace]
|
||||
struct StructPinned<'a> {
|
||||
#[pin]
|
||||
f1: D<'a>,
|
||||
#[pin]
|
||||
f2: D<'a>,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = StructUnpinnedProj]
|
||||
#[project_ref = StructUnpinnedProjRef]
|
||||
#[project_replace = StructUnpinnedProjReplace]
|
||||
struct StructUnpinned<'a> {
|
||||
f1: D<'a>,
|
||||
f2: D<'a>,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project_replace = EnumProjReplace]
|
||||
enum Enum<'a> {
|
||||
#[allow(dead_code)] // false positive that fixed in Rust 1.38
|
||||
StructPinned {
|
||||
#[pin]
|
||||
f1: D<'a>,
|
||||
#[pin]
|
||||
f2: D<'a>,
|
||||
},
|
||||
#[allow(dead_code)] // false positive that fixed in Rust 1.38
|
||||
StructUnpinned {
|
||||
f1: D<'a>,
|
||||
f2: D<'a>,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn struct_pinned() {
|
||||
{
|
||||
let c = Cell::new(0);
|
||||
let _x = StructPinned { f1: D(&c, 1), f2: D(&c, 2) };
|
||||
}
|
||||
{
|
||||
let c = Cell::new(0);
|
||||
let mut x = StructPinned { f1: D(&c, 1), f2: D(&c, 2) };
|
||||
let y = Pin::new(&mut x);
|
||||
let _z = y.project_replace(StructPinned { f1: D(&c, 3), f2: D(&c, 4) });
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn struct_unpinned() {
|
||||
{
|
||||
let c = Cell::new(0);
|
||||
let _x = StructUnpinned { f1: D(&c, 1), f2: D(&c, 2) };
|
||||
}
|
||||
{
|
||||
let c = Cell::new(0);
|
||||
let mut x = StructUnpinned { f1: D(&c, 1), f2: D(&c, 2) };
|
||||
let y = Pin::new(&mut x);
|
||||
let _z = y.project_replace(StructUnpinned { f1: D(&c, 3), f2: D(&c, 4) });
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enum_struct() {
|
||||
{
|
||||
let c = Cell::new(0);
|
||||
let _x = Enum::StructPinned { f1: D(&c, 1), f2: D(&c, 2) };
|
||||
}
|
||||
{
|
||||
let c = Cell::new(0);
|
||||
let mut x = Enum::StructPinned { f1: D(&c, 1), f2: D(&c, 2) };
|
||||
let y = Pin::new(&mut x);
|
||||
let _z = y.project_replace(Enum::StructPinned { f1: D(&c, 3), f2: D(&c, 4) });
|
||||
}
|
||||
|
||||
{
|
||||
let c = Cell::new(0);
|
||||
let _x = Enum::StructUnpinned { f1: D(&c, 1), f2: D(&c, 2) };
|
||||
}
|
||||
{
|
||||
let c = Cell::new(0);
|
||||
let mut x = Enum::StructUnpinned { f1: D(&c, 1), f2: D(&c, 2) };
|
||||
let y = Pin::new(&mut x);
|
||||
let _z = y.project_replace(Enum::StructUnpinned { f1: D(&c, 3), f2: D(&c, 4) });
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/rust-lang/rust/issues/47949
|
||||
// https://github.com/taiki-e/pin-project/pull/194#discussion_r419098111
|
||||
#[allow(clippy::many_single_char_names)]
|
||||
#[test]
|
||||
fn project_replace_panic() {
|
||||
pin_project! {
|
||||
#[project_replace = SProjReplace]
|
||||
struct S<T, U> {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
struct D<'a>(&'a mut bool, bool);
|
||||
impl Drop for D<'_> {
|
||||
fn drop(&mut self) {
|
||||
*self.0 = true;
|
||||
if self.1 {
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let (mut a, mut b, mut c, mut d) = (false, false, false, false);
|
||||
let res = panic::catch_unwind(panic::AssertUnwindSafe(|| {
|
||||
let mut x = S { pinned: D(&mut a, true), unpinned: D(&mut b, false) };
|
||||
let _y = Pin::new(&mut x)
|
||||
.project_replace(S { pinned: D(&mut c, false), unpinned: D(&mut d, false) });
|
||||
// Previous `x.pinned` was dropped and panicked when `project_replace` is
|
||||
// called, so this is unreachable.
|
||||
unreachable!();
|
||||
}));
|
||||
assert!(res.is_err());
|
||||
assert!(a);
|
||||
assert!(b);
|
||||
assert!(c);
|
||||
assert!(d);
|
||||
|
||||
let (mut a, mut b, mut c, mut d) = (false, false, false, false);
|
||||
let res = panic::catch_unwind(panic::AssertUnwindSafe(|| {
|
||||
let mut x = S { pinned: D(&mut a, false), unpinned: D(&mut b, true) };
|
||||
{
|
||||
let _y = Pin::new(&mut x)
|
||||
.project_replace(S { pinned: D(&mut c, false), unpinned: D(&mut d, false) });
|
||||
// `_y` (previous `x.unpinned`) live to the end of this scope, so
|
||||
// this is not unreachable.
|
||||
// unreachable!();
|
||||
}
|
||||
unreachable!();
|
||||
}));
|
||||
assert!(res.is_err());
|
||||
assert!(a);
|
||||
assert!(b);
|
||||
assert!(c);
|
||||
assert!(d);
|
||||
}
|
||||
143
third-party/vendor/pin-project-lite/tests/expand/default/enum.expanded.rs
vendored
Normal file
143
third-party/vendor/pin-project-lite/tests/expand/default/enum.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
use pin_project_lite::pin_project;
|
||||
enum Enum<T, U> {
|
||||
Struct { pinned: T, unpinned: U },
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProj<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProjRef<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProjReplace<T, U> {
|
||||
Struct { pinned: ::pin_project_lite::__private::PhantomData<T>, unpinned: U },
|
||||
Unit,
|
||||
}
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Enum<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> EnumProj<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_unchecked_mut() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProj::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProj::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> EnumProjRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_ref() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProjRef::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProjRef::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_replace(
|
||||
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
||||
replacement: Self,
|
||||
) -> EnumProjReplace<T, U> {
|
||||
unsafe {
|
||||
let __self_ptr: *mut Self = self.get_unchecked_mut();
|
||||
let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard::new(
|
||||
__self_ptr,
|
||||
replacement,
|
||||
);
|
||||
match &mut *__self_ptr {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
let result = EnumProjReplace::Struct {
|
||||
pinned: ::pin_project_lite::__private::PhantomData,
|
||||
unpinned: ::pin_project_lite::__private::ptr::read(unpinned),
|
||||
};
|
||||
{
|
||||
(
|
||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||
pinned,
|
||||
),
|
||||
(),
|
||||
);
|
||||
}
|
||||
result
|
||||
}
|
||||
Self::Unit => EnumProjReplace::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||
Unit: (),
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Enum<T, U> {}
|
||||
};
|
||||
fn main() {}
|
||||
17
third-party/vendor/pin-project-lite/tests/expand/default/enum.rs
vendored
Normal file
17
third-party/vendor/pin-project-lite/tests/expand/default/enum.rs
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[project_replace = EnumProjReplace]
|
||||
enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
90
third-party/vendor/pin-project-lite/tests/expand/default/struct.expanded.rs
vendored
Normal file
90
third-party/vendor/pin-project-lite/tests/expand/default/struct.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
use pin_project_lite::pin_project;
|
||||
struct Struct<T, U> {
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
#[allow(explicit_outlives_requirements)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct Projection<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct ProjectionRef<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
}
|
||||
impl<T, U> Struct<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> Projection<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_unchecked_mut();
|
||||
Projection {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> ProjectionRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_ref();
|
||||
ProjectionRef {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
pinned: T,
|
||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Struct<T, U> {}
|
||||
#[forbid(unaligned_references, safe_packed_borrows)]
|
||||
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
|
||||
let _ = &this.pinned;
|
||||
let _ = &this.unpinned;
|
||||
}
|
||||
};
|
||||
fn main() {}
|
||||
11
third-party/vendor/pin-project-lite/tests/expand/default/struct.rs
vendored
Normal file
11
third-party/vendor/pin-project-lite/tests/expand/default/struct.rs
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
struct Struct<T, U> {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
89
third-party/vendor/pin-project-lite/tests/expand/multifields/enum.expanded.rs
vendored
Normal file
89
third-party/vendor/pin-project-lite/tests/expand/multifields/enum.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
use pin_project_lite::pin_project;
|
||||
enum Enum<T, U> {
|
||||
Struct { pinned1: T, pinned2: T, unpinned1: U, unpinned2: U },
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProjReplace<T, U> {
|
||||
Struct {
|
||||
pinned1: ::pin_project_lite::__private::PhantomData<T>,
|
||||
pinned2: ::pin_project_lite::__private::PhantomData<T>,
|
||||
unpinned1: U,
|
||||
unpinned2: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Enum<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_replace(
|
||||
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
||||
replacement: Self,
|
||||
) -> EnumProjReplace<T, U> {
|
||||
unsafe {
|
||||
let __self_ptr: *mut Self = self.get_unchecked_mut();
|
||||
let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard::new(
|
||||
__self_ptr,
|
||||
replacement,
|
||||
);
|
||||
match &mut *__self_ptr {
|
||||
Self::Struct { pinned1, pinned2, unpinned1, unpinned2 } => {
|
||||
let result = EnumProjReplace::Struct {
|
||||
pinned1: ::pin_project_lite::__private::PhantomData,
|
||||
pinned2: ::pin_project_lite::__private::PhantomData,
|
||||
unpinned1: ::pin_project_lite::__private::ptr::read(
|
||||
unpinned1,
|
||||
),
|
||||
unpinned2: ::pin_project_lite::__private::ptr::read(
|
||||
unpinned2,
|
||||
),
|
||||
};
|
||||
{
|
||||
(
|
||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||
pinned1,
|
||||
),
|
||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||
pinned2,
|
||||
),
|
||||
(),
|
||||
(),
|
||||
);
|
||||
}
|
||||
result
|
||||
}
|
||||
Self::Unit => EnumProjReplace::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
Struct: (
|
||||
T,
|
||||
T,
|
||||
::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
),
|
||||
Unit: (),
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Enum<T, U> {}
|
||||
};
|
||||
fn main() {}
|
||||
18
third-party/vendor/pin-project-lite/tests/expand/multifields/enum.rs
vendored
Normal file
18
third-party/vendor/pin-project-lite/tests/expand/multifields/enum.rs
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project_replace = EnumProjReplace]
|
||||
enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned1: T,
|
||||
#[pin]
|
||||
pinned2: T,
|
||||
unpinned1: U,
|
||||
unpinned2: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
151
third-party/vendor/pin-project-lite/tests/expand/multifields/struct.expanded.rs
vendored
Normal file
151
third-party/vendor/pin-project-lite/tests/expand/multifields/struct.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
use pin_project_lite::pin_project;
|
||||
struct Struct<T, U> {
|
||||
pinned1: T,
|
||||
pinned2: T,
|
||||
unpinned1: U,
|
||||
unpinned2: U,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct StructProjReplace<T, U> {
|
||||
pinned1: ::pin_project_lite::__private::PhantomData<T>,
|
||||
pinned2: ::pin_project_lite::__private::PhantomData<T>,
|
||||
unpinned1: U,
|
||||
unpinned2: U,
|
||||
}
|
||||
#[allow(explicit_outlives_requirements)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct Projection<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned1: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
pinned2: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned1: &'__pin mut (U),
|
||||
unpinned2: &'__pin mut (U),
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct ProjectionRef<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned1: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
pinned2: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned1: &'__pin (U),
|
||||
unpinned2: &'__pin (U),
|
||||
}
|
||||
impl<T, U> Struct<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> Projection<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned1, pinned2, unpinned1, unpinned2 } = self
|
||||
.get_unchecked_mut();
|
||||
Projection {
|
||||
pinned1: ::pin_project_lite::__private::Pin::new_unchecked(pinned1),
|
||||
pinned2: ::pin_project_lite::__private::Pin::new_unchecked(pinned2),
|
||||
unpinned1: unpinned1,
|
||||
unpinned2: unpinned2,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> ProjectionRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned1, pinned2, unpinned1, unpinned2 } = self.get_ref();
|
||||
ProjectionRef {
|
||||
pinned1: ::pin_project_lite::__private::Pin::new_unchecked(pinned1),
|
||||
pinned2: ::pin_project_lite::__private::Pin::new_unchecked(pinned2),
|
||||
unpinned1: unpinned1,
|
||||
unpinned2: unpinned2,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_replace(
|
||||
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
||||
replacement: Self,
|
||||
) -> StructProjReplace<T, U> {
|
||||
unsafe {
|
||||
let __self_ptr: *mut Self = self.get_unchecked_mut();
|
||||
let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard::new(
|
||||
__self_ptr,
|
||||
replacement,
|
||||
);
|
||||
let Self { pinned1, pinned2, unpinned1, unpinned2 } = &mut *__self_ptr;
|
||||
let result = StructProjReplace {
|
||||
pinned1: ::pin_project_lite::__private::PhantomData,
|
||||
pinned2: ::pin_project_lite::__private::PhantomData,
|
||||
unpinned1: ::pin_project_lite::__private::ptr::read(unpinned1),
|
||||
unpinned2: ::pin_project_lite::__private::ptr::read(unpinned2),
|
||||
};
|
||||
{
|
||||
(
|
||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||
pinned1,
|
||||
),
|
||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||
pinned2,
|
||||
),
|
||||
(),
|
||||
(),
|
||||
);
|
||||
}
|
||||
result
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
pinned1: T,
|
||||
pinned2: T,
|
||||
unpinned1: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
unpinned2: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Struct<T, U> {}
|
||||
#[forbid(unaligned_references, safe_packed_borrows)]
|
||||
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
|
||||
let _ = &this.pinned1;
|
||||
let _ = &this.pinned2;
|
||||
let _ = &this.unpinned1;
|
||||
let _ = &this.unpinned2;
|
||||
}
|
||||
};
|
||||
fn main() {}
|
||||
15
third-party/vendor/pin-project-lite/tests/expand/multifields/struct.rs
vendored
Normal file
15
third-party/vendor/pin-project-lite/tests/expand/multifields/struct.rs
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project_replace = StructProjReplace]
|
||||
struct Struct<T, U> {
|
||||
#[pin]
|
||||
pinned1: T,
|
||||
#[pin]
|
||||
pinned2: T,
|
||||
unpinned1: U,
|
||||
unpinned2: U,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
143
third-party/vendor/pin-project-lite/tests/expand/naming/enum-all.expanded.rs
vendored
Normal file
143
third-party/vendor/pin-project-lite/tests/expand/naming/enum-all.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
use pin_project_lite::pin_project;
|
||||
enum Enum<T, U> {
|
||||
Struct { pinned: T, unpinned: U },
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProj<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProjRef<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProjReplace<T, U> {
|
||||
Struct { pinned: ::pin_project_lite::__private::PhantomData<T>, unpinned: U },
|
||||
Unit,
|
||||
}
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Enum<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> EnumProj<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_unchecked_mut() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProj::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProj::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> EnumProjRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_ref() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProjRef::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProjRef::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_replace(
|
||||
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
||||
replacement: Self,
|
||||
) -> EnumProjReplace<T, U> {
|
||||
unsafe {
|
||||
let __self_ptr: *mut Self = self.get_unchecked_mut();
|
||||
let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard::new(
|
||||
__self_ptr,
|
||||
replacement,
|
||||
);
|
||||
match &mut *__self_ptr {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
let result = EnumProjReplace::Struct {
|
||||
pinned: ::pin_project_lite::__private::PhantomData,
|
||||
unpinned: ::pin_project_lite::__private::ptr::read(unpinned),
|
||||
};
|
||||
{
|
||||
(
|
||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||
pinned,
|
||||
),
|
||||
(),
|
||||
);
|
||||
}
|
||||
result
|
||||
}
|
||||
Self::Unit => EnumProjReplace::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||
Unit: (),
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Enum<T, U> {}
|
||||
};
|
||||
fn main() {}
|
||||
17
third-party/vendor/pin-project-lite/tests/expand/naming/enum-all.rs
vendored
Normal file
17
third-party/vendor/pin-project-lite/tests/expand/naming/enum-all.rs
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[project_replace = EnumProjReplace]
|
||||
enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
64
third-party/vendor/pin-project-lite/tests/expand/naming/enum-mut.expanded.rs
vendored
Normal file
64
third-party/vendor/pin-project-lite/tests/expand/naming/enum-mut.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
use pin_project_lite::pin_project;
|
||||
enum Enum<T, U> {
|
||||
Struct { pinned: T, unpinned: U },
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProj<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Enum<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> EnumProj<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_unchecked_mut() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProj::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProj::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||
Unit: (),
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Enum<T, U> {}
|
||||
};
|
||||
fn main() {}
|
||||
15
third-party/vendor/pin-project-lite/tests/expand/naming/enum-mut.rs
vendored
Normal file
15
third-party/vendor/pin-project-lite/tests/expand/naming/enum-mut.rs
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
26
third-party/vendor/pin-project-lite/tests/expand/naming/enum-none.expanded.rs
vendored
Normal file
26
third-party/vendor/pin-project-lite/tests/expand/naming/enum-none.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
use pin_project_lite::pin_project;
|
||||
enum Enum<T, U> {
|
||||
Struct { pinned: T, unpinned: U },
|
||||
Unit,
|
||||
}
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Enum<T, U> {}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||
Unit: (),
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Enum<T, U> {}
|
||||
};
|
||||
fn main() {}
|
||||
14
third-party/vendor/pin-project-lite/tests/expand/naming/enum-none.rs
vendored
Normal file
14
third-party/vendor/pin-project-lite/tests/expand/naming/enum-none.rs
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
64
third-party/vendor/pin-project-lite/tests/expand/naming/enum-ref.expanded.rs
vendored
Normal file
64
third-party/vendor/pin-project-lite/tests/expand/naming/enum-ref.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
use pin_project_lite::pin_project;
|
||||
enum Enum<T, U> {
|
||||
Struct { pinned: T, unpinned: U },
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProjRef<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Enum<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> EnumProjRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_ref() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProjRef::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProjRef::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||
Unit: (),
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Enum<T, U> {}
|
||||
};
|
||||
fn main() {}
|
||||
15
third-party/vendor/pin-project-lite/tests/expand/naming/enum-ref.rs
vendored
Normal file
15
third-party/vendor/pin-project-lite/tests/expand/naming/enum-ref.rs
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project_ref = EnumProjRef]
|
||||
enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
128
third-party/vendor/pin-project-lite/tests/expand/naming/struct-all.expanded.rs
vendored
Normal file
128
third-party/vendor/pin-project-lite/tests/expand/naming/struct-all.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
use pin_project_lite::pin_project;
|
||||
struct Struct<T, U> {
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct StructProj<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct StructProjRef<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct StructProjReplace<T, U> {
|
||||
pinned: ::pin_project_lite::__private::PhantomData<T>,
|
||||
unpinned: U,
|
||||
}
|
||||
#[allow(explicit_outlives_requirements)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Struct<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> StructProj<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_unchecked_mut();
|
||||
StructProj {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> StructProjRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_ref();
|
||||
StructProjRef {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_replace(
|
||||
self: ::pin_project_lite::__private::Pin<&mut Self>,
|
||||
replacement: Self,
|
||||
) -> StructProjReplace<T, U> {
|
||||
unsafe {
|
||||
let __self_ptr: *mut Self = self.get_unchecked_mut();
|
||||
let __guard = ::pin_project_lite::__private::UnsafeOverwriteGuard::new(
|
||||
__self_ptr,
|
||||
replacement,
|
||||
);
|
||||
let Self { pinned, unpinned } = &mut *__self_ptr;
|
||||
let result = StructProjReplace {
|
||||
pinned: ::pin_project_lite::__private::PhantomData,
|
||||
unpinned: ::pin_project_lite::__private::ptr::read(unpinned),
|
||||
};
|
||||
{
|
||||
(
|
||||
::pin_project_lite::__private::UnsafeDropInPlaceGuard::new(
|
||||
pinned,
|
||||
),
|
||||
(),
|
||||
);
|
||||
}
|
||||
result
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
pinned: T,
|
||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Struct<T, U> {}
|
||||
#[forbid(unaligned_references, safe_packed_borrows)]
|
||||
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
|
||||
let _ = &this.pinned;
|
||||
let _ = &this.unpinned;
|
||||
}
|
||||
};
|
||||
fn main() {}
|
||||
14
third-party/vendor/pin-project-lite/tests/expand/naming/struct-all.rs
vendored
Normal file
14
third-party/vendor/pin-project-lite/tests/expand/naming/struct-all.rs
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project = StructProj]
|
||||
#[project_ref = StructProjRef]
|
||||
#[project_replace = StructProjReplace]
|
||||
struct Struct<T, U> {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
90
third-party/vendor/pin-project-lite/tests/expand/naming/struct-mut.expanded.rs
vendored
Normal file
90
third-party/vendor/pin-project-lite/tests/expand/naming/struct-mut.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
use pin_project_lite::pin_project;
|
||||
struct Struct<T, U> {
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct StructProj<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
}
|
||||
#[allow(explicit_outlives_requirements)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct ProjectionRef<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
}
|
||||
impl<T, U> Struct<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> StructProj<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_unchecked_mut();
|
||||
StructProj {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> ProjectionRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_ref();
|
||||
ProjectionRef {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
pinned: T,
|
||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Struct<T, U> {}
|
||||
#[forbid(unaligned_references, safe_packed_borrows)]
|
||||
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
|
||||
let _ = &this.pinned;
|
||||
let _ = &this.unpinned;
|
||||
}
|
||||
};
|
||||
fn main() {}
|
||||
12
third-party/vendor/pin-project-lite/tests/expand/naming/struct-mut.rs
vendored
Normal file
12
third-party/vendor/pin-project-lite/tests/expand/naming/struct-mut.rs
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project = StructProj]
|
||||
struct Struct<T, U> {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
90
third-party/vendor/pin-project-lite/tests/expand/naming/struct-none.expanded.rs
vendored
Normal file
90
third-party/vendor/pin-project-lite/tests/expand/naming/struct-none.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
use pin_project_lite::pin_project;
|
||||
struct Struct<T, U> {
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
#[allow(explicit_outlives_requirements)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct Projection<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct ProjectionRef<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
}
|
||||
impl<T, U> Struct<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> Projection<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_unchecked_mut();
|
||||
Projection {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> ProjectionRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_ref();
|
||||
ProjectionRef {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
pinned: T,
|
||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Struct<T, U> {}
|
||||
#[forbid(unaligned_references, safe_packed_borrows)]
|
||||
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
|
||||
let _ = &this.pinned;
|
||||
let _ = &this.unpinned;
|
||||
}
|
||||
};
|
||||
fn main() {}
|
||||
11
third-party/vendor/pin-project-lite/tests/expand/naming/struct-none.rs
vendored
Normal file
11
third-party/vendor/pin-project-lite/tests/expand/naming/struct-none.rs
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
struct Struct<T, U> {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
90
third-party/vendor/pin-project-lite/tests/expand/naming/struct-ref.expanded.rs
vendored
Normal file
90
third-party/vendor/pin-project-lite/tests/expand/naming/struct-ref.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
use pin_project_lite::pin_project;
|
||||
struct Struct<T, U> {
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct StructProjRef<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
}
|
||||
#[allow(explicit_outlives_requirements)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct Projection<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
}
|
||||
impl<T, U> Struct<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> Projection<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_unchecked_mut();
|
||||
Projection {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> StructProjRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_ref();
|
||||
StructProjRef {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
pinned: T,
|
||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Struct<T, U> {}
|
||||
#[forbid(unaligned_references, safe_packed_borrows)]
|
||||
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
|
||||
let _ = &this.pinned;
|
||||
let _ = &this.unpinned;
|
||||
}
|
||||
};
|
||||
fn main() {}
|
||||
12
third-party/vendor/pin-project-lite/tests/expand/naming/struct-ref.rs
vendored
Normal file
12
third-party/vendor/pin-project-lite/tests/expand/naming/struct-ref.rs
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project_ref = StructProjRef]
|
||||
struct Struct<T, U> {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
99
third-party/vendor/pin-project-lite/tests/expand/not_unpin/enum.expanded.rs
vendored
Normal file
99
third-party/vendor/pin-project-lite/tests/expand/not_unpin/enum.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
use pin_project_lite::pin_project;
|
||||
enum Enum<T, U> {
|
||||
Struct { pinned: T, unpinned: U },
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProj<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProjRef<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Enum<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> EnumProj<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_unchecked_mut() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProj::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProj::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> EnumProjRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_ref() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProjRef::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProjRef::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||
where
|
||||
(
|
||||
::core::marker::PhantomData<&'__pin ()>,
|
||||
::core::marker::PhantomPinned,
|
||||
): ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Enum<T, U> {}
|
||||
};
|
||||
fn main() {}
|
||||
17
third-party/vendor/pin-project-lite/tests/expand/not_unpin/enum.rs
vendored
Normal file
17
third-party/vendor/pin-project-lite/tests/expand/not_unpin/enum.rs
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project(!Unpin)]
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
88
third-party/vendor/pin-project-lite/tests/expand/not_unpin/struct.expanded.rs
vendored
Normal file
88
third-party/vendor/pin-project-lite/tests/expand/not_unpin/struct.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
use pin_project_lite::pin_project;
|
||||
struct Struct<T, U> {
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct StructProj<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct StructProjRef<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
}
|
||||
#[allow(explicit_outlives_requirements)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Struct<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> StructProj<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_unchecked_mut();
|
||||
StructProj {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> StructProjRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_ref();
|
||||
StructProjRef {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||
where
|
||||
(
|
||||
::core::marker::PhantomData<&'__pin ()>,
|
||||
::core::marker::PhantomPinned,
|
||||
): ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Struct<T, U> {}
|
||||
#[forbid(unaligned_references, safe_packed_borrows)]
|
||||
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
|
||||
let _ = &this.pinned;
|
||||
let _ = &this.unpinned;
|
||||
}
|
||||
};
|
||||
fn main() {}
|
||||
14
third-party/vendor/pin-project-lite/tests/expand/not_unpin/struct.rs
vendored
Normal file
14
third-party/vendor/pin-project-lite/tests/expand/not_unpin/struct.rs
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project = StructProj]
|
||||
#[project(!Unpin)]
|
||||
#[project_ref = StructProjRef]
|
||||
struct Struct<T, U> {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
112
third-party/vendor/pin-project-lite/tests/expand/pinned_drop/enum.expanded.rs
vendored
Normal file
112
third-party/vendor/pin-project-lite/tests/expand/pinned_drop/enum.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
use std::pin::Pin;
|
||||
use pin_project_lite::pin_project;
|
||||
enum Enum<T, U> {
|
||||
Struct { pinned: T, unpinned: U },
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProj<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
enum EnumProjRef<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Enum<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> EnumProj<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_unchecked_mut() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProj::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProj::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> EnumProjRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_ref() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProjRef::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProjRef::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||
Unit: (),
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
impl<T, U> ::pin_project_lite::__private::Drop for Enum<T, U> {
|
||||
fn drop(&mut self) {
|
||||
fn __drop_inner<T, U>(
|
||||
this: ::pin_project_lite::__private::Pin<&mut Enum<T, U>>,
|
||||
) {
|
||||
fn __drop_inner() {}
|
||||
let _ = this;
|
||||
}
|
||||
let pinned_self: ::pin_project_lite::__private::Pin<&mut Self> = unsafe {
|
||||
::pin_project_lite::__private::Pin::new_unchecked(self)
|
||||
};
|
||||
__drop_inner(pinned_self);
|
||||
}
|
||||
}
|
||||
};
|
||||
fn main() {}
|
||||
23
third-party/vendor/pin-project-lite/tests/expand/pinned_drop/enum.rs
vendored
Normal file
23
third-party/vendor/pin-project-lite/tests/expand/pinned_drop/enum.rs
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
use std::pin::Pin;
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
impl<T, U> PinnedDrop for Enum<T, U> {
|
||||
fn drop(this: Pin<&mut Self>) {
|
||||
let _ = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
101
third-party/vendor/pin-project-lite/tests/expand/pinned_drop/struct.expanded.rs
vendored
Normal file
101
third-party/vendor/pin-project-lite/tests/expand/pinned_drop/struct.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
use std::pin::Pin;
|
||||
use pin_project_lite::pin_project;
|
||||
struct Struct<T, U> {
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
#[allow(explicit_outlives_requirements)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct Projection<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
struct ProjectionRef<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
}
|
||||
impl<T, U> Struct<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> Projection<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_unchecked_mut();
|
||||
Projection {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> ProjectionRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_ref();
|
||||
ProjectionRef {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
pinned: T,
|
||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
impl<T, U> ::pin_project_lite::__private::Drop for Struct<T, U> {
|
||||
fn drop(&mut self) {
|
||||
fn __drop_inner<T, U>(
|
||||
this: ::pin_project_lite::__private::Pin<&mut Struct<T, U>>,
|
||||
) {
|
||||
fn __drop_inner() {}
|
||||
let _ = this;
|
||||
}
|
||||
let pinned_self: ::pin_project_lite::__private::Pin<&mut Self> = unsafe {
|
||||
::pin_project_lite::__private::Pin::new_unchecked(self)
|
||||
};
|
||||
__drop_inner(pinned_self);
|
||||
}
|
||||
}
|
||||
#[forbid(unaligned_references, safe_packed_borrows)]
|
||||
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
|
||||
let _ = &this.pinned;
|
||||
let _ = &this.unpinned;
|
||||
}
|
||||
};
|
||||
fn main() {}
|
||||
18
third-party/vendor/pin-project-lite/tests/expand/pinned_drop/struct.rs
vendored
Normal file
18
third-party/vendor/pin-project-lite/tests/expand/pinned_drop/struct.rs
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
use std::pin::Pin;
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
struct Struct<T, U> {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
impl<T, U> PinnedDrop for Struct<T, U> {
|
||||
fn drop(this: Pin<&mut Self>) {
|
||||
let _ = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
101
third-party/vendor/pin-project-lite/tests/expand/pub/enum.expanded.rs
vendored
Normal file
101
third-party/vendor/pin-project-lite/tests/expand/pub/enum.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
use pin_project_lite::pin_project;
|
||||
pub enum Enum<T, U> {
|
||||
Struct { pinned: T, unpinned: U },
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
pub(crate) enum EnumProj<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
unpinned: &'__pin mut (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
pub(crate) enum EnumProjRef<'__pin, T, U>
|
||||
where
|
||||
Enum<T, U>: '__pin,
|
||||
{
|
||||
Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
unpinned: &'__pin (U),
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
impl<T, U> Enum<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
pub(crate) fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> EnumProj<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_unchecked_mut() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProj::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProj::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
pub(crate) fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> EnumProjRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
match self.get_ref() {
|
||||
Self::Struct { pinned, unpinned } => {
|
||||
EnumProjRef::Struct {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(
|
||||
pinned,
|
||||
),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
Self::Unit => EnumProjRef::Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
pub struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
Struct: (T, ::pin_project_lite::__private::AlwaysUnpin<U>),
|
||||
Unit: (),
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Enum<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Enum<T, U> {}
|
||||
};
|
||||
fn main() {}
|
||||
16
third-party/vendor/pin-project-lite/tests/expand/pub/enum.rs
vendored
Normal file
16
third-party/vendor/pin-project-lite/tests/expand/pub/enum.rs
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
pub enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
90
third-party/vendor/pin-project-lite/tests/expand/pub/struct.expanded.rs
vendored
Normal file
90
third-party/vendor/pin-project-lite/tests/expand/pub/struct.expanded.rs
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
use pin_project_lite::pin_project;
|
||||
pub struct Struct<T, U> {
|
||||
pub pinned: T,
|
||||
pub unpinned: U,
|
||||
}
|
||||
#[allow(explicit_outlives_requirements)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
const _: () = {
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
pub(crate) struct Projection<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pub pinned: ::pin_project_lite::__private::Pin<&'__pin mut (T)>,
|
||||
pub unpinned: &'__pin mut (U),
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[allow(dead_code)]
|
||||
#[allow(single_use_lifetimes)]
|
||||
#[allow(clippy::unknown_clippy_lints)]
|
||||
#[allow(clippy::mut_mut)]
|
||||
#[allow(clippy::redundant_pub_crate)]
|
||||
#[allow(clippy::ref_option_ref)]
|
||||
#[allow(clippy::type_repetition_in_bounds)]
|
||||
pub(crate) struct ProjectionRef<'__pin, T, U>
|
||||
where
|
||||
Struct<T, U>: '__pin,
|
||||
{
|
||||
pub pinned: ::pin_project_lite::__private::Pin<&'__pin (T)>,
|
||||
pub unpinned: &'__pin (U),
|
||||
}
|
||||
impl<T, U> Struct<T, U> {
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
pub(crate) fn project<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin mut Self>,
|
||||
) -> Projection<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_unchecked_mut();
|
||||
Projection {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
pub(crate) fn project_ref<'__pin>(
|
||||
self: ::pin_project_lite::__private::Pin<&'__pin Self>,
|
||||
) -> ProjectionRef<'__pin, T, U> {
|
||||
unsafe {
|
||||
let Self { pinned, unpinned } = self.get_ref();
|
||||
ProjectionRef {
|
||||
pinned: ::pin_project_lite::__private::Pin::new_unchecked(pinned),
|
||||
unpinned: unpinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[allow(non_snake_case)]
|
||||
pub struct __Origin<'__pin, T, U> {
|
||||
__dummy_lifetime: ::pin_project_lite::__private::PhantomData<&'__pin ()>,
|
||||
pinned: T,
|
||||
unpinned: ::pin_project_lite::__private::AlwaysUnpin<U>,
|
||||
}
|
||||
impl<'__pin, T, U> ::pin_project_lite::__private::Unpin for Struct<T, U>
|
||||
where
|
||||
__Origin<'__pin, T, U>: ::pin_project_lite::__private::Unpin,
|
||||
{}
|
||||
trait MustNotImplDrop {}
|
||||
#[allow(clippy::drop_bounds, drop_bounds)]
|
||||
impl<T: ::pin_project_lite::__private::Drop> MustNotImplDrop for T {}
|
||||
impl<T, U> MustNotImplDrop for Struct<T, U> {}
|
||||
#[forbid(unaligned_references, safe_packed_borrows)]
|
||||
fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) {
|
||||
let _ = &this.pinned;
|
||||
let _ = &this.unpinned;
|
||||
}
|
||||
};
|
||||
fn main() {}
|
||||
11
third-party/vendor/pin-project-lite/tests/expand/pub/struct.rs
vendored
Normal file
11
third-party/vendor/pin-project-lite/tests/expand/pub/struct.rs
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct<T, U> {
|
||||
#[pin]
|
||||
pub pinned: T,
|
||||
pub unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
44
third-party/vendor/pin-project-lite/tests/expandtest.rs
vendored
Normal file
44
third-party/vendor/pin-project-lite/tests/expandtest.rs
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#![cfg(not(miri))]
|
||||
#![cfg(not(careful))]
|
||||
#![warn(rust_2018_idioms, single_use_lifetimes)]
|
||||
|
||||
use std::{
|
||||
env,
|
||||
process::{Command, ExitStatus, Stdio},
|
||||
};
|
||||
|
||||
const PATH: &str = "tests/expand/**/*.rs";
|
||||
|
||||
#[rustversion::attr(not(nightly), ignore)]
|
||||
#[test]
|
||||
fn expandtest() {
|
||||
let is_ci = env::var_os("CI").is_some();
|
||||
let cargo = &*env::var("CARGO").unwrap_or_else(|_| "cargo".into());
|
||||
if !has_command(&[cargo, "expand"]) {
|
||||
if is_ci {
|
||||
panic!("expandtest requires cargo-expand");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let args = &["--all-features"];
|
||||
if is_ci {
|
||||
macrotest::expand_without_refresh_args(PATH, args);
|
||||
} else {
|
||||
env::set_var("MACROTEST", "overwrite");
|
||||
macrotest::expand_args(PATH, args);
|
||||
}
|
||||
}
|
||||
|
||||
fn has_command(command: &[&str]) -> bool {
|
||||
Command::new(command[0])
|
||||
.args(&command[1..])
|
||||
.arg("--version")
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.status()
|
||||
.as_ref()
|
||||
.map(ExitStatus::success)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
35
third-party/vendor/pin-project-lite/tests/include/basic.rs
vendored
Normal file
35
third-party/vendor/pin-project-lite/tests/include/basic.rs
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// default pin_project! is completely safe.
|
||||
|
||||
::pin_project_lite::pin_project! {
|
||||
#[derive(Debug)]
|
||||
pub struct DefaultStruct<T, U> {
|
||||
#[pin]
|
||||
pub pinned: T,
|
||||
pub unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
::pin_project_lite::pin_project! {
|
||||
#[project = DefaultStructProj]
|
||||
#[project_ref = DefaultStructProjRef]
|
||||
#[derive(Debug)]
|
||||
pub struct DefaultStructNamed<T, U> {
|
||||
#[pin]
|
||||
pub pinned: T,
|
||||
pub unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
::pin_project_lite::pin_project! {
|
||||
#[project = DefaultEnumProj]
|
||||
#[project_ref = DefaultEnumProjRef]
|
||||
#[derive(Debug)]
|
||||
pub enum DefaultEnum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
281
third-party/vendor/pin-project-lite/tests/lint.rs
vendored
Normal file
281
third-party/vendor/pin-project-lite/tests/lint.rs
vendored
Normal file
|
|
@ -0,0 +1,281 @@
|
|||
// Check interoperability with rustc and clippy lints.
|
||||
|
||||
#![forbid(unsafe_code)]
|
||||
// for old compilers
|
||||
#![allow(unknown_lints)]
|
||||
#![warn(nonstandard_style, rust_2018_idioms, unused)]
|
||||
// Note: This does not guarantee compatibility with forbidding these lints in the future.
|
||||
// If rustc adds a new lint, we may not be able to keep this.
|
||||
#![forbid(future_incompatible, rust_2018_compatibility, rust_2021_compatibility)]
|
||||
// lints forbidden as a part of future_incompatible, rust_2018_compatibility, and rust_2021_compatibility are not included in the list below.
|
||||
// elided_lifetimes_in_paths, explicit_outlives_requirements, unused_extern_crates: as a part of rust_2018_idioms
|
||||
// unsafe_op_in_unsafe_fn: requires Rust 1.52. and, we don't generate unsafe fn.
|
||||
// non_exhaustive_omitted_patterns, multiple_supertrait_upcastable: unstable
|
||||
// unstable_features: no way to generate #![feature(..)] by macros, expect for unstable inner attribute. and this lint is deprecated: https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unstable-features
|
||||
// unused_crate_dependencies, must_not_suspend: unrelated
|
||||
// unsafe_code: checked in forbid_unsafe module
|
||||
#![warn(
|
||||
box_pointers,
|
||||
deprecated_in_future,
|
||||
fuzzy_provenance_casts,
|
||||
invalid_reference_casting,
|
||||
let_underscore_drop,
|
||||
lossy_provenance_casts,
|
||||
macro_use_extern_crate,
|
||||
meta_variable_misuse,
|
||||
missing_abi,
|
||||
missing_copy_implementations,
|
||||
missing_debug_implementations,
|
||||
missing_docs,
|
||||
non_ascii_idents,
|
||||
noop_method_call,
|
||||
private_bounds,
|
||||
private_interfaces,
|
||||
single_use_lifetimes,
|
||||
trivial_casts,
|
||||
trivial_numeric_casts,
|
||||
unnameable_types,
|
||||
unreachable_pub,
|
||||
unused_import_braces,
|
||||
unused_lifetimes,
|
||||
unused_qualifications,
|
||||
unused_results,
|
||||
unused_tuple_struct_fields,
|
||||
variant_size_differences
|
||||
)]
|
||||
#![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::restriction)]
|
||||
#![allow(clippy::blanket_clippy_restriction_lints)] // this is a test, so enable all restriction lints intentionally.
|
||||
#![allow(
|
||||
clippy::exhaustive_enums,
|
||||
clippy::exhaustive_structs,
|
||||
clippy::min_ident_chars,
|
||||
clippy::single_char_lifetime_names
|
||||
)] // TODO
|
||||
|
||||
pub mod basic {
|
||||
include!("include/basic.rs");
|
||||
}
|
||||
|
||||
pub mod box_pointers {
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[derive(Debug)]
|
||||
pub struct Struct {
|
||||
#[pin]
|
||||
pub p: Box<isize>,
|
||||
pub u: Box<isize>,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[project(!Unpin)]
|
||||
#[derive(Debug)]
|
||||
pub enum Enum {
|
||||
Struct {
|
||||
#[pin]
|
||||
p: Box<isize>,
|
||||
u: Box<isize>,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod explicit_outlives_requirements {
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[derive(Debug)]
|
||||
pub struct Struct<'a, T, U>
|
||||
where
|
||||
T: ?Sized,
|
||||
U: ?Sized,
|
||||
{
|
||||
#[pin]
|
||||
pub pinned: &'a mut T,
|
||||
pub unpinned: &'a mut U,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[project(!Unpin)]
|
||||
#[derive(Debug)]
|
||||
pub enum Enum<'a, T, U>
|
||||
where
|
||||
T: ?Sized,
|
||||
U: ?Sized,
|
||||
{
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: &'a mut T,
|
||||
unpinned: &'a mut U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod variant_size_differences {
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[project(!Unpin)]
|
||||
#[allow(missing_debug_implementations, missing_copy_implementations)] // https://github.com/rust-lang/rust/pull/74060
|
||||
#[allow(variant_size_differences)] // for the type itself
|
||||
#[allow(clippy::large_enum_variant)] // for the type itself
|
||||
pub enum Enum {
|
||||
V1 { f: u8 },
|
||||
V2 { f: [u8; 1024] },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod clippy_mut_mut {
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[derive(Debug)]
|
||||
pub struct Struct<'a, T, U> {
|
||||
#[pin]
|
||||
pub pinned: &'a mut T,
|
||||
pub unpinned: &'a mut U,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[project(!Unpin)]
|
||||
#[derive(Debug)]
|
||||
pub enum Enum<'a, T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: &'a mut T,
|
||||
unpinned: &'a mut U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unreachable_pub)]
|
||||
mod clippy_redundant_pub_crate {
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[derive(Debug)]
|
||||
pub struct Struct<T, U> {
|
||||
#[pin]
|
||||
pub pinned: T,
|
||||
pub unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[project(!Unpin)]
|
||||
#[derive(Debug)]
|
||||
pub enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::use_self)]
|
||||
pub mod clippy_type_repetition_in_bounds {
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
#[derive(Debug)]
|
||||
pub struct Struct<T, U>
|
||||
where
|
||||
Struct<T, U>: Sized,
|
||||
{
|
||||
#[pin]
|
||||
pub pinned: T,
|
||||
pub unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[project(!Unpin)]
|
||||
#[derive(Debug)]
|
||||
pub enum Enum<T, U>
|
||||
where
|
||||
Enum<T, U>: Sized,
|
||||
{
|
||||
Struct {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(missing_debug_implementations)]
|
||||
pub mod clippy_used_underscore_binding {
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct<T, U> {
|
||||
#[pin]
|
||||
pub _pinned: T,
|
||||
pub _unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[project(!Unpin)]
|
||||
pub enum Enum<T, U> {
|
||||
Struct {
|
||||
#[pin]
|
||||
_pinned: T,
|
||||
_unpinned: U,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod clippy_ref_option_ref {
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct<'a> {
|
||||
#[pin]
|
||||
pub _pinned: Option<&'a ()>,
|
||||
pub _unpinned: Option<&'a ()>,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[project(!Unpin)]
|
||||
pub enum Enum<'a> {
|
||||
Struct {
|
||||
#[pin]
|
||||
_pinned: Option<&'a ()>,
|
||||
_unpinned: Option<&'a ()>,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
100
third-party/vendor/pin-project-lite/tests/proper_unpin.rs
vendored
Normal file
100
third-party/vendor/pin-project-lite/tests/proper_unpin.rs
vendored
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
#![warn(rust_2018_idioms, single_use_lifetimes)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[macro_use]
|
||||
mod auxiliary;
|
||||
|
||||
pub mod default {
|
||||
use std::marker::PhantomPinned;
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
struct Inner<T> {
|
||||
f: T,
|
||||
}
|
||||
|
||||
assert_unpin!(Inner<()>);
|
||||
assert_not_unpin!(Inner<PhantomPinned>);
|
||||
|
||||
pin_project! {
|
||||
struct Struct<T, U> {
|
||||
#[pin]
|
||||
f1: Inner<T>,
|
||||
f2: U,
|
||||
}
|
||||
}
|
||||
|
||||
assert_unpin!(Struct<(), ()>);
|
||||
assert_unpin!(Struct<(), PhantomPinned>);
|
||||
assert_not_unpin!(Struct<PhantomPinned, ()>);
|
||||
assert_not_unpin!(Struct<PhantomPinned, PhantomPinned>);
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
enum Enum<T, U> {
|
||||
V1 {
|
||||
#[pin]
|
||||
f1: Inner<T>,
|
||||
f2: U,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
assert_unpin!(Enum<(), ()>);
|
||||
assert_unpin!(Enum<(), PhantomPinned>);
|
||||
assert_not_unpin!(Enum<PhantomPinned, ()>);
|
||||
assert_not_unpin!(Enum<PhantomPinned, PhantomPinned>);
|
||||
|
||||
pin_project! {
|
||||
#[project(!Unpin)]
|
||||
enum NotUnpinEnum<T, U> {
|
||||
V1 {
|
||||
#[pin] f1: Inner<T>,
|
||||
f2: U,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert_not_unpin!(NotUnpinEnum<(), ()>);
|
||||
|
||||
pin_project! {
|
||||
struct TrivialBounds {
|
||||
#[pin]
|
||||
f: PhantomPinned,
|
||||
}
|
||||
}
|
||||
|
||||
assert_not_unpin!(TrivialBounds);
|
||||
|
||||
pin_project! {
|
||||
struct PinRef<'a, T, U> {
|
||||
#[pin]
|
||||
f1: &'a mut Inner<T>,
|
||||
f2: U,
|
||||
}
|
||||
}
|
||||
|
||||
assert_unpin!(PinRef<'_, PhantomPinned, PhantomPinned>);
|
||||
|
||||
pin_project! {
|
||||
#[project(!Unpin)]
|
||||
struct NotUnpin<U> {
|
||||
#[pin]
|
||||
u: U
|
||||
}
|
||||
}
|
||||
|
||||
assert_not_unpin!(NotUnpin<()>);
|
||||
|
||||
pin_project! {
|
||||
#[project(!Unpin)]
|
||||
struct NotUnpinRef<'a, T, U> {
|
||||
#[pin]
|
||||
f1: &'a mut Inner<T>,
|
||||
f2: U
|
||||
}
|
||||
}
|
||||
|
||||
assert_not_unpin!(NotUnpinRef<'_, (), ()>);
|
||||
}
|
||||
698
third-party/vendor/pin-project-lite/tests/test.rs
vendored
Normal file
698
third-party/vendor/pin-project-lite/tests/test.rs
vendored
Normal file
|
|
@ -0,0 +1,698 @@
|
|||
#![warn(rust_2018_idioms, single_use_lifetimes)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[macro_use]
|
||||
mod auxiliary;
|
||||
|
||||
use core::{
|
||||
marker::{PhantomData, PhantomPinned},
|
||||
pin::Pin,
|
||||
};
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
#[test]
|
||||
fn projection() {
|
||||
pin_project! {
|
||||
#[project = StructProj]
|
||||
#[project_ref = StructProjRef]
|
||||
#[project_replace = StructProjReplace]
|
||||
#[derive(Default)]
|
||||
struct Struct<T, U> {
|
||||
#[pin]
|
||||
f1: T,
|
||||
f2: U,
|
||||
}
|
||||
}
|
||||
|
||||
let mut s = Struct { f1: 1, f2: 2 };
|
||||
let mut s_orig = Pin::new(&mut s);
|
||||
let s = s_orig.as_mut().project();
|
||||
|
||||
let _: Pin<&mut i32> = s.f1;
|
||||
assert_eq!(*s.f1, 1);
|
||||
let _: &mut i32 = s.f2;
|
||||
assert_eq!(*s.f2, 2);
|
||||
|
||||
assert_eq!(s_orig.as_ref().f1, 1);
|
||||
assert_eq!(s_orig.as_ref().f2, 2);
|
||||
|
||||
let mut s = Struct { f1: 1, f2: 2 };
|
||||
let mut s = Pin::new(&mut s);
|
||||
{
|
||||
let StructProj { f1, f2 } = s.as_mut().project();
|
||||
let _: Pin<&mut i32> = f1;
|
||||
let _: &mut i32 = f2;
|
||||
}
|
||||
{
|
||||
let StructProjRef { f1, f2 } = s.as_ref().project_ref();
|
||||
let _: Pin<&i32> = f1;
|
||||
let _: &i32 = f2;
|
||||
}
|
||||
|
||||
{
|
||||
let StructProjReplace { f1: PhantomData, f2 } =
|
||||
s.as_mut().project_replace(Struct::default());
|
||||
assert_eq!(f2, 2);
|
||||
let StructProj { f1, f2 } = s.project();
|
||||
assert_eq!(*f1, 0);
|
||||
assert_eq!(*f2, 0);
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[project_replace = EnumProjReplace]
|
||||
#[derive(Eq, PartialEq, Debug)]
|
||||
enum Enum<C, D> {
|
||||
Struct {
|
||||
#[pin]
|
||||
f1: C,
|
||||
f2: D,
|
||||
},
|
||||
Unit,
|
||||
}
|
||||
}
|
||||
|
||||
let mut e = Enum::Struct { f1: 1, f2: 2 };
|
||||
let mut e = Pin::new(&mut e);
|
||||
|
||||
match e.as_mut().project() {
|
||||
EnumProj::Struct { f1, f2 } => {
|
||||
let _: Pin<&mut i32> = f1;
|
||||
assert_eq!(*f1, 1);
|
||||
let _: &mut i32 = f2;
|
||||
assert_eq!(*f2, 2);
|
||||
}
|
||||
EnumProj::Unit => unreachable!(),
|
||||
}
|
||||
|
||||
assert_eq!(&*e, &Enum::Struct { f1: 1, f2: 2 });
|
||||
|
||||
if let EnumProj::Struct { f1, f2 } = e.as_mut().project() {
|
||||
let _: Pin<&mut i32> = f1;
|
||||
assert_eq!(*f1, 1);
|
||||
let _: &mut i32 = f2;
|
||||
assert_eq!(*f2, 2);
|
||||
}
|
||||
|
||||
if let EnumProjReplace::Struct { f1: PhantomData, f2 } = e.as_mut().project_replace(Enum::Unit)
|
||||
{
|
||||
assert_eq!(f2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enum_project_set() {
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
#[derive(Eq, PartialEq, Debug)]
|
||||
enum Enum {
|
||||
V1 { #[pin] f: u8 },
|
||||
V2 { f: bool },
|
||||
}
|
||||
}
|
||||
|
||||
let mut e = Enum::V1 { f: 25 };
|
||||
let mut e_orig = Pin::new(&mut e);
|
||||
let e_proj = e_orig.as_mut().project();
|
||||
|
||||
match e_proj {
|
||||
EnumProj::V1 { f } => {
|
||||
let new_e = Enum::V2 { f: f.as_ref().get_ref() == &25 };
|
||||
e_orig.set(new_e);
|
||||
}
|
||||
EnumProj::V2 { .. } => unreachable!(),
|
||||
}
|
||||
|
||||
assert_eq!(e, Enum::V2 { f: true });
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn where_clause() {
|
||||
pin_project! {
|
||||
struct Struct<T>
|
||||
where
|
||||
T: Copy,
|
||||
{
|
||||
f: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
enum Enum<T>
|
||||
where
|
||||
T: Copy,
|
||||
{
|
||||
V { f: T },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn where_clause_and_associated_type_field() {
|
||||
pin_project! {
|
||||
struct Struct1<I>
|
||||
where
|
||||
I: Iterator,
|
||||
{
|
||||
#[pin]
|
||||
f1: I,
|
||||
f2: I::Item,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Struct2<I, J>
|
||||
where
|
||||
I: Iterator<Item = J>,
|
||||
{
|
||||
#[pin]
|
||||
f1: I,
|
||||
f2: J,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct3<T>
|
||||
where
|
||||
T: 'static,
|
||||
{
|
||||
f: T,
|
||||
}
|
||||
}
|
||||
|
||||
trait Static: 'static {}
|
||||
|
||||
impl<T> Static for Struct3<T> {}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
enum Enum<I>
|
||||
where
|
||||
I: Iterator,
|
||||
{
|
||||
V1 { #[pin] f: I },
|
||||
V2 { f: I::Item },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn derive_copy() {
|
||||
pin_project! {
|
||||
#[derive(Clone, Copy)]
|
||||
struct Struct<T> {
|
||||
f: T,
|
||||
}
|
||||
}
|
||||
|
||||
fn is_copy<T: Copy>() {}
|
||||
|
||||
is_copy::<Struct<u8>>();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn move_out() {
|
||||
struct NotCopy;
|
||||
|
||||
pin_project! {
|
||||
struct Struct {
|
||||
f: NotCopy,
|
||||
}
|
||||
}
|
||||
|
||||
let x = Struct { f: NotCopy };
|
||||
let _val: NotCopy = x.f;
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
enum Enum {
|
||||
V { f: NotCopy },
|
||||
}
|
||||
}
|
||||
|
||||
let x = Enum::V { f: NotCopy };
|
||||
#[allow(clippy::infallible_destructuring_match)]
|
||||
let _val: NotCopy = match x {
|
||||
Enum::V { f } => f,
|
||||
};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn trait_bounds_on_type_generics() {
|
||||
pin_project! {
|
||||
pub struct Struct1<'a, T: ?Sized> {
|
||||
f: &'a mut T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct2<'a, T: ::core::fmt::Debug> {
|
||||
f: &'a mut T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct3<'a, T: core::fmt::Debug> {
|
||||
f: &'a mut T,
|
||||
}
|
||||
}
|
||||
|
||||
// pin_project! {
|
||||
// pub struct Struct4<'a, T: core::fmt::Debug + core::fmt::Display> {
|
||||
// f: &'a mut T,
|
||||
// }
|
||||
// }
|
||||
|
||||
// pin_project! {
|
||||
// pub struct Struct5<'a, T: core::fmt::Debug + ?Sized> {
|
||||
// f: &'a mut T,
|
||||
// }
|
||||
// }
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct6<'a, T: core::fmt::Debug = [u8; 16]> {
|
||||
f: &'a mut T,
|
||||
}
|
||||
}
|
||||
|
||||
let _: Struct6<'_> = Struct6 { f: &mut [0_u8; 16] };
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct7<T: 'static> {
|
||||
f: T,
|
||||
}
|
||||
}
|
||||
|
||||
trait Static: 'static {}
|
||||
|
||||
impl<T> Static for Struct7<T> {}
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct8<'a, 'b: 'a> {
|
||||
f1: &'a u8,
|
||||
f2: &'b u8,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
enum Enum<'a, T: ?Sized> {
|
||||
V { f: &'a mut T },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn private_type_in_public_type() {
|
||||
pin_project! {
|
||||
pub struct PublicStruct<T> {
|
||||
#[pin]
|
||||
inner: PrivateStruct<T>,
|
||||
}
|
||||
}
|
||||
|
||||
struct PrivateStruct<T>(T);
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_lifetimes)]
|
||||
#[test]
|
||||
fn lifetime_project() {
|
||||
pin_project! {
|
||||
struct Struct1<T, U> {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Struct2<'a, T, U> {
|
||||
#[pin]
|
||||
pinned: &'a T,
|
||||
unpinned: U,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = EnumProj]
|
||||
#[project_ref = EnumProjRef]
|
||||
enum Enum<T, U> {
|
||||
V {
|
||||
#[pin]
|
||||
pinned: T,
|
||||
unpinned: U,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, U> Struct1<T, U> {
|
||||
fn get_pin_ref<'a>(self: Pin<&'a Self>) -> Pin<&'a T> {
|
||||
self.project_ref().pinned
|
||||
}
|
||||
fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut T> {
|
||||
self.project().pinned
|
||||
}
|
||||
fn get_pin_ref_elided(self: Pin<&Self>) -> Pin<&T> {
|
||||
self.project_ref().pinned
|
||||
}
|
||||
fn get_pin_mut_elided(self: Pin<&mut Self>) -> Pin<&mut T> {
|
||||
self.project().pinned
|
||||
}
|
||||
}
|
||||
|
||||
impl<'b, T, U> Struct2<'b, T, U> {
|
||||
fn get_pin_ref<'a>(self: Pin<&'a Self>) -> Pin<&'a &'b T> {
|
||||
self.project_ref().pinned
|
||||
}
|
||||
fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut &'b T> {
|
||||
self.project().pinned
|
||||
}
|
||||
fn get_pin_ref_elided(self: Pin<&Self>) -> Pin<&&'b T> {
|
||||
self.project_ref().pinned
|
||||
}
|
||||
fn get_pin_mut_elided(self: Pin<&mut Self>) -> Pin<&mut &'b T> {
|
||||
self.project().pinned
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, U> Enum<T, U> {
|
||||
fn get_pin_ref<'a>(self: Pin<&'a Self>) -> Pin<&'a T> {
|
||||
match self.project_ref() {
|
||||
EnumProjRef::V { pinned, .. } => pinned,
|
||||
}
|
||||
}
|
||||
fn get_pin_mut<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut T> {
|
||||
match self.project() {
|
||||
EnumProj::V { pinned, .. } => pinned,
|
||||
}
|
||||
}
|
||||
fn get_pin_ref_elided(self: Pin<&Self>) -> Pin<&T> {
|
||||
match self.project_ref() {
|
||||
EnumProjRef::V { pinned, .. } => pinned,
|
||||
}
|
||||
}
|
||||
fn get_pin_mut_elided(self: Pin<&mut Self>) -> Pin<&mut T> {
|
||||
match self.project() {
|
||||
EnumProj::V { pinned, .. } => pinned,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mod visibility {
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
pub(crate) struct S {
|
||||
pub f: u8,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn visibility() {
|
||||
let mut x = visibility::S { f: 0 };
|
||||
let x = Pin::new(&mut x);
|
||||
let y = x.as_ref().project_ref();
|
||||
let _: &u8 = y.f;
|
||||
let y = x.project();
|
||||
let _: &mut u8 = y.f;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn trivial_bounds() {
|
||||
pin_project! {
|
||||
pub struct NoGenerics {
|
||||
#[pin]
|
||||
f: PhantomPinned,
|
||||
}
|
||||
}
|
||||
|
||||
assert_not_unpin!(NoGenerics);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dst() {
|
||||
pin_project! {
|
||||
pub struct Struct1<T: ?Sized> {
|
||||
f: T,
|
||||
}
|
||||
}
|
||||
|
||||
let mut x = Struct1 { f: 0_u8 };
|
||||
let x: Pin<&mut Struct1<dyn core::fmt::Debug>> = Pin::new(&mut x as _);
|
||||
let _: &mut (dyn core::fmt::Debug) = x.project().f;
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct2<T: ?Sized> {
|
||||
#[pin]
|
||||
f: T,
|
||||
}
|
||||
}
|
||||
|
||||
let mut x = Struct2 { f: 0_u8 };
|
||||
let x: Pin<&mut Struct2<dyn core::fmt::Debug + Unpin>> = Pin::new(&mut x as _);
|
||||
let _: Pin<&mut (dyn core::fmt::Debug + Unpin)> = x.project().f;
|
||||
|
||||
pin_project! {
|
||||
struct Struct3<T>
|
||||
where
|
||||
T: ?Sized,
|
||||
{
|
||||
f: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Struct4<T>
|
||||
where
|
||||
T: ?Sized,
|
||||
{
|
||||
#[pin]
|
||||
f: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Struct11<'a, T: ?Sized, U: ?Sized> {
|
||||
f1: &'a mut T,
|
||||
f2: U,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dyn_type() {
|
||||
pin_project! {
|
||||
struct Struct1 {
|
||||
f: dyn core::fmt::Debug,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Struct2 {
|
||||
#[pin]
|
||||
f: dyn core::fmt::Debug,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Struct3 {
|
||||
f: dyn core::fmt::Debug + Send,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Struct4 {
|
||||
#[pin]
|
||||
f: dyn core::fmt::Debug + Send,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_infer_outlives() {
|
||||
trait Trait<X> {
|
||||
type Y;
|
||||
}
|
||||
|
||||
struct Struct1<A>(A);
|
||||
|
||||
impl<X, T> Trait<X> for Struct1<T> {
|
||||
type Y = Option<T>;
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Struct2<A, B> {
|
||||
_f: <Struct1<A> as Trait<B>>::Y,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/taiki-e/pin-project-lite/issues/31
|
||||
#[test]
|
||||
fn trailing_comma() {
|
||||
pub trait T {}
|
||||
|
||||
pin_project! {
|
||||
pub struct S1<
|
||||
A: T,
|
||||
B: T,
|
||||
> {
|
||||
f: (A, B),
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
pub struct S2<
|
||||
A,
|
||||
B,
|
||||
>
|
||||
where
|
||||
A: T,
|
||||
B: T,
|
||||
{
|
||||
f: (A, B),
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[allow(explicit_outlives_requirements)]
|
||||
pub struct S3<
|
||||
'a,
|
||||
A: 'a,
|
||||
B: 'a,
|
||||
> {
|
||||
f: &'a (A, B),
|
||||
}
|
||||
}
|
||||
|
||||
// pin_project! {
|
||||
// pub struct S4<
|
||||
// 'a,
|
||||
// 'b: 'a, // <-----
|
||||
// > {
|
||||
// f: &'a &'b (),
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn attrs() {
|
||||
pin_project! {
|
||||
/// dox1
|
||||
#[derive(Clone)]
|
||||
#[project = StructProj]
|
||||
#[project_ref = StructProjRef]
|
||||
/// dox2
|
||||
#[derive(Debug)]
|
||||
/// dox3
|
||||
struct Struct {
|
||||
// TODO
|
||||
// /// dox4
|
||||
f: ()
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[project = Enum1Proj]
|
||||
#[project_ref = Enum1ProjRef]
|
||||
enum Enum1 {
|
||||
#[cfg(not(any()))]
|
||||
V {
|
||||
f: ()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
/// dox1
|
||||
#[derive(Clone)]
|
||||
#[project(!Unpin)]
|
||||
#[project = Enum2Proj]
|
||||
#[project_ref = Enum2ProjRef]
|
||||
/// dox2
|
||||
#[derive(Debug)]
|
||||
/// dox3
|
||||
enum Enum2 {
|
||||
/// dox4
|
||||
V1 {
|
||||
// TODO
|
||||
// /// dox5
|
||||
f: ()
|
||||
},
|
||||
/// dox6
|
||||
V2,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pinned_drop() {
|
||||
pin_project! {
|
||||
pub struct Struct1<'a> {
|
||||
was_dropped: &'a mut bool,
|
||||
#[pin]
|
||||
field: u8,
|
||||
}
|
||||
impl PinnedDrop for Struct1<'_> {
|
||||
fn drop(this: Pin<&mut Self>) {
|
||||
**this.project().was_dropped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut was_dropped = false;
|
||||
drop(Struct1 { was_dropped: &mut was_dropped, field: 42 });
|
||||
assert!(was_dropped);
|
||||
|
||||
pin_project! {
|
||||
pub struct Struct2<'a> {
|
||||
was_dropped: &'a mut bool,
|
||||
#[pin]
|
||||
field: u8,
|
||||
}
|
||||
impl PinnedDrop for Struct2<'_> {
|
||||
fn drop(mut this: Pin<&mut Self>) {
|
||||
**this.as_mut().project().was_dropped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trait Service<Request> {
|
||||
type Error;
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Struct3<'a, T, Request>
|
||||
where
|
||||
T: Service<Request>,
|
||||
T::Error: std::error::Error,
|
||||
{
|
||||
was_dropped: &'a mut bool,
|
||||
#[pin]
|
||||
field: T,
|
||||
req: Request,
|
||||
}
|
||||
|
||||
/// dox1
|
||||
impl<T, Request> PinnedDrop for Struct3<'_, T, Request>
|
||||
where
|
||||
T: Service<Request>,
|
||||
T::Error: std::error::Error,
|
||||
{
|
||||
/// dox2
|
||||
fn drop(mut this: Pin<&mut Self>) {
|
||||
**this.as_mut().project().was_dropped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
third-party/vendor/pin-project-lite/tests/ui/pin_project/conflict-drop.rs
vendored
Normal file
15
third-party/vendor/pin-project-lite/tests/ui/pin_project/conflict-drop.rs
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! { //~ ERROR E0119
|
||||
struct Foo<T, U> {
|
||||
#[pin]
|
||||
future: T,
|
||||
field: U,
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, U> Drop for Foo<T, U> {
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
16
third-party/vendor/pin-project-lite/tests/ui/pin_project/conflict-drop.stderr
vendored
Normal file
16
third-party/vendor/pin-project-lite/tests/ui/pin_project/conflict-drop.stderr
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
error[E0119]: conflicting implementations of trait `MustNotImplDrop` for type `Foo<_, _>`
|
||||
--> tests/ui/pin_project/conflict-drop.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0119
|
||||
4 | | struct Foo<T, U> {
|
||||
5 | | #[pin]
|
||||
6 | | future: T,
|
||||
7 | | field: U,
|
||||
8 | | }
|
||||
9 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_first implementation here
|
||||
| conflicting implementation for `Foo<_, _>`
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_make_drop_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
64
third-party/vendor/pin-project-lite/tests/ui/pin_project/conflict-unpin.rs
vendored
Normal file
64
third-party/vendor/pin-project-lite/tests/ui/pin_project/conflict-unpin.rs
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
// The same implementation.
|
||||
|
||||
pin_project! { //~ ERROR E0119
|
||||
struct Foo<T, U> {
|
||||
#[pin]
|
||||
future: T,
|
||||
field: U,
|
||||
}
|
||||
}
|
||||
|
||||
// conflicting implementations
|
||||
impl<T, U> Unpin for Foo<T, U> where T: Unpin {} // Conditional Unpin impl
|
||||
|
||||
// The implementation that under different conditions.
|
||||
|
||||
pin_project! { //~ ERROR E0119
|
||||
struct Bar<T, U> {
|
||||
#[pin]
|
||||
future: T,
|
||||
field: U,
|
||||
}
|
||||
}
|
||||
|
||||
// conflicting implementations
|
||||
impl<T, U> Unpin for Bar<T, U> {} // Non-conditional Unpin impl
|
||||
|
||||
pin_project! { //~ ERROR E0119
|
||||
struct Baz<T, U> {
|
||||
#[pin]
|
||||
future: T,
|
||||
field: U,
|
||||
}
|
||||
}
|
||||
|
||||
// conflicting implementations
|
||||
impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl
|
||||
|
||||
pin_project! { //~ ERROR E0119
|
||||
#[project(!Unpin)]
|
||||
struct Qux<T, U> {
|
||||
#[pin]
|
||||
future: T,
|
||||
field: U,
|
||||
}
|
||||
}
|
||||
|
||||
// conflicting implementations
|
||||
impl<T, U> Unpin for Qux<T, U> {} // Non-conditional Unpin impl
|
||||
|
||||
pin_project! { //~ ERROR E0119
|
||||
#[project(!Unpin)]
|
||||
struct Fred<T, U> {
|
||||
#[pin]
|
||||
future: T,
|
||||
field: U,
|
||||
}
|
||||
}
|
||||
|
||||
// conflicting implementations
|
||||
impl<T: Unpin, U: Unpin> Unpin for Fred<T, U> {} // Conditional Unpin impl
|
||||
|
||||
fn main() {}
|
||||
84
third-party/vendor/pin-project-lite/tests/ui/pin_project/conflict-unpin.stderr
vendored
Normal file
84
third-party/vendor/pin-project-lite/tests/ui/pin_project/conflict-unpin.stderr
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
error[E0119]: conflicting implementations of trait `Unpin` for type `Foo<_, _>`
|
||||
--> tests/ui/pin_project/conflict-unpin.rs:5:1
|
||||
|
|
||||
5 | / pin_project! { //~ ERROR E0119
|
||||
6 | | struct Foo<T, U> {
|
||||
7 | | #[pin]
|
||||
8 | | future: T,
|
||||
9 | | field: U,
|
||||
10 | | }
|
||||
11 | | }
|
||||
| |_^ conflicting implementation for `Foo<_, _>`
|
||||
...
|
||||
14 | impl<T, U> Unpin for Foo<T, U> where T: Unpin {} // Conditional Unpin impl
|
||||
| ------------------------------ first implementation here
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0119]: conflicting implementations of trait `Unpin` for type `Bar<_, _>`
|
||||
--> tests/ui/pin_project/conflict-unpin.rs:18:1
|
||||
|
|
||||
18 | / pin_project! { //~ ERROR E0119
|
||||
19 | | struct Bar<T, U> {
|
||||
20 | | #[pin]
|
||||
21 | | future: T,
|
||||
22 | | field: U,
|
||||
23 | | }
|
||||
24 | | }
|
||||
| |_^ conflicting implementation for `Bar<_, _>`
|
||||
...
|
||||
27 | impl<T, U> Unpin for Bar<T, U> {} // Non-conditional Unpin impl
|
||||
| ------------------------------ first implementation here
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0119]: conflicting implementations of trait `Unpin` for type `Baz<_, _>`
|
||||
--> tests/ui/pin_project/conflict-unpin.rs:29:1
|
||||
|
|
||||
29 | / pin_project! { //~ ERROR E0119
|
||||
30 | | struct Baz<T, U> {
|
||||
31 | | #[pin]
|
||||
32 | | future: T,
|
||||
33 | | field: U,
|
||||
34 | | }
|
||||
35 | | }
|
||||
| |_^ conflicting implementation for `Baz<_, _>`
|
||||
...
|
||||
38 | impl<T: Unpin, U: Unpin> Unpin for Baz<T, U> {} // Conditional Unpin impl
|
||||
| -------------------------------------------- first implementation here
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0119]: conflicting implementations of trait `Unpin` for type `Qux<_, _>`
|
||||
--> tests/ui/pin_project/conflict-unpin.rs:40:1
|
||||
|
|
||||
40 | / pin_project! { //~ ERROR E0119
|
||||
41 | | #[project(!Unpin)]
|
||||
42 | | struct Qux<T, U> {
|
||||
43 | | #[pin]
|
||||
... |
|
||||
46 | | }
|
||||
47 | | }
|
||||
| |_^ conflicting implementation for `Qux<_, _>`
|
||||
...
|
||||
50 | impl<T, U> Unpin for Qux<T, U> {} // Non-conditional Unpin impl
|
||||
| ------------------------------ first implementation here
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0119]: conflicting implementations of trait `Unpin` for type `Fred<_, _>`
|
||||
--> tests/ui/pin_project/conflict-unpin.rs:52:1
|
||||
|
|
||||
52 | / pin_project! { //~ ERROR E0119
|
||||
53 | | #[project(!Unpin)]
|
||||
54 | | struct Fred<T, U> {
|
||||
55 | | #[pin]
|
||||
... |
|
||||
58 | | }
|
||||
59 | | }
|
||||
| |_^ conflicting implementation for `Fred<_, _>`
|
||||
...
|
||||
62 | impl<T: Unpin, U: Unpin> Unpin for Fred<T, U> {} // Conditional Unpin impl
|
||||
| --------------------------------------------- first implementation here
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
93
third-party/vendor/pin-project-lite/tests/ui/pin_project/invalid-bounds.rs
vendored
Normal file
93
third-party/vendor/pin-project-lite/tests/ui/pin_project/invalid-bounds.rs
vendored
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
struct Generics1<T: 'static : Sized> { //~ ERROR no rules expected the token `:`
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Generics2<T: 'static : ?Sized> { //~ ERROR no rules expected the token `:`
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Generics6<T: ?Sized : Sized> { //~ ERROR no rules expected the token `Sized`
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct WhereClause1<T>
|
||||
where
|
||||
T: 'static : Sized //~ ERROR no rules expected the token `:`
|
||||
{
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct WhereClause2<T>
|
||||
where
|
||||
T: 'static : ?Sized //~ ERROR no rules expected the token `:`
|
||||
{
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct WhereClause3<T>
|
||||
where
|
||||
T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
{
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct WhereClause4<T>
|
||||
where
|
||||
T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
{
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct WhereClause5<T>
|
||||
where
|
||||
T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
{
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct WhereClause6<T>
|
||||
where
|
||||
T: ?Sized : Sized //~ ERROR no rules expected the token `Sized`
|
||||
{
|
||||
field: T,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
470
third-party/vendor/pin-project-lite/tests/ui/pin_project/invalid-bounds.stderr
vendored
Normal file
470
third-party/vendor/pin-project-lite/tests/ui/pin_project/invalid-bounds.stderr
vendored
Normal file
|
|
@ -0,0 +1,470 @@
|
|||
error: no rules expected the token `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:4:33
|
||||
|
|
||||
4 | struct Generics1<T: 'static : Sized> { //~ ERROR no rules expected the token `:`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `>`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| >)?
|
||||
| ^
|
||||
|
||||
error: no rules expected the token `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:10:33
|
||||
|
|
||||
10 | struct Generics2<T: 'static : ?Sized> { //~ ERROR no rules expected the token `:`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `>`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| >)?
|
||||
| ^
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:15:1
|
||||
|
|
||||
15 | / pin_project! {
|
||||
16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
17 | | field: T,
|
||||
18 | | }
|
||||
19 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| | expected one of `+`, `,`, `=`, or `>`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:15:1
|
||||
|
|
||||
15 | / pin_project! {
|
||||
16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
17 | | field: T,
|
||||
18 | | }
|
||||
19 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected one of `+`, `,`, `=`, or `>`
|
||||
| unexpected token
|
||||
|
|
||||
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:15:1
|
||||
|
|
||||
15 | / pin_project! {
|
||||
16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
17 | | field: T,
|
||||
18 | | }
|
||||
19 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| | expected one of `+`, `,`, `=`, or `>`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:15:1
|
||||
|
|
||||
15 | / pin_project! {
|
||||
16 | | struct Generics3<T: Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
17 | | field: T,
|
||||
18 | | }
|
||||
19 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| | expected one of `+`, `,`, `=`, or `>`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:21:1
|
||||
|
|
||||
21 | / pin_project! {
|
||||
22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
23 | | field: T,
|
||||
24 | | }
|
||||
25 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| | expected one of `+`, `,`, `=`, or `>`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:21:1
|
||||
|
|
||||
21 | / pin_project! {
|
||||
22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
23 | | field: T,
|
||||
24 | | }
|
||||
25 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected one of `+`, `,`, `=`, or `>`
|
||||
| unexpected token
|
||||
|
|
||||
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:21:1
|
||||
|
|
||||
21 | / pin_project! {
|
||||
22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
23 | | field: T,
|
||||
24 | | }
|
||||
25 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| | expected one of `+`, `,`, `=`, or `>`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:21:1
|
||||
|
|
||||
21 | / pin_project! {
|
||||
22 | | struct Generics4<T: ?Sized : 'static> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
23 | | field: T,
|
||||
24 | | }
|
||||
25 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| | expected one of `+`, `,`, `=`, or `>`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:27:1
|
||||
|
|
||||
27 | / pin_project! {
|
||||
28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
29 | | field: T,
|
||||
30 | | }
|
||||
31 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| | expected one of `+`, `,`, `=`, or `>`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:27:1
|
||||
|
|
||||
27 | / pin_project! {
|
||||
28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
29 | | field: T,
|
||||
30 | | }
|
||||
31 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected one of `+`, `,`, `=`, or `>`
|
||||
| unexpected token
|
||||
|
|
||||
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:27:1
|
||||
|
|
||||
27 | / pin_project! {
|
||||
28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
29 | | field: T,
|
||||
30 | | }
|
||||
31 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| | expected one of `+`, `,`, `=`, or `>`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:27:1
|
||||
|
|
||||
27 | / pin_project! {
|
||||
28 | | struct Generics5<T: Sized : ?Sized> { //~ ERROR expected one of `+`, `,`, `=`, or `>`, found `:`
|
||||
29 | | field: T,
|
||||
30 | | }
|
||||
31 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| | expected one of `+`, `,`, `=`, or `>`
|
||||
| |_unexpected token
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `Sized`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:34:34
|
||||
|
|
||||
34 | struct Generics6<T: ?Sized : Sized> { //~ ERROR no rules expected the token `Sized`
|
||||
| ^^^^^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match meta-variable `$generics_lifetime_bound:lifetime`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| $(: $generics_lifetime_bound:lifetime)?
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: no rules expected the token `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:42:20
|
||||
|
|
||||
42 | T: 'static : Sized //~ ERROR no rules expected the token `:`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `{`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| {
|
||||
| ^
|
||||
|
||||
error: no rules expected the token `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:51:20
|
||||
|
|
||||
51 | T: 'static : ?Sized //~ ERROR no rules expected the token `:`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `{`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| {
|
||||
| ^
|
||||
|
||||
error: expected `{` after struct name, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:57:1
|
||||
|
|
||||
57 | / pin_project! {
|
||||
58 | | struct WhereClause3<T>
|
||||
59 | | where
|
||||
60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
63 | | }
|
||||
64 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, or `{`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:57:1
|
||||
|
|
||||
57 | / pin_project! {
|
||||
58 | | struct WhereClause3<T>
|
||||
59 | | where
|
||||
60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
63 | | }
|
||||
64 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected one of `+`, `,`, or `{`
|
||||
| unexpected token
|
||||
|
|
||||
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected `{` after struct name, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:57:1
|
||||
|
|
||||
57 | / pin_project! {
|
||||
58 | | struct WhereClause3<T>
|
||||
59 | | where
|
||||
60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
63 | | }
|
||||
64 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected `{` after struct name, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:57:1
|
||||
|
|
||||
57 | / pin_project! {
|
||||
58 | | struct WhereClause3<T>
|
||||
59 | | where
|
||||
60 | | T: Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
63 | | }
|
||||
64 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected `{` after struct name, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:66:1
|
||||
|
|
||||
66 | / pin_project! {
|
||||
67 | | struct WhereClause4<T>
|
||||
68 | | where
|
||||
69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
72 | | }
|
||||
73 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, or `{`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:66:1
|
||||
|
|
||||
66 | / pin_project! {
|
||||
67 | | struct WhereClause4<T>
|
||||
68 | | where
|
||||
69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
72 | | }
|
||||
73 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected one of `+`, `,`, or `{`
|
||||
| unexpected token
|
||||
|
|
||||
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected `{` after struct name, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:66:1
|
||||
|
|
||||
66 | / pin_project! {
|
||||
67 | | struct WhereClause4<T>
|
||||
68 | | where
|
||||
69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
72 | | }
|
||||
73 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected `{` after struct name, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:66:1
|
||||
|
|
||||
66 | / pin_project! {
|
||||
67 | | struct WhereClause4<T>
|
||||
68 | | where
|
||||
69 | | T: ?Sized : 'static //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
72 | | }
|
||||
73 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected `{` after struct name, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:75:1
|
||||
|
|
||||
75 | / pin_project! {
|
||||
76 | | struct WhereClause5<T>
|
||||
77 | | where
|
||||
78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
81 | | }
|
||||
82 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected one of `+`, `,`, or `{`, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:75:1
|
||||
|
|
||||
75 | / pin_project! {
|
||||
76 | | struct WhereClause5<T>
|
||||
77 | | where
|
||||
78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
81 | | }
|
||||
82 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected one of `+`, `,`, or `{`
|
||||
| unexpected token
|
||||
|
|
||||
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected `{` after struct name, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:75:1
|
||||
|
|
||||
75 | / pin_project! {
|
||||
76 | | struct WhereClause5<T>
|
||||
77 | | where
|
||||
78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
81 | | }
|
||||
82 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected `{` after struct name, found `:`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:75:1
|
||||
|
|
||||
75 | / pin_project! {
|
||||
76 | | struct WhereClause5<T>
|
||||
77 | | where
|
||||
78 | | T: Sized : ?Sized //~ ERROR expected `where`, or `{` after struct name, found `:`
|
||||
... |
|
||||
81 | | }
|
||||
82 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected `{` after struct name
|
||||
| in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_parse_generics` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `Sized`
|
||||
--> tests/ui/pin_project/invalid-bounds.rs:87:21
|
||||
|
|
||||
87 | T: ?Sized : Sized //~ ERROR no rules expected the token `Sized`
|
||||
| ^^^^^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match meta-variable `$where_clause_lifetime_bound:lifetime`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| $(: $where_clause_lifetime_bound:lifetime)?
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
25
third-party/vendor/pin-project-lite/tests/ui/pin_project/invalid.rs
vendored
Normal file
25
third-party/vendor/pin-project-lite/tests/ui/pin_project/invalid.rs
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
struct A<T> {
|
||||
#[pin()] //~ ERROR no rules expected the token `(`
|
||||
pinned: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
#[pin] //~ ERROR cannot find attribute `pin` in this scope
|
||||
struct B<T> {
|
||||
pinned: T,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct C<T> {
|
||||
#[pin]
|
||||
#[pin] //~ ERROR no rules expected the token `#`
|
||||
pinned: T,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
53
third-party/vendor/pin-project-lite/tests/ui/pin_project/invalid.stderr
vendored
Normal file
53
third-party/vendor/pin-project-lite/tests/ui/pin_project/invalid.stderr
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
error: no rules expected the token `(`
|
||||
--> tests/ui/pin_project/invalid.rs:5:14
|
||||
|
|
||||
5 | #[pin()] //~ ERROR no rules expected the token `(`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `]`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| $(#[$pin:ident])?
|
||||
| ^
|
||||
|
||||
error: no rules expected the token `(`
|
||||
--> tests/ui/pin_project/invalid.rs:5:14
|
||||
|
|
||||
5 | #[pin()] //~ ERROR no rules expected the token `(`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `]`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| $(#[$pin:ident])?
|
||||
| ^
|
||||
|
||||
error: no rules expected the token `#`
|
||||
--> tests/ui/pin_project/invalid.rs:20:9
|
||||
|
|
||||
20 | #[pin] //~ ERROR no rules expected the token `#`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match meta-variable `$field_vis:vis`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| $field_vis:vis $field:ident: $field_ty:ty
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: no rules expected the token `#`
|
||||
--> tests/ui/pin_project/invalid.rs:20:9
|
||||
|
|
||||
20 | #[pin] //~ ERROR no rules expected the token `#`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match meta-variable `$field_vis:vis`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| $field_vis:vis $field:ident: $field_ty:ty
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `pin` in this scope
|
||||
--> tests/ui/pin_project/invalid.rs:11:7
|
||||
|
|
||||
11 | #[pin] //~ ERROR cannot find attribute `pin` in this scope
|
||||
| ^^^
|
||||
10
third-party/vendor/pin-project-lite/tests/ui/pin_project/overlapping_lifetime_names.rs
vendored
Normal file
10
third-party/vendor/pin-project-lite/tests/ui/pin_project/overlapping_lifetime_names.rs
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! { //~ ERROR E0263,E0496
|
||||
pub struct Foo<'__pin, T> {
|
||||
#[pin]
|
||||
field: &'__pin mut T,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
75
third-party/vendor/pin-project-lite/tests/ui/pin_project/overlapping_lifetime_names.stderr
vendored
Normal file
75
third-party/vendor/pin-project-lite/tests/ui/pin_project/overlapping_lifetime_names.stderr
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
error[E0403]: the name `'__pin` is already used for a generic parameter in this item's generic parameters
|
||||
--> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ^^^^^^ already used
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_- first use of `'__pin`
|
||||
|
||||
error[E0403]: the name `'__pin` is already used for a generic parameter in this item's generic parameters
|
||||
--> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ^^^^^^ already used
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_- first use of `'__pin`
|
||||
|
||||
error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope
|
||||
--> tests/ui/pin_project/overlapping_lifetime_names.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ------ first declared here
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_^ lifetime `'__pin` already in scope
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_struct_make_proj_method` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0496]: lifetime name `'__pin` shadows a lifetime name that is already in scope
|
||||
--> tests/ui/pin_project/overlapping_lifetime_names.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ------ first declared here
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_^ lifetime `'__pin` already in scope
|
||||
|
|
||||
= note: this error originates in the macro `$crate::__pin_project_struct_make_proj_method` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0403]: the name `'__pin` is already used for a generic parameter in this item's generic parameters
|
||||
--> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ^^^^^^ already used
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_- first use of `'__pin`
|
||||
|
||||
error[E0403]: the name `'__pin` is already used for a generic parameter in this item's generic parameters
|
||||
--> tests/ui/pin_project/overlapping_lifetime_names.rs:4:20
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR E0263,E0496
|
||||
4 | | pub struct Foo<'__pin, T> {
|
||||
| | ^^^^^^ already used
|
||||
5 | | #[pin]
|
||||
6 | | field: &'__pin mut T,
|
||||
7 | | }
|
||||
8 | | }
|
||||
| |_- first use of `'__pin`
|
||||
20
third-party/vendor/pin-project-lite/tests/ui/pin_project/overlapping_unpin_struct.rs
vendored
Normal file
20
third-party/vendor/pin-project-lite/tests/ui/pin_project/overlapping_unpin_struct.rs
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
use std::marker::PhantomPinned;
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
struct Foo<T> {
|
||||
#[pin]
|
||||
inner: T,
|
||||
}
|
||||
}
|
||||
|
||||
struct __Origin {}
|
||||
|
||||
impl Unpin for __Origin {}
|
||||
|
||||
fn is_unpin<T: Unpin>() {}
|
||||
|
||||
fn main() {
|
||||
is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277
|
||||
}
|
||||
34
third-party/vendor/pin-project-lite/tests/ui/pin_project/overlapping_unpin_struct.stderr
vendored
Normal file
34
third-party/vendor/pin-project-lite/tests/ui/pin_project/overlapping_unpin_struct.stderr
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
error[E0277]: `PhantomPinned` cannot be unpinned
|
||||
--> tests/ui/pin_project/overlapping_unpin_struct.rs:19:16
|
||||
|
|
||||
19 | is_unpin::<Foo<PhantomPinned>>(); //~ ERROR E0277
|
||||
| ^^^^^^^^^^^^^^^^^^ within `_::__Origin<'_, PhantomPinned>`, the trait `Unpin` is not implemented for `PhantomPinned`
|
||||
|
|
||||
= note: consider using the `pin!` macro
|
||||
consider using `Box::pin` if you need to access the pinned value outside of the current scope
|
||||
note: required because it appears within the type `__Origin<'_, PhantomPinned>`
|
||||
--> tests/ui/pin_project/overlapping_unpin_struct.rs:5:1
|
||||
|
|
||||
5 | / pin_project! {
|
||||
6 | | struct Foo<T> {
|
||||
7 | | #[pin]
|
||||
8 | | inner: T,
|
||||
9 | | }
|
||||
10 | | }
|
||||
| |_^
|
||||
note: required for `Foo<PhantomPinned>` to implement `Unpin`
|
||||
--> tests/ui/pin_project/overlapping_unpin_struct.rs:5:1
|
||||
|
|
||||
5 | / pin_project! {
|
||||
6 | | struct Foo<T> {
|
||||
7 | | #[pin]
|
||||
8 | | inner: T,
|
||||
9 | | }
|
||||
10 | | }
|
||||
| |_^ unsatisfied trait bound introduced here
|
||||
note: required by a bound in `is_unpin`
|
||||
--> tests/ui/pin_project/overlapping_unpin_struct.rs:16:16
|
||||
|
|
||||
16 | fn is_unpin<T: Unpin>() {}
|
||||
| ^^^^^ required by this bound in `is_unpin`
|
||||
= note: this error originates in the macro `$crate::__pin_project_make_unpin_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
19
third-party/vendor/pin-project-lite/tests/ui/pin_project/packed.rs
vendored
Normal file
19
third-party/vendor/pin-project-lite/tests/ui/pin_project/packed.rs
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
#[repr(packed, C)]
|
||||
struct Packed {
|
||||
#[pin]
|
||||
field: u16,
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
#[repr(packed(2))]
|
||||
struct PackedN {
|
||||
#[pin]
|
||||
field: u32,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
101
third-party/vendor/pin-project-lite/tests/ui/pin_project/packed.stderr
vendored
Normal file
101
third-party/vendor/pin-project-lite/tests/ui/pin_project/packed.stderr
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
error[E0793]: reference to packed field is unaligned
|
||||
--> tests/ui/pin_project/packed.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
4 | | #[repr(packed, C)]
|
||||
5 | | struct Packed {
|
||||
6 | | #[pin]
|
||||
7 | | field: u16,
|
||||
8 | | }
|
||||
9 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
|
||||
= note: this error originates in the macro `$crate::__pin_project_struct_make_proj_method` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0793]: reference to packed field is unaligned
|
||||
--> tests/ui/pin_project/packed.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
4 | | #[repr(packed, C)]
|
||||
5 | | struct Packed {
|
||||
6 | | #[pin]
|
||||
7 | | field: u16,
|
||||
8 | | }
|
||||
9 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
|
||||
= note: this error originates in the macro `$crate::__pin_project_struct_make_proj_method` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0793]: reference to packed field is unaligned
|
||||
--> tests/ui/pin_project/packed.rs:3:1
|
||||
|
|
||||
3 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
4 | | #[repr(packed, C)]
|
||||
5 | | struct Packed {
|
||||
6 | | #[pin]
|
||||
7 | | field: u16,
|
||||
8 | | }
|
||||
9 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
|
||||
= note: this error originates in the macro `$crate::__pin_project_constant` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0793]: reference to packed field is unaligned
|
||||
--> tests/ui/pin_project/packed.rs:11:1
|
||||
|
|
||||
11 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
12 | | #[repr(packed(2))]
|
||||
13 | | struct PackedN {
|
||||
14 | | #[pin]
|
||||
15 | | field: u32,
|
||||
16 | | }
|
||||
17 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
|
||||
= note: this error originates in the macro `$crate::__pin_project_struct_make_proj_method` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0793]: reference to packed field is unaligned
|
||||
--> tests/ui/pin_project/packed.rs:11:1
|
||||
|
|
||||
11 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
12 | | #[repr(packed(2))]
|
||||
13 | | struct PackedN {
|
||||
14 | | #[pin]
|
||||
15 | | field: u32,
|
||||
16 | | }
|
||||
17 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
|
||||
= note: this error originates in the macro `$crate::__pin_project_struct_make_proj_method` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0793]: reference to packed field is unaligned
|
||||
--> tests/ui/pin_project/packed.rs:11:1
|
||||
|
|
||||
11 | / pin_project! { //~ ERROR reference to packed field is unaligned
|
||||
12 | | #[repr(packed(2))]
|
||||
13 | | struct PackedN {
|
||||
14 | | #[pin]
|
||||
15 | | field: u32,
|
||||
16 | | }
|
||||
17 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
|
||||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
|
||||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
|
||||
= note: this error originates in the macro `$crate::__pin_project_constant` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
12
third-party/vendor/pin-project-lite/tests/ui/pin_project/unpin_sneaky.rs
vendored
Normal file
12
third-party/vendor/pin-project-lite/tests/ui/pin_project/unpin_sneaky.rs
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
struct Foo {
|
||||
#[pin]
|
||||
inner: u8,
|
||||
}
|
||||
}
|
||||
|
||||
impl Unpin for __Origin {} //~ ERROR E0412,E0321
|
||||
|
||||
fn main() {}
|
||||
5
third-party/vendor/pin-project-lite/tests/ui/pin_project/unpin_sneaky.stderr
vendored
Normal file
5
third-party/vendor/pin-project-lite/tests/ui/pin_project/unpin_sneaky.stderr
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
error[E0412]: cannot find type `__Origin` in this scope
|
||||
--> tests/ui/pin_project/unpin_sneaky.rs:10:16
|
||||
|
|
||||
10 | impl Unpin for __Origin {} //~ ERROR E0412,E0321
|
||||
| ^^^^^^^^ not found in this scope
|
||||
27
third-party/vendor/pin-project-lite/tests/ui/pin_project/unsupported.rs
vendored
Normal file
27
third-party/vendor/pin-project-lite/tests/ui/pin_project/unsupported.rs
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
struct Struct1 {} //~ ERROR no rules expected the token `}`
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Struct2(); //~ ERROR no rules expected the token `(`
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
struct Struct3; //~ ERROR no rules expected the token `;`
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
enum Enum { //~ ERROR no rules expected the token `enum`
|
||||
A(u8)
|
||||
}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
union Union { //~ ERROR no rules expected the token `union`
|
||||
x: u8,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
115
third-party/vendor/pin-project-lite/tests/ui/pin_project/unsupported.stderr
vendored
Normal file
115
third-party/vendor/pin-project-lite/tests/ui/pin_project/unsupported.stderr
vendored
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
error: no rules expected the token `}`
|
||||
--> tests/ui/pin_project/unsupported.rs:3:1
|
||||
|
|
||||
3 | / pin_project! {
|
||||
4 | | struct Struct1 {} //~ ERROR no rules expected the token `}`
|
||||
5 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match meta-variable `$field_vis:vis`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| $field_vis:vis $field:ident: $field_ty:ty
|
||||
| ^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `$crate::__pin_project_expand` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `}`
|
||||
--> tests/ui/pin_project/unsupported.rs:3:1
|
||||
|
|
||||
3 | / pin_project! {
|
||||
4 | | struct Struct1 {} //~ ERROR no rules expected the token `}`
|
||||
5 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match meta-variable `$field_vis:vis`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| $field_vis:vis $field:ident: $field_ty:ty
|
||||
| ^^^^^^^^^^^^^^
|
||||
= note: this error originates in the macro `$crate::__pin_project_expand` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `(`
|
||||
--> tests/ui/pin_project/unsupported.rs:8:19
|
||||
|
|
||||
8 | struct Struct2(); //~ ERROR no rules expected the token `(`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `{`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| {
|
||||
| ^
|
||||
|
||||
error: no rules expected the token `;`
|
||||
--> tests/ui/pin_project/unsupported.rs:12:19
|
||||
|
|
||||
12 | struct Struct3; //~ ERROR no rules expected the token `;`
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `{`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| {
|
||||
| ^
|
||||
|
||||
error: no rules expected the token `(`
|
||||
--> tests/ui/pin_project/unsupported.rs:17:10
|
||||
|
|
||||
17 | A(u8)
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `}`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| }
|
||||
| ^
|
||||
|
||||
error: no rules expected the token `(`
|
||||
--> tests/ui/pin_project/unsupported.rs:17:10
|
||||
|
|
||||
17 | A(u8)
|
||||
| ^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `}`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| }
|
||||
| ^
|
||||
|
||||
error: no rules expected the token `union`
|
||||
--> tests/ui/pin_project/unsupported.rs:21:1
|
||||
|
|
||||
21 | / pin_project! {
|
||||
22 | | union Union { //~ ERROR no rules expected the token `union`
|
||||
23 | | x: u8,
|
||||
24 | | }
|
||||
25 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `struct`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| [$(#[$attrs:meta])* $vis:vis struct $ident:ident]
|
||||
| ^^^^^^
|
||||
= note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
|
||||
= note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
|
||||
= note: this error originates in the macro `$crate::__pin_project_expand` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: no rules expected the token `union`
|
||||
--> tests/ui/pin_project/unsupported.rs:21:1
|
||||
|
|
||||
21 | / pin_project! {
|
||||
22 | | union Union { //~ ERROR no rules expected the token `union`
|
||||
23 | | x: u8,
|
||||
24 | | }
|
||||
25 | | }
|
||||
| |_^ no rules expected this token in macro call
|
||||
|
|
||||
note: while trying to match `struct`
|
||||
--> src/lib.rs
|
||||
|
|
||||
| [$(#[$attrs:meta])* $vis:vis struct $ident:ident]
|
||||
| ^^^^^^
|
||||
= note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
|
||||
= note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
|
||||
= note: this error originates in the macro `$crate::__pin_project_expand` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
17
third-party/vendor/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.rs
vendored
Normal file
17
third-party/vendor/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.rs
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
pub struct S {
|
||||
#[pin]
|
||||
field: u8,
|
||||
}
|
||||
impl PinnedDrop for S {
|
||||
fn drop(this: Pin<&mut Self>) {
|
||||
__drop_inner(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _x = S { field: 0 };
|
||||
}
|
||||
21
third-party/vendor/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.stderr
vendored
Normal file
21
third-party/vendor/pin-project-lite/tests/ui/pinned_drop/call-drop-inner.stderr
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
error[E0061]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> tests/ui/pinned_drop/call-drop-inner.rs:10:13
|
||||
|
|
||||
10 | __drop_inner(this);
|
||||
| ^^^^^^^^^^^^ ----
|
||||
| |
|
||||
| unexpected argument of type `Pin<&mut S>`
|
||||
| help: remove the extra argument
|
||||
|
|
||||
note: function defined here
|
||||
--> tests/ui/pinned_drop/call-drop-inner.rs:3:1
|
||||
|
|
||||
3 | / pin_project! {
|
||||
4 | | pub struct S {
|
||||
5 | | #[pin]
|
||||
6 | | field: u8,
|
||||
... |
|
||||
12 | | }
|
||||
13 | | }
|
||||
| |_^
|
||||
= note: this error originates in the macro `$crate::__pin_project_make_drop_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
26
third-party/vendor/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.rs
vendored
Normal file
26
third-party/vendor/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.rs
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
use pin_project_lite::pin_project;
|
||||
|
||||
// In `Drop` impl, the implementor must specify the same requirement as type definition.
|
||||
|
||||
struct DropImpl<T> {
|
||||
f: T,
|
||||
}
|
||||
|
||||
impl<T: Unpin> Drop for DropImpl<T> {
|
||||
//~^ ERROR E0367
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
pin_project! {
|
||||
//~^ ERROR E0367
|
||||
struct PinnedDropImpl<T> {
|
||||
#[pin]
|
||||
f: T,
|
||||
}
|
||||
|
||||
impl<T: Unpin> PinnedDrop for PinnedDropImpl<T> {
|
||||
fn drop(_this: Pin<&mut Self>) {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
36
third-party/vendor/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.stderr
vendored
Normal file
36
third-party/vendor/pin-project-lite/tests/ui/pinned_drop/conditional-drop-impl.stderr
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
|
||||
--> tests/ui/pinned_drop/conditional-drop-impl.rs:9:9
|
||||
|
|
||||
9 | impl<T: Unpin> Drop for DropImpl<T> {
|
||||
| ^^^^^
|
||||
|
|
||||
note: the implementor must specify the same requirement
|
||||
--> tests/ui/pinned_drop/conditional-drop-impl.rs:5:1
|
||||
|
|
||||
5 | struct DropImpl<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0367]: `Drop` impl requires `T: Unpin` but the struct it is implemented for does not
|
||||
--> tests/ui/pinned_drop/conditional-drop-impl.rs:14:1
|
||||
|
|
||||
14 | / pin_project! {
|
||||
15 | | //~^ ERROR E0367
|
||||
16 | | struct PinnedDropImpl<T> {
|
||||
17 | | #[pin]
|
||||
... |
|
||||
23 | | }
|
||||
24 | | }
|
||||
| |_^
|
||||
|
|
||||
note: the implementor must specify the same requirement
|
||||
--> tests/ui/pinned_drop/conditional-drop-impl.rs:14:1
|
||||
|
|
||||
14 | / pin_project! {
|
||||
15 | | //~^ ERROR E0367
|
||||
16 | | struct PinnedDropImpl<T> {
|
||||
17 | | #[pin]
|
||||
... |
|
||||
23 | | }
|
||||
24 | | }
|
||||
| |_^
|
||||
= note: this error originates in the macro `$crate::__pin_project_make_drop_impl` which comes from the expansion of the macro `pin_project` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
Loading…
Add table
Add a link
Reference in a new issue