Rename #[pin_project] to #[pin_v2] to avoid naming conflicts
This commit is contained in:
parent
b36f15e840
commit
ace83458a4
25 changed files with 535 additions and 535 deletions
|
|
@ -48,7 +48,7 @@ pub(crate) mod must_use;
|
|||
pub(crate) mod no_implicit_prelude;
|
||||
pub(crate) mod non_exhaustive;
|
||||
pub(crate) mod path;
|
||||
pub(crate) mod pin_project;
|
||||
pub(crate) mod pin_v2;
|
||||
pub(crate) mod proc_macro_attrs;
|
||||
pub(crate) mod prototype;
|
||||
pub(crate) mod repr;
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@ use crate::context::Stage;
|
|||
use crate::target_checking::AllowedTargets;
|
||||
use crate::target_checking::Policy::Allow;
|
||||
|
||||
pub(crate) struct PinProjectParser;
|
||||
pub(crate) struct PinV2Parser;
|
||||
|
||||
impl<S: Stage> NoArgsAttributeParser<S> for PinProjectParser {
|
||||
const PATH: &[Symbol] = &[sym::pin_project];
|
||||
impl<S: Stage> NoArgsAttributeParser<S> for PinV2Parser {
|
||||
const PATH: &[Symbol] = &[sym::pin_v2];
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
|
||||
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
|
||||
Allow(Target::Enum),
|
||||
Allow(Target::Struct),
|
||||
Allow(Target::Union),
|
||||
]);
|
||||
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PinProject;
|
||||
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PinV2;
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ use crate::attributes::must_use::MustUseParser;
|
|||
use crate::attributes::no_implicit_prelude::NoImplicitPreludeParser;
|
||||
use crate::attributes::non_exhaustive::NonExhaustiveParser;
|
||||
use crate::attributes::path::PathParser as PathAttributeParser;
|
||||
use crate::attributes::pin_project::PinProjectParser;
|
||||
use crate::attributes::pin_v2::PinV2Parser;
|
||||
use crate::attributes::proc_macro_attrs::{
|
||||
ProcMacroAttributeParser, ProcMacroDeriveParser, ProcMacroParser, RustcBuiltinMacroParser,
|
||||
};
|
||||
|
|
@ -234,7 +234,7 @@ attribute_parsers!(
|
|||
Single<WithoutArgs<NonExhaustiveParser>>,
|
||||
Single<WithoutArgs<ParenSugarParser>>,
|
||||
Single<WithoutArgs<PassByValueParser>>,
|
||||
Single<WithoutArgs<PinProjectParser>>,
|
||||
Single<WithoutArgs<PinV2Parser>>,
|
||||
Single<WithoutArgs<PointeeParser>>,
|
||||
Single<WithoutArgs<ProcMacroAttributeParser>>,
|
||||
Single<WithoutArgs<ProcMacroParser>>,
|
||||
|
|
|
|||
|
|
@ -893,13 +893,13 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||
EncodeCrossCrate::No, loop_match, experimental!(loop_match)
|
||||
),
|
||||
|
||||
// The `#[pin_project]` attribute is part of the `pin_ergonomics` experiment
|
||||
// The `#[pin_v2]` attribute is part of the `pin_ergonomics` experiment
|
||||
// that allows structurally pinning, tracked in:
|
||||
//
|
||||
// - https://github.com/rust-lang/rust/issues/130494
|
||||
gated!(
|
||||
pin_project, Normal, template!(Word), ErrorFollowing,
|
||||
EncodeCrossCrate::Yes, pin_ergonomics, experimental!(pin_project),
|
||||
pin_v2, Normal, template!(Word), ErrorFollowing,
|
||||
EncodeCrossCrate::Yes, pin_ergonomics, experimental!(pin_v2),
|
||||
),
|
||||
|
||||
// ==========================================================================
|
||||
|
|
|
|||
|
|
@ -637,8 +637,8 @@ pub enum AttributeKind {
|
|||
/// Represents `#[pattern_complexity_limit]`
|
||||
PatternComplexityLimit { attr_span: Span, limit_span: Span, limit: Limit },
|
||||
|
||||
/// Represents `#[pin_project]`
|
||||
PinProject(Span),
|
||||
/// Represents `#[pin_v2]`
|
||||
PinV2(Span),
|
||||
|
||||
/// Represents `#[pointee]`
|
||||
Pointee(Span),
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ impl AttributeKind {
|
|||
PassByValue(..) => Yes,
|
||||
Path(..) => No,
|
||||
PatternComplexityLimit { .. } => No,
|
||||
PinProject(..) => Yes,
|
||||
PinV2(..) => Yes,
|
||||
Pointee(..) => No,
|
||||
ProcMacro(..) => No,
|
||||
ProcMacroAttribute(..) => No,
|
||||
|
|
|
|||
|
|
@ -227,9 +227,9 @@ hir_typeck_pass_to_variadic_function = can't pass `{$ty}` to variadic function
|
|||
.suggestion = cast the value to `{$cast_ty}`
|
||||
.teach_help = certain types, like `{$ty}`, must be cast before passing them to a variadic function to match the implicit cast that a C compiler would perform as part of C's numeric promotion rules
|
||||
|
||||
hir_typeck_project_on_non_pin_project_type = cannot project on type that is not `#[pin_project]`
|
||||
hir_typeck_project_on_non_pin_project_type = cannot project on type that is not `#[pin_v2]`
|
||||
.note = type defined here
|
||||
.suggestion = add `#[pin_project]` here
|
||||
.suggestion = add `#[pin_v2]` here
|
||||
|
||||
hir_typeck_ptr_cast_add_auto_to_object = cannot add {$traits_len ->
|
||||
[1] auto trait {$traits}
|
||||
|
|
|
|||
|
|
@ -1164,6 +1164,6 @@ pub(crate) struct ProjectOnNonPinProjectType {
|
|||
pub span: Span,
|
||||
#[note]
|
||||
pub def_span: Option<Span>,
|
||||
#[suggestion(code = "#[pin_project]\n", applicability = "machine-applicable")]
|
||||
#[suggestion(code = "#[pin_v2]\n", applicability = "machine-applicable")]
|
||||
pub sugg_span: Option<Span>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -555,7 +555,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
debug!("scrutinee ty {expected:?} is a pinned reference, inserting pin deref");
|
||||
|
||||
// if the inner_ty is an ADT, make sure that it can be structurally pinned
|
||||
// (i.e., it is `#[pin_project]`).
|
||||
// (i.e., it is `#[pin_v2]`).
|
||||
if let Some(adt) = inner_ty.ty_adt_def()
|
||||
&& !adt.is_pin_project()
|
||||
&& !adt.is_pin()
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ impl AdtDefData {
|
|||
debug!("found non-exhaustive variant list for {:?}", did);
|
||||
flags = flags | AdtFlags::IS_VARIANT_LIST_NON_EXHAUSTIVE;
|
||||
}
|
||||
if find_attr!(tcx.get_all_attrs(did), AttributeKind::PinProject(..)) {
|
||||
if find_attr!(tcx.get_all_attrs(did), AttributeKind::PinV2(..)) {
|
||||
debug!("found pin-project type {:?}", did);
|
||||
flags |= AdtFlags::IS_PIN_PROJECT;
|
||||
}
|
||||
|
|
@ -445,7 +445,7 @@ impl<'tcx> AdtDef<'tcx> {
|
|||
self.flags().contains(AdtFlags::IS_PIN)
|
||||
}
|
||||
|
||||
/// Returns `true` is this is `#[pin_project]` for the purposes
|
||||
/// Returns `true` is this is `#[pin_v2]` for the purposes
|
||||
/// of structural pinning.
|
||||
#[inline]
|
||||
pub fn is_pin_project(self) -> bool {
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
| AttributeKind::RustcCoherenceIsCore(..)
|
||||
| AttributeKind::DebuggerVisualizer(..)
|
||||
| AttributeKind::RustcMain
|
||||
| AttributeKind::PinProject(..),
|
||||
| AttributeKind::PinV2(..),
|
||||
) => { /* do nothing */ }
|
||||
Attribute::Unparsed(attr_item) => {
|
||||
style = Some(attr_item.style);
|
||||
|
|
|
|||
|
|
@ -1667,7 +1667,7 @@ symbols! {
|
|||
pin,
|
||||
pin_ergonomics,
|
||||
pin_macro,
|
||||
pin_project,
|
||||
pin_v2,
|
||||
platform_intrinsics,
|
||||
plugin,
|
||||
plugin_registrar,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::pin::Pin;
|
||||
|
||||
#[pin_project] //~ ERROR the `#[pin_project]` attribute is an experimental feature
|
||||
#[pin_v2] //~ ERROR the `#[pin_v2]` attribute is an experimental feature
|
||||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
|
|
@ -51,7 +51,7 @@ fn borrows() {
|
|||
mod not_compiled {
|
||||
use std::pin::Pin;
|
||||
|
||||
#[pin_project]
|
||||
#[pin_v2]
|
||||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
|
|
|
|||
|
|
@ -148,11 +148,11 @@ LL | let x: Pin<&_> = &pin const Foo;
|
|||
= help: add `#![feature(pin_ergonomics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the `#[pin_project]` attribute is an experimental feature
|
||||
error[E0658]: the `#[pin_v2]` attribute is an experimental feature
|
||||
--> $DIR/feature-gate-pin_ergonomics.rs:5:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information
|
||||
= help: add `#![feature(pin_ergonomics)]` to the crate attributes to enable
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@
|
|||
|
||||
use std::pin::Pin;
|
||||
|
||||
#[cfg_attr(pin_ergonomics, pin_project)]
|
||||
#[cfg_attr(pin_ergonomics, pin_v2)]
|
||||
struct Foo<T, U> {
|
||||
x: T,
|
||||
y: U,
|
||||
}
|
||||
|
||||
#[cfg_attr(pin_ergonomics, pin_project)]
|
||||
#[cfg_attr(pin_ergonomics, pin_v2)]
|
||||
struct Bar<T, U>(T, U);
|
||||
|
||||
#[cfg_attr(pin_ergonomics, pin_project)]
|
||||
#[cfg_attr(pin_ergonomics, pin_v2)]
|
||||
enum Baz<T, U> {
|
||||
Foo(T, U),
|
||||
Bar { x: T, y: U },
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: cannot project on type that is not `#[pin_project]`
|
||||
error: cannot project on type that is not `#[pin_v2]`
|
||||
--> $DIR/pattern-matching-mix-deref-pattern.rs:121:9
|
||||
|
|
||||
LL | let NonPinProject { x } = foo;
|
||||
|
|
@ -9,13 +9,13 @@ note: type defined here
|
|||
|
|
||||
LL | struct NonPinProject<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: add `#[pin_project]` here
|
||||
help: add `#[pin_v2]` here
|
||||
|
|
||||
LL + #[pin_project]
|
||||
LL + #[pin_v2]
|
||||
LL | struct NonPinProject<T> {
|
||||
|
|
||||
|
||||
error: cannot project on type that is not `#[pin_project]`
|
||||
error: cannot project on type that is not `#[pin_v2]`
|
||||
--> $DIR/pattern-matching-mix-deref-pattern.rs:125:9
|
||||
|
|
||||
LL | let NonPinProject { x } = bar;
|
||||
|
|
@ -26,13 +26,13 @@ note: type defined here
|
|||
|
|
||||
LL | struct NonPinProject<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: add `#[pin_project]` here
|
||||
help: add `#[pin_v2]` here
|
||||
|
|
||||
LL + #[pin_project]
|
||||
LL + #[pin_v2]
|
||||
LL | struct NonPinProject<T> {
|
||||
|
|
||||
|
||||
error: cannot project on type that is not `#[pin_project]`
|
||||
error: cannot project on type that is not `#[pin_v2]`
|
||||
--> $DIR/pattern-matching-mix-deref-pattern.rs:131:9
|
||||
|
|
||||
LL | NonPinProject { x } => {}
|
||||
|
|
@ -43,13 +43,13 @@ note: type defined here
|
|||
|
|
||||
LL | struct NonPinProject<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: add `#[pin_project]` here
|
||||
help: add `#[pin_v2]` here
|
||||
|
|
||||
LL + #[pin_project]
|
||||
LL + #[pin_v2]
|
||||
LL | struct NonPinProject<T> {
|
||||
|
|
||||
|
||||
error: cannot project on type that is not `#[pin_project]`
|
||||
error: cannot project on type that is not `#[pin_v2]`
|
||||
--> $DIR/pattern-matching-mix-deref-pattern.rs:139:9
|
||||
|
|
||||
LL | NonPinProject { x } => {}
|
||||
|
|
@ -60,9 +60,9 @@ note: type defined here
|
|||
|
|
||||
LL | struct NonPinProject<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: add `#[pin_project]` here
|
||||
help: add `#[pin_v2]` here
|
||||
|
|
||||
LL + #[pin_project]
|
||||
LL + #[pin_v2]
|
||||
LL | struct NonPinProject<T> {
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: cannot project on type that is not `#[pin_project]`
|
||||
error: cannot project on type that is not `#[pin_v2]`
|
||||
--> $DIR/pattern-matching-mix-deref-pattern.rs:121:9
|
||||
|
|
||||
LL | let NonPinProject { x } = foo;
|
||||
|
|
@ -9,13 +9,13 @@ note: type defined here
|
|||
|
|
||||
LL | struct NonPinProject<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: add `#[pin_project]` here
|
||||
help: add `#[pin_v2]` here
|
||||
|
|
||||
LL + #[pin_project]
|
||||
LL + #[pin_v2]
|
||||
LL | struct NonPinProject<T> {
|
||||
|
|
||||
|
||||
error: cannot project on type that is not `#[pin_project]`
|
||||
error: cannot project on type that is not `#[pin_v2]`
|
||||
--> $DIR/pattern-matching-mix-deref-pattern.rs:125:9
|
||||
|
|
||||
LL | let NonPinProject { x } = bar;
|
||||
|
|
@ -26,13 +26,13 @@ note: type defined here
|
|||
|
|
||||
LL | struct NonPinProject<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: add `#[pin_project]` here
|
||||
help: add `#[pin_v2]` here
|
||||
|
|
||||
LL + #[pin_project]
|
||||
LL + #[pin_v2]
|
||||
LL | struct NonPinProject<T> {
|
||||
|
|
||||
|
||||
error: cannot project on type that is not `#[pin_project]`
|
||||
error: cannot project on type that is not `#[pin_v2]`
|
||||
--> $DIR/pattern-matching-mix-deref-pattern.rs:131:9
|
||||
|
|
||||
LL | NonPinProject { x } => {}
|
||||
|
|
@ -43,13 +43,13 @@ note: type defined here
|
|||
|
|
||||
LL | struct NonPinProject<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: add `#[pin_project]` here
|
||||
help: add `#[pin_v2]` here
|
||||
|
|
||||
LL + #[pin_project]
|
||||
LL + #[pin_v2]
|
||||
LL | struct NonPinProject<T> {
|
||||
|
|
||||
|
||||
error: cannot project on type that is not `#[pin_project]`
|
||||
error: cannot project on type that is not `#[pin_v2]`
|
||||
--> $DIR/pattern-matching-mix-deref-pattern.rs:139:9
|
||||
|
|
||||
LL | NonPinProject { x } => {}
|
||||
|
|
@ -60,9 +60,9 @@ note: type defined here
|
|||
|
|
||||
LL | struct NonPinProject<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: add `#[pin_project]` here
|
||||
help: add `#[pin_v2]` here
|
||||
|
|
||||
LL + #[pin_project]
|
||||
LL + #[pin_v2]
|
||||
LL | struct NonPinProject<T> {
|
||||
|
|
||||
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@
|
|||
|
||||
use std::pin::Pin;
|
||||
|
||||
#[cfg_attr(any(pin_ergonomics, both), pin_project)]
|
||||
#[cfg_attr(any(pin_ergonomics, both), pin_v2)]
|
||||
struct Foo<T, U> {
|
||||
x: T,
|
||||
y: U,
|
||||
}
|
||||
|
||||
#[cfg_attr(any(pin_ergonomics, both), pin_project)]
|
||||
#[cfg_attr(any(pin_ergonomics, both), pin_v2)]
|
||||
struct Bar<T, U>(T, U);
|
||||
|
||||
#[cfg_attr(any(pin_ergonomics, both), pin_project)]
|
||||
#[cfg_attr(any(pin_ergonomics, both), pin_v2)]
|
||||
enum Baz<T, U> {
|
||||
Foo(T, U),
|
||||
Bar { x: T, y: U },
|
||||
|
|
@ -120,27 +120,27 @@ fn bar_const<T: Unpin, U: Unpin>(bar: Pin<&Bar<T, U>>) {
|
|||
fn non_pin_project<T, U: Unpin>(foo: Pin<&mut NonPinProject<T>>, bar: Pin<&NonPinProject<U>>) {
|
||||
let NonPinProject { x } = foo;
|
||||
//[normal]~^ ERROR mismatched types
|
||||
//[pin_ergonomics]~^^ ERROR cannot project on type that is not `#[pin_project]`
|
||||
//[both]~^^^ ERROR cannot project on type that is not `#[pin_project]`
|
||||
//[pin_ergonomics]~^^ ERROR cannot project on type that is not `#[pin_v2]`
|
||||
//[both]~^^^ ERROR cannot project on type that is not `#[pin_v2]`
|
||||
let NonPinProject { x } = bar;
|
||||
//[normal]~^ ERROR mismatched types
|
||||
//[pin_ergonomics]~^^ ERROR cannot project on type that is not `#[pin_project]`
|
||||
//[both]~^^^ ERROR cannot project on type that is not `#[pin_project]`
|
||||
//[pin_ergonomics]~^^ ERROR cannot project on type that is not `#[pin_v2]`
|
||||
//[both]~^^^ ERROR cannot project on type that is not `#[pin_v2]`
|
||||
|
||||
match foo {
|
||||
NonPinProject { x } => {}
|
||||
//[normal]~^ ERROR mismatched types
|
||||
//[deref_patterns]~^^ ERROR mix of deref patterns and normal constructors
|
||||
//[pin_ergonomics]~^^^ ERROR cannot project on type that is not `#[pin_project]`
|
||||
//[both]~^^^^ ERROR cannot project on type that is not `#[pin_project]`
|
||||
//[pin_ergonomics]~^^^ ERROR cannot project on type that is not `#[pin_v2]`
|
||||
//[both]~^^^^ ERROR cannot project on type that is not `#[pin_v2]`
|
||||
Pin { .. } => {}
|
||||
}
|
||||
match bar {
|
||||
NonPinProject { x } => {}
|
||||
//[normal]~^ ERROR mismatched types
|
||||
//[deref_patterns]~^^ ERROR mix of deref patterns and normal constructors
|
||||
//[pin_ergonomics]~^^^ ERROR cannot project on type that is not `#[pin_project]`
|
||||
//[both]~^^^^ ERROR cannot project on type that is not `#[pin_project]`
|
||||
//[pin_ergonomics]~^^^ ERROR cannot project on type that is not `#[pin_v2]`
|
||||
//[both]~^^^^ ERROR cannot project on type that is not `#[pin_v2]`
|
||||
Pin { .. } => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
error[E0658]: the `#[pin_project]` attribute is an experimental feature
|
||||
error[E0658]: the `#[pin_v2]` attribute is an experimental feature
|
||||
--> $DIR/pattern-matching.rs:12:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information
|
||||
= help: add `#![feature(pin_ergonomics)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the `#[pin_project]` attribute is an experimental feature
|
||||
error[E0658]: the `#[pin_v2]` attribute is an experimental feature
|
||||
--> $DIR/pattern-matching.rs:18:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information
|
||||
= help: add `#![feature(pin_ergonomics)]` to the crate attributes to enable
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@
|
|||
use std::pin::Pin;
|
||||
|
||||
// This test verifies that a `&pin mut T` can be projected to a pinned
|
||||
// reference field `&pin mut T.U` when `T` is marked with `#[pin_project]`.
|
||||
// reference field `&pin mut T.U` when `T` is marked with `#[pin_v2]`.
|
||||
|
||||
#[pin_project] //[normal]~ ERROR the `#[pin_project]` attribute is an experimental feature
|
||||
#[pin_v2] //[normal]~ ERROR the `#[pin_v2]` attribute is an experimental feature
|
||||
struct Foo<T, U> {
|
||||
x: T,
|
||||
y: U,
|
||||
}
|
||||
|
||||
#[pin_project] //[normal]~ ERROR the `#[pin_project]` attribute is an experimental feature
|
||||
#[pin_v2] //[normal]~ ERROR the `#[pin_v2]` attribute is an experimental feature
|
||||
enum Bar<T, U> {
|
||||
Foo(T, U),
|
||||
Bar { x: T, y: U },
|
||||
|
|
|
|||
|
|
@ -1,144 +0,0 @@
|
|||
#![feature(
|
||||
pin_ergonomics,
|
||||
where_clause_attrs,
|
||||
trait_alias,
|
||||
extern_types,
|
||||
associated_type_defaults,
|
||||
fn_delegation,
|
||||
)]
|
||||
#![allow(incomplete_features)]
|
||||
#![pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on crates
|
||||
|
||||
// allowed
|
||||
|
||||
#[pin_project]
|
||||
struct Struct {}
|
||||
|
||||
#[pin_project]
|
||||
enum Enum {}
|
||||
|
||||
#[pin_project]
|
||||
union Union {
|
||||
field: (),
|
||||
}
|
||||
|
||||
// disallowed
|
||||
|
||||
enum Foo<#[pin_project] T, #[pin_project] U = ()> {
|
||||
//~^ ERROR `#[pin_project]` attribute cannot be used on function params
|
||||
//~| ERROR `#[pin_project]` attribute cannot be used on function params
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on enum variants
|
||||
UnitVariant,
|
||||
TupleVariant(#[pin_project] T), //~ ERROR `#[pin_project]` attribute cannot be used on struct fields
|
||||
StructVariant {
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on struct fields
|
||||
field: U,
|
||||
},
|
||||
}
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on traits
|
||||
trait Trait {
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on associated consts
|
||||
const ASSOC_CONST: () = ();
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on associated types
|
||||
type AssocType = ();
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on required trait methods
|
||||
fn method();
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on provided trait methods
|
||||
fn method_with_body() {}
|
||||
}
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on trait aliases
|
||||
trait TraitAlias = Trait;
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on inherent impl blocks
|
||||
impl Struct {
|
||||
// FIXME: delegation macros are not tested yet (how to?)
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on delegations
|
||||
reuse <Struct as std::any::Any>::type_id;
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on inherent methods
|
||||
fn method() {}
|
||||
}
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on trait impl blocks
|
||||
impl Trait for Enum {
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on trait methods in impl blocks
|
||||
fn method() {}
|
||||
}
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on extern crates
|
||||
extern crate alloc;
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on use statements
|
||||
use std::pin::Pin;
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on statics
|
||||
static STATIC: () = ();
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on constants
|
||||
const CONST: () = ();
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on functions
|
||||
fn f<T, U>(#[pin_project] param: Foo<T, U>)
|
||||
//~^ ERROR `#[pin_project]` attribute cannot be used on function params
|
||||
//~| ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
|
||||
where
|
||||
#[pin_project]
|
||||
//~^ ERROR `#[pin_project]` attribute cannot be used on where predicates
|
||||
T:,
|
||||
{
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on closures
|
||||
|| ();
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on expressions
|
||||
[(), (), ()];
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on statements
|
||||
let _: Foo<(), ()> = Foo::StructVariant {
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on struct fields
|
||||
field: (),
|
||||
};
|
||||
match param {
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on match arms
|
||||
Foo::UnitVariant => {}
|
||||
Foo::TupleVariant(..) => {}
|
||||
Foo::StructVariant {
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on pattern fields
|
||||
field,
|
||||
} => {}
|
||||
}
|
||||
}
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on modules
|
||||
mod m {}
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on foreign modules
|
||||
extern "C" {
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on foreign types
|
||||
type ForeignTy;
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on foreign statics
|
||||
static EXTERN_STATIC: ();
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on foreign functions
|
||||
fn extern_fn();
|
||||
}
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on type alias
|
||||
type Type = ();
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on macro defs
|
||||
macro_rules! macro_def {
|
||||
() => {};
|
||||
}
|
||||
|
||||
#[pin_project] //~ ERROR `#[pin_project]` attribute cannot be used on macro calls
|
||||
macro_def!();
|
||||
|
||||
std::arch::global_asm! {
|
||||
"{}",
|
||||
#[pin_project] //~ ERROR this attribute is not supported on assembly
|
||||
const 0
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,318 +0,0 @@
|
|||
error: `#[pin_project]` attribute cannot be used on macro calls
|
||||
--> $DIR/pin_project-attr.rs:135:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: this attribute is not supported on assembly
|
||||
--> $DIR/pin_project-attr.rs:140:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
|
||||
--> $DIR/pin_project-attr.rs:84:12
|
||||
|
|
||||
LL | fn f<T, U>(#[pin_project] param: Foo<T, U>)
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on crates
|
||||
--> $DIR/pin_project-attr.rs:10:1
|
||||
|
|
||||
LL | #![pin_project]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on function params
|
||||
--> $DIR/pin_project-attr.rs:27:10
|
||||
|
|
||||
LL | enum Foo<#[pin_project] T, #[pin_project] U = ()> {
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on function params
|
||||
--> $DIR/pin_project-attr.rs:27:28
|
||||
|
|
||||
LL | enum Foo<#[pin_project] T, #[pin_project] U = ()> {
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on enum variants
|
||||
--> $DIR/pin_project-attr.rs:30:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on struct fields
|
||||
--> $DIR/pin_project-attr.rs:32:18
|
||||
|
|
||||
LL | TupleVariant(#[pin_project] T),
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on struct fields
|
||||
--> $DIR/pin_project-attr.rs:34:9
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on traits
|
||||
--> $DIR/pin_project-attr.rs:39:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on associated consts
|
||||
--> $DIR/pin_project-attr.rs:41:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on associated types
|
||||
--> $DIR/pin_project-attr.rs:43:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on required trait methods
|
||||
--> $DIR/pin_project-attr.rs:46:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on provided trait methods
|
||||
--> $DIR/pin_project-attr.rs:48:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on trait aliases
|
||||
--> $DIR/pin_project-attr.rs:52:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on inherent impl blocks
|
||||
--> $DIR/pin_project-attr.rs:55:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on delegations
|
||||
--> $DIR/pin_project-attr.rs:58:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on inherent methods
|
||||
--> $DIR/pin_project-attr.rs:61:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on trait impl blocks
|
||||
--> $DIR/pin_project-attr.rs:65:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on trait methods in impl blocks
|
||||
--> $DIR/pin_project-attr.rs:67:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on extern crates
|
||||
--> $DIR/pin_project-attr.rs:71:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on use statements
|
||||
--> $DIR/pin_project-attr.rs:74:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on statics
|
||||
--> $DIR/pin_project-attr.rs:77:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on constants
|
||||
--> $DIR/pin_project-attr.rs:80:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on functions
|
||||
--> $DIR/pin_project-attr.rs:83:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on function params
|
||||
--> $DIR/pin_project-attr.rs:84:12
|
||||
|
|
||||
LL | fn f<T, U>(#[pin_project] param: Foo<T, U>)
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on closures
|
||||
--> $DIR/pin_project-attr.rs:92:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on expressions
|
||||
--> $DIR/pin_project-attr.rs:94:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on struct fields
|
||||
--> $DIR/pin_project-attr.rs:98:9
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on statements
|
||||
--> $DIR/pin_project-attr.rs:96:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on match arms
|
||||
--> $DIR/pin_project-attr.rs:102:9
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on pattern fields
|
||||
--> $DIR/pin_project-attr.rs:106:13
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on where predicates
|
||||
--> $DIR/pin_project-attr.rs:88:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on modules
|
||||
--> $DIR/pin_project-attr.rs:112:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on foreign modules
|
||||
--> $DIR/pin_project-attr.rs:115:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on foreign types
|
||||
--> $DIR/pin_project-attr.rs:117:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on foreign statics
|
||||
--> $DIR/pin_project-attr.rs:120:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on foreign functions
|
||||
--> $DIR/pin_project-attr.rs:123:5
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on type aliases
|
||||
--> $DIR/pin_project-attr.rs:127:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_project]` attribute cannot be used on macro defs
|
||||
--> $DIR/pin_project-attr.rs:130:1
|
||||
|
|
||||
LL | #[pin_project]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_project]` can be applied to data types and unions
|
||||
|
||||
error: aborting due to 40 previous errors
|
||||
|
||||
144
tests/ui/pin-ergonomics/pin_v2-attr.rs
Normal file
144
tests/ui/pin-ergonomics/pin_v2-attr.rs
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
#![feature(
|
||||
pin_ergonomics,
|
||||
where_clause_attrs,
|
||||
trait_alias,
|
||||
extern_types,
|
||||
associated_type_defaults,
|
||||
fn_delegation,
|
||||
)]
|
||||
#![allow(incomplete_features)]
|
||||
#![pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on crates
|
||||
|
||||
// allowed
|
||||
|
||||
#[pin_v2]
|
||||
struct Struct {}
|
||||
|
||||
#[pin_v2]
|
||||
enum Enum {}
|
||||
|
||||
#[pin_v2]
|
||||
union Union {
|
||||
field: (),
|
||||
}
|
||||
|
||||
// disallowed
|
||||
|
||||
enum Foo<#[pin_v2] T, #[pin_v2] U = ()> {
|
||||
//~^ ERROR `#[pin_v2]` attribute cannot be used on function params
|
||||
//~| ERROR `#[pin_v2]` attribute cannot be used on function params
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on enum variants
|
||||
UnitVariant,
|
||||
TupleVariant(#[pin_v2] T), //~ ERROR `#[pin_v2]` attribute cannot be used on struct fields
|
||||
StructVariant {
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on struct fields
|
||||
field: U,
|
||||
},
|
||||
}
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on traits
|
||||
trait Trait {
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on associated consts
|
||||
const ASSOC_CONST: () = ();
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on associated types
|
||||
type AssocType = ();
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on required trait methods
|
||||
fn method();
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on provided trait methods
|
||||
fn method_with_body() {}
|
||||
}
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on trait aliases
|
||||
trait TraitAlias = Trait;
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on inherent impl blocks
|
||||
impl Struct {
|
||||
// FIXME: delegation macros are not tested yet (how to?)
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on delegations
|
||||
reuse <Struct as std::any::Any>::type_id;
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on inherent methods
|
||||
fn method() {}
|
||||
}
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on trait impl blocks
|
||||
impl Trait for Enum {
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on trait methods in impl blocks
|
||||
fn method() {}
|
||||
}
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on extern crates
|
||||
extern crate alloc;
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on use statements
|
||||
use std::pin::Pin;
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on statics
|
||||
static STATIC: () = ();
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on constants
|
||||
const CONST: () = ();
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on functions
|
||||
fn f<T, U>(#[pin_v2] param: Foo<T, U>)
|
||||
//~^ ERROR `#[pin_v2]` attribute cannot be used on function params
|
||||
//~| ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
|
||||
where
|
||||
#[pin_v2]
|
||||
//~^ ERROR `#[pin_v2]` attribute cannot be used on where predicates
|
||||
T:,
|
||||
{
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on closures
|
||||
|| ();
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on expressions
|
||||
[(), (), ()];
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on statements
|
||||
let _: Foo<(), ()> = Foo::StructVariant {
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on struct fields
|
||||
field: (),
|
||||
};
|
||||
match param {
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on match arms
|
||||
Foo::UnitVariant => {}
|
||||
Foo::TupleVariant(..) => {}
|
||||
Foo::StructVariant {
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on pattern fields
|
||||
field,
|
||||
} => {}
|
||||
}
|
||||
}
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on modules
|
||||
mod m {}
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on foreign modules
|
||||
extern "C" {
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on foreign types
|
||||
type ForeignTy;
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on foreign statics
|
||||
static EXTERN_STATIC: ();
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on foreign functions
|
||||
fn extern_fn();
|
||||
}
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on type alias
|
||||
type Type = ();
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on macro defs
|
||||
macro_rules! macro_def {
|
||||
() => {};
|
||||
}
|
||||
|
||||
#[pin_v2] //~ ERROR `#[pin_v2]` attribute cannot be used on macro calls
|
||||
macro_def!();
|
||||
|
||||
std::arch::global_asm! {
|
||||
"{}",
|
||||
#[pin_v2] //~ ERROR this attribute is not supported on assembly
|
||||
const 0
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
318
tests/ui/pin-ergonomics/pin_v2-attr.stderr
Normal file
318
tests/ui/pin-ergonomics/pin_v2-attr.stderr
Normal file
|
|
@ -0,0 +1,318 @@
|
|||
error: `#[pin_v2]` attribute cannot be used on macro calls
|
||||
--> $DIR/pin_v2-attr.rs:135:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: this attribute is not supported on assembly
|
||||
--> $DIR/pin_v2-attr.rs:140:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
|
||||
--> $DIR/pin_v2-attr.rs:84:12
|
||||
|
|
||||
LL | fn f<T, U>(#[pin_v2] param: Foo<T, U>)
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on crates
|
||||
--> $DIR/pin_v2-attr.rs:10:1
|
||||
|
|
||||
LL | #![pin_v2]
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on function params
|
||||
--> $DIR/pin_v2-attr.rs:27:10
|
||||
|
|
||||
LL | enum Foo<#[pin_v2] T, #[pin_v2] U = ()> {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on function params
|
||||
--> $DIR/pin_v2-attr.rs:27:23
|
||||
|
|
||||
LL | enum Foo<#[pin_v2] T, #[pin_v2] U = ()> {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on enum variants
|
||||
--> $DIR/pin_v2-attr.rs:30:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on struct fields
|
||||
--> $DIR/pin_v2-attr.rs:32:18
|
||||
|
|
||||
LL | TupleVariant(#[pin_v2] T),
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on struct fields
|
||||
--> $DIR/pin_v2-attr.rs:34:9
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on traits
|
||||
--> $DIR/pin_v2-attr.rs:39:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on associated consts
|
||||
--> $DIR/pin_v2-attr.rs:41:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on associated types
|
||||
--> $DIR/pin_v2-attr.rs:43:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on required trait methods
|
||||
--> $DIR/pin_v2-attr.rs:46:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on provided trait methods
|
||||
--> $DIR/pin_v2-attr.rs:48:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on trait aliases
|
||||
--> $DIR/pin_v2-attr.rs:52:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on inherent impl blocks
|
||||
--> $DIR/pin_v2-attr.rs:55:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on delegations
|
||||
--> $DIR/pin_v2-attr.rs:58:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on inherent methods
|
||||
--> $DIR/pin_v2-attr.rs:61:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on trait impl blocks
|
||||
--> $DIR/pin_v2-attr.rs:65:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on trait methods in impl blocks
|
||||
--> $DIR/pin_v2-attr.rs:67:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on extern crates
|
||||
--> $DIR/pin_v2-attr.rs:71:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on use statements
|
||||
--> $DIR/pin_v2-attr.rs:74:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on statics
|
||||
--> $DIR/pin_v2-attr.rs:77:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on constants
|
||||
--> $DIR/pin_v2-attr.rs:80:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on functions
|
||||
--> $DIR/pin_v2-attr.rs:83:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on function params
|
||||
--> $DIR/pin_v2-attr.rs:84:12
|
||||
|
|
||||
LL | fn f<T, U>(#[pin_v2] param: Foo<T, U>)
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on closures
|
||||
--> $DIR/pin_v2-attr.rs:92:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on expressions
|
||||
--> $DIR/pin_v2-attr.rs:94:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on struct fields
|
||||
--> $DIR/pin_v2-attr.rs:98:9
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on statements
|
||||
--> $DIR/pin_v2-attr.rs:96:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on match arms
|
||||
--> $DIR/pin_v2-attr.rs:102:9
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on pattern fields
|
||||
--> $DIR/pin_v2-attr.rs:106:13
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on where predicates
|
||||
--> $DIR/pin_v2-attr.rs:88:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on modules
|
||||
--> $DIR/pin_v2-attr.rs:112:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on foreign modules
|
||||
--> $DIR/pin_v2-attr.rs:115:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on foreign types
|
||||
--> $DIR/pin_v2-attr.rs:117:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on foreign statics
|
||||
--> $DIR/pin_v2-attr.rs:120:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on foreign functions
|
||||
--> $DIR/pin_v2-attr.rs:123:5
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on type aliases
|
||||
--> $DIR/pin_v2-attr.rs:127:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: `#[pin_v2]` attribute cannot be used on macro defs
|
||||
--> $DIR/pin_v2-attr.rs:130:1
|
||||
|
|
||||
LL | #[pin_v2]
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: `#[pin_v2]` can be applied to data types and unions
|
||||
|
||||
error: aborting due to 40 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue