Stabilize attributes on generic parameters

This commit is contained in:
Vadim Petrochenkov 2018-03-08 22:24:10 +03:00
parent fb44b4c0eb
commit 1a2a23447e
29 changed files with 45 additions and 244 deletions

View File

@ -97,7 +97,7 @@
#![feature(fmt_internals)]
#![feature(from_ref)]
#![feature(fundamental)]
#![feature(generic_param_attrs)]
#![cfg_attr(stage0, feature(generic_param_attrs))]
#![cfg_attr(stage0, feature(i128_type))]
#![feature(iter_rfold)]
#![feature(lang_items)]

View File

@ -27,7 +27,7 @@
#![feature(alloc)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
#![feature(generic_param_attrs)]
#![cfg_attr(stage0, feature(generic_param_attrs))]
#![cfg_attr(test, feature(test))]
#![allow(deprecated)]

View File

@ -3784,7 +3784,6 @@ that impl must be declared as an `unsafe impl.
Erroneous code example:
```compile_fail,E0569
#![feature(generic_param_attrs)]
#![feature(dropck_eyepatch)]
struct Foo<X>(X);

View File

@ -266,7 +266,7 @@
#![feature(float_from_str_radix)]
#![feature(fn_traits)]
#![feature(fnbox)]
#![feature(generic_param_attrs)]
#![cfg_attr(stage0, feature(generic_param_attrs))]
#![feature(hashmap_internals)]
#![feature(heap_api)]
#![cfg_attr(stage0, feature(i128_type, i128))]

View File

@ -288,9 +288,6 @@ declare_features! (
// rustc internal
(active, compiler_builtins, "1.13.0", None, None),
// Allows attributes on lifetime/type formal parameters in generics (RFC 1327)
(active, generic_param_attrs, "1.11.0", Some(34761), None),
// Allows #[link(..., cfg(..))]
(active, link_cfg, "1.14.0", Some(37406), None),
@ -566,6 +563,8 @@ declare_features! (
(accepted, match_default_bindings, "1.26.0", Some(42640), None),
// allow `'_` placeholder lifetimes
(accepted, underscore_lifetimes, "1.26.0", Some(44524), None),
// Allows attributes on lifetime/type formal parameters in generics (RFC 1327)
(accepted, generic_param_attrs, "1.26.0", Some(48848), None),
);
// If you change this, please modify src/doc/unstable-book as well. You must
@ -1775,21 +1774,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}
visit::walk_vis(self, vis);
}
fn visit_generic_param(&mut self, param: &'a ast::GenericParam) {
let (attrs, explain) = match *param {
ast::GenericParam::Lifetime(ref ld) =>
(&ld.attrs, "attributes on lifetime bindings are experimental"),
ast::GenericParam::Type(ref t) =>
(&t.attrs, "attributes on type parameter bindings are experimental"),
};
if !attrs.is_empty() {
gate_feature_post!(&self, generic_param_attrs, attrs[0].span, explain);
}
visit::walk_generic_param(self, param)
}
}
pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],

View File

@ -12,8 +12,7 @@
// `#[oops]` is left dangling (that is, it is unattached, with no
// formal binding following it).
#![feature(generic_param_attrs, rustc_attrs)]
#![allow(dead_code)]
#![feature(rustc_attrs)]
struct RefIntPair<'a, 'b>(&'a u32, &'b u32);

View File

@ -12,8 +12,7 @@
// `#[oops]` is left dangling (that is, it is unattached, with no
// formal binding following it).
#![feature(generic_param_attrs, rustc_attrs)]
#![allow(dead_code)]
#![feature(rustc_attrs)]
struct RefAny<'a, T>(&'a T);

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generic_param_attrs, rustc_attrs)]
#![feature(rustc_attrs)]
fn func<#[rustc_synthetic] T>(_: T) {}

View File

@ -14,7 +14,6 @@
// A scenario with significant destruction code extents (which have
// suffix "dce" in current `-Z identify_regions` rendering).
#![feature(generic_param_attrs)]
#![feature(dropck_eyepatch)]
fn main() {

View File

@ -17,7 +17,7 @@
// using `rustc_attrs` feature. There is a separate compile-fail/ test
// ensuring that the attribute feature-gating works in this context.)
#![feature(generic_param_attrs, rustc_attrs)]
#![feature(rustc_attrs)]
#![allow(dead_code)]
struct StLt<#[rustc_lt_struct] 'a>(&'a u32);

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generic_param_attrs)]
#![feature(dropck_eyepatch)]
// The point of this test is to illustrate that the `#[may_dangle]`

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generic_param_attrs)]
#![feature(dropck_eyepatch)]
// The point of this test is to test uses of `#[may_dangle]` attribute

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generic_param_attrs)]
#![feature(dropck_eyepatch)]
// The point of this test is to illustrate that the `#[may_dangle]`

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generic_param_attrs)]
#![feature(dropck_eyepatch)]
// This is a support file for ../dropck-eyepatch-extern-crate.rs

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generic_param_attrs)]
#![feature(dropck_eyepatch)]
// This test ensures that a use of `#[may_dangle]` is rejected if

View File

@ -1,5 +1,5 @@
error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
--> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:32:1
--> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:31:1
|
LL | / impl<#[may_dangle] A, B: fmt::Debug> Drop for Pt<A, B> {
LL | | //~^ ERROR requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
@ -10,7 +10,7 @@ LL | | }
| |_^
error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
--> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:38:1
--> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:37:1
|
LL | / impl<#[may_dangle] 'a, 'b, B: fmt::Debug> Drop for Pr<'a, 'b, B> {
LL | | //~^ ERROR requires an `unsafe impl` declaration due to `#[may_dangle]` attribute

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generic_param_attrs)]
#![feature(dropck_eyepatch)]
// The point of this test is to test uses of `#[may_dangle]` attribute

View File

@ -1,5 +1,5 @@
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:57:20
--> $DIR/dropck-eyepatch-reorder.rs:56:20
|
LL | dt = Dt("dt", &c);
| ^ borrowed value does not live long enough
@ -10,7 +10,7 @@ LL | }
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:59:20
--> $DIR/dropck-eyepatch-reorder.rs:58:20
|
LL | dr = Dr("dr", &c);
| ^ borrowed value does not live long enough
@ -21,7 +21,7 @@ LL | }
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:67:29
--> $DIR/dropck-eyepatch-reorder.rs:66:29
|
LL | pt = Pt("pt", &c_long, &c);
| ^ borrowed value does not live long enough
@ -32,7 +32,7 @@ LL | }
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch-reorder.rs:69:29
--> $DIR/dropck-eyepatch-reorder.rs:68:29
|
LL | pr = Pr("pr", &c_long, &c);
| ^ borrowed value does not live long enough

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generic_param_attrs)]
#![feature(dropck_eyepatch)]
// The point of this test is to illustrate that the `#[may_dangle]`

View File

@ -1,5 +1,5 @@
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:80:20
--> $DIR/dropck-eyepatch.rs:79:20
|
LL | dt = Dt("dt", &c);
| ^ borrowed value does not live long enough
@ -10,7 +10,7 @@ LL | }
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:82:20
--> $DIR/dropck-eyepatch.rs:81:20
|
LL | dr = Dr("dr", &c);
| ^ borrowed value does not live long enough
@ -21,7 +21,7 @@ LL | }
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:90:29
--> $DIR/dropck-eyepatch.rs:89:29
|
LL | pt = Pt("pt", &c_long, &c);
| ^ borrowed value does not live long enough
@ -32,7 +32,7 @@ LL | }
= note: values in a scope are dropped in the opposite order they are created
error[E0597]: `c` does not live long enough
--> $DIR/dropck-eyepatch.rs:92:29
--> $DIR/dropck-eyepatch.rs:91:29
|
LL | pr = Pr("pr", &c_long, &c);
| ^ borrowed value does not live long enough

View File

@ -10,16 +10,9 @@
// This test ensures that attributes on formals in generic parameter
// lists are included when we are checking for unstable attributes.
//
// Note that feature(generic_param_attrs) *is* enabled here. We are
// checking feature-gating of the attributes themselves, not the
// capability to parse such attributes in that context.
// gate-test-custom_attribute
#![feature(generic_param_attrs)]
#![allow(dead_code)]
struct StLt<#[lt_struct] 'a>(&'a u32);
//~^ ERROR The attribute `lt_struct` is currently unknown to the compiler
struct StTy<#[ty_struct] I>(I);

View File

@ -1,5 +1,5 @@
error[E0658]: The attribute `lt_struct` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:23:13
--> $DIR/feature-gate-custom_attribute2.rs:16:13
|
LL | struct StLt<#[lt_struct] 'a>(&'a u32);
| ^^^^^^^^^^^^
@ -7,7 +7,7 @@ LL | struct StLt<#[lt_struct] 'a>(&'a u32);
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `ty_struct` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:25:13
--> $DIR/feature-gate-custom_attribute2.rs:18:13
|
LL | struct StTy<#[ty_struct] I>(I);
| ^^^^^^^^^^^^
@ -15,7 +15,7 @@ LL | struct StTy<#[ty_struct] I>(I);
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `lt_enum` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:28:11
--> $DIR/feature-gate-custom_attribute2.rs:21:11
|
LL | enum EnLt<#[lt_enum] 'b> { A(&'b u32), B }
| ^^^^^^^^^^
@ -23,7 +23,7 @@ LL | enum EnLt<#[lt_enum] 'b> { A(&'b u32), B }
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `ty_enum` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:30:11
--> $DIR/feature-gate-custom_attribute2.rs:23:11
|
LL | enum EnTy<#[ty_enum] J> { A(J), B }
| ^^^^^^^^^^
@ -31,7 +31,7 @@ LL | enum EnTy<#[ty_enum] J> { A(J), B }
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `lt_trait` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:33:12
--> $DIR/feature-gate-custom_attribute2.rs:26:12
|
LL | trait TrLt<#[lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
| ^^^^^^^^^^^
@ -39,7 +39,7 @@ LL | trait TrLt<#[lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `ty_trait` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:35:12
--> $DIR/feature-gate-custom_attribute2.rs:28:12
|
LL | trait TrTy<#[ty_trait] K> { fn foo(&self, _: K); }
| ^^^^^^^^^^^
@ -47,7 +47,7 @@ LL | trait TrTy<#[ty_trait] K> { fn foo(&self, _: K); }
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `lt_type` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:38:11
--> $DIR/feature-gate-custom_attribute2.rs:31:11
|
LL | type TyLt<#[lt_type] 'd> = &'d u32;
| ^^^^^^^^^^
@ -55,7 +55,7 @@ LL | type TyLt<#[lt_type] 'd> = &'d u32;
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `ty_type` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:40:11
--> $DIR/feature-gate-custom_attribute2.rs:33:11
|
LL | type TyTy<#[ty_type] L> = (L, );
| ^^^^^^^^^^
@ -63,7 +63,7 @@ LL | type TyTy<#[ty_type] L> = (L, );
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `lt_inherent` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:43:6
--> $DIR/feature-gate-custom_attribute2.rs:36:6
|
LL | impl<#[lt_inherent] 'e> StLt<'e> { }
| ^^^^^^^^^^^^^^
@ -71,7 +71,7 @@ LL | impl<#[lt_inherent] 'e> StLt<'e> { }
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `ty_inherent` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:45:6
--> $DIR/feature-gate-custom_attribute2.rs:38:6
|
LL | impl<#[ty_inherent] M> StTy<M> { }
| ^^^^^^^^^^^^^^
@ -79,7 +79,7 @@ LL | impl<#[ty_inherent] M> StTy<M> { }
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `lt_impl_for` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:48:6
--> $DIR/feature-gate-custom_attribute2.rs:41:6
|
LL | impl<#[lt_impl_for] 'f> TrLt<'f> for StLt<'f> {
| ^^^^^^^^^^^^^^
@ -87,7 +87,7 @@ LL | impl<#[lt_impl_for] 'f> TrLt<'f> for StLt<'f> {
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `ty_impl_for` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:52:6
--> $DIR/feature-gate-custom_attribute2.rs:45:6
|
LL | impl<#[ty_impl_for] N> TrTy<N> for StTy<N> {
| ^^^^^^^^^^^^^^
@ -95,7 +95,7 @@ LL | impl<#[ty_impl_for] N> TrTy<N> for StTy<N> {
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `lt_fn` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:57:9
--> $DIR/feature-gate-custom_attribute2.rs:50:9
|
LL | fn f_lt<#[lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
| ^^^^^^^^
@ -103,7 +103,7 @@ LL | fn f_lt<#[lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `ty_fn` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:59:9
--> $DIR/feature-gate-custom_attribute2.rs:52:9
|
LL | fn f_ty<#[ty_fn] O>(_: O) { }
| ^^^^^^^^
@ -111,7 +111,7 @@ LL | fn f_ty<#[ty_fn] O>(_: O) { }
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `lt_meth` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:63:13
--> $DIR/feature-gate-custom_attribute2.rs:56:13
|
LL | fn m_lt<#[lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
| ^^^^^^^^^^
@ -119,7 +119,7 @@ LL | fn m_lt<#[lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `ty_meth` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:65:13
--> $DIR/feature-gate-custom_attribute2.rs:58:13
|
LL | fn m_ty<#[ty_meth] P>(_: P) { }
| ^^^^^^^^^^
@ -127,7 +127,7 @@ LL | fn m_ty<#[ty_meth] P>(_: P) { }
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `lt_hof` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute2.rs:70:19
--> $DIR/feature-gate-custom_attribute2.rs:63:19
|
LL | where Q: for <#[lt_hof] 'i> Fn(&'i [u32]) -> &'i u32
| ^^^^^^^^^

View File

@ -1,139 +0,0 @@
error[E0658]: attributes on lifetime bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:22:13
|
LL | struct StLt<#[rustc_lt_struct] 'a>(&'a u32);
| ^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on type parameter bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:24:13
|
LL | struct StTy<#[rustc_ty_struct] I>(I);
| ^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on lifetime bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:27:11
|
LL | enum EnLt<#[rustc_lt_enum] 'b> { A(&'b u32), B }
| ^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on type parameter bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:29:11
|
LL | enum EnTy<#[rustc_ty_enum] J> { A(J), B }
| ^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on lifetime bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:32:12
|
LL | trait TrLt<#[rustc_lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
| ^^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on type parameter bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:34:12
|
LL | trait TrTy<#[rustc_ty_trait] K> { fn foo(&self, _: K); }
| ^^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on lifetime bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:37:11
|
LL | type TyLt<#[rustc_lt_type] 'd> = &'d u32;
| ^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on type parameter bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:39:11
|
LL | type TyTy<#[rustc_ty_type] L> = (L, );
| ^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on lifetime bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:42:6
|
LL | impl<#[rustc_lt_inherent] 'e> StLt<'e> { }
| ^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on type parameter bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:44:6
|
LL | impl<#[rustc_ty_inherent] M> StTy<M> { }
| ^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on lifetime bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:47:6
|
LL | impl<#[rustc_lt_impl_for] 'f> TrLt<'f> for StLt<'f> {
| ^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on type parameter bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:51:6
|
LL | impl<#[rustc_ty_impl_for] N> TrTy<N> for StTy<N> {
| ^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on lifetime bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:56:9
|
LL | fn f_lt<#[rustc_lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
| ^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on type parameter bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:58:9
|
LL | fn f_ty<#[rustc_ty_fn] O>(_: O) { }
| ^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on lifetime bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:62:13
|
LL | fn m_lt<#[rustc_lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
| ^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on type parameter bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:64:13
|
LL | fn m_ty<#[rustc_ty_meth] P>(_: P) { }
| ^^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error[E0658]: attributes on lifetime bindings are experimental (see issue #34761)
--> $DIR/feature-gate-generic_param_attrs.rs:69:19
|
LL | where Q: for <#[rustc_lt_hof] 'i> Fn(&'i [u32]) -> &'i u32
| ^^^^^^^^^^^^^^^
|
= help: add #![feature(generic_param_attrs)] to the crate attributes to enable
error: aborting due to 17 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -12,8 +12,6 @@
// Check that `may_dangle` is rejected if `dropck_eyepatch` feature gate is absent.
#![feature(generic_param_attrs)]
struct Pt<A>(A);
impl<#[may_dangle] A> Drop for Pt<A> {
//~^ ERROR may_dangle has unstable semantics and may be removed in the future

View File

@ -1,5 +1,5 @@
error[E0658]: may_dangle has unstable semantics and may be removed in the future (see issue #34761)
--> $DIR/feature-gate-may-dangle.rs:18:6
--> $DIR/feature-gate-may-dangle.rs:16:6
|
LL | impl<#[may_dangle] A> Drop for Pt<A> {
| ^^^^^^^^^^^^^

View File

@ -8,69 +8,47 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// This test ensures that attributes on formals in generic parameter
// lists are rejected if feature(generic_param_attrs) is not enabled.
// This test previously ensured that attributes on formals in generic parameter
// lists are rejected without a feature gate.
//
// (We are prefixing all tested features with `rustc_`, to ensure that
// the attributes themselves won't be rejected by the compiler when
// using `rustc_attrs` feature. There is a separate compile-fail/ test
// ensuring that the attribute feature-gating works in this context.)
// must-compile-successfully
#![feature(rustc_attrs)]
#![allow(dead_code)]
struct StLt<#[rustc_lt_struct] 'a>(&'a u32);
//~^ ERROR attributes on lifetime bindings are experimental (see issue #34761)
struct StTy<#[rustc_ty_struct] I>(I);
//~^ ERROR attributes on type parameter bindings are experimental (see issue #34761)
enum EnLt<#[rustc_lt_enum] 'b> { A(&'b u32), B }
//~^ ERROR attributes on lifetime bindings are experimental (see issue #34761)
enum EnTy<#[rustc_ty_enum] J> { A(J), B }
//~^ ERROR attributes on type parameter bindings are experimental (see issue #34761)
trait TrLt<#[rustc_lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
//~^ ERROR attributes on lifetime bindings are experimental (see issue #34761)
trait TrTy<#[rustc_ty_trait] K> { fn foo(&self, _: K); }
//~^ ERROR attributes on type parameter bindings are experimental (see issue #34761)
type TyLt<#[rustc_lt_type] 'd> = &'d u32;
//~^ ERROR attributes on lifetime bindings are experimental (see issue #34761)
type TyTy<#[rustc_ty_type] L> = (L, );
//~^ ERROR attributes on type parameter bindings are experimental (see issue #34761)
impl<#[rustc_lt_inherent] 'e> StLt<'e> { }
//~^ ERROR attributes on lifetime bindings are experimental (see issue #34761)
impl<#[rustc_ty_inherent] M> StTy<M> { }
//~^ ERROR attributes on type parameter bindings are experimental (see issue #34761)
impl<#[rustc_lt_impl_for] 'f> TrLt<'f> for StLt<'f> {
//~^ ERROR attributes on lifetime bindings are experimental (see issue #34761)
fn foo(&self, _: &'f [u32]) -> &'f u32 { loop { } }
}
impl<#[rustc_ty_impl_for] N> TrTy<N> for StTy<N> {
//~^ ERROR attributes on type parameter bindings are experimental (see issue #34761)
fn foo(&self, _: N) { }
}
fn f_lt<#[rustc_lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
//~^ ERROR attributes on lifetime bindings are experimental (see issue #34761)
fn f_ty<#[rustc_ty_fn] O>(_: O) { }
//~^ ERROR attributes on type parameter bindings are experimental (see issue #34761)
impl<I> StTy<I> {
fn m_lt<#[rustc_lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
//~^ ERROR attributes on lifetime bindings are experimental (see issue #34761)
fn m_ty<#[rustc_ty_meth] P>(_: P) { }
//~^ ERROR attributes on type parameter bindings are experimental (see issue #34761)
}
fn hof_lt<Q>(_: Q)
where Q: for <#[rustc_lt_hof] 'i> Fn(&'i [u32]) -> &'i u32
//~^ ERROR attributes on lifetime bindings are experimental (see issue #34761)
{
}
{}
fn main() {
}
fn main() {}

View File

@ -17,7 +17,6 @@
#![allow(warnings)]
#![feature(dropck_eyepatch)]
#![feature(generic_param_attrs)]
fn use_x(_: usize) -> bool { true }

View File

@ -17,7 +17,6 @@
#![allow(warnings)]
#![feature(dropck_eyepatch)]
#![feature(generic_param_attrs)]
fn use_x(_: usize) -> bool { true }

View File

@ -1,5 +1,5 @@
error[E0506]: cannot assign to `v[..]` because it is borrowed
--> $DIR/drop-no-may-dangle.rs:31:9
--> $DIR/drop-no-may-dangle.rs:30:9
|
LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
| ----- borrow of `v[..]` occurs here
@ -11,7 +11,7 @@ LL | }
| - borrow later used here, when `p` is dropped
error[E0506]: cannot assign to `v[..]` because it is borrowed
--> $DIR/drop-no-may-dangle.rs:34:5
--> $DIR/drop-no-may-dangle.rs:33:5
|
LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
| ----- borrow of `v[..]` occurs here