Remove #[feature(custom_attribute)]
This commit is contained in:
parent
3a223a9173
commit
441e5aed25
15 changed files with 60 additions and 61 deletions
|
|
@ -44,8 +44,6 @@ pub enum NonMacroAttrKind {
|
|||
Registered,
|
||||
/// Single-segment custom attribute registered by a legacy plugin (`register_attribute`).
|
||||
LegacyPluginHelper,
|
||||
/// Single-segment custom attribute not registered in any way (`#[my_attr]`).
|
||||
Custom,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)]
|
||||
|
|
@ -333,7 +331,6 @@ impl NonMacroAttrKind {
|
|||
NonMacroAttrKind::DeriveHelper => "derive helper attribute",
|
||||
NonMacroAttrKind::Registered => "explicitly registered attribute",
|
||||
NonMacroAttrKind::LegacyPluginHelper => "legacy plugin helper attribute",
|
||||
NonMacroAttrKind::Custom => "custom attribute",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ impl<'a> Registry<'a> {
|
|||
|
||||
/// Register an attribute with an attribute type.
|
||||
///
|
||||
/// Registered attributes will bypass the `custom_attribute` feature gate.
|
||||
/// `Whitelisted` attributes will additionally not trigger the `unused_attribute`
|
||||
/// lint. `CrateLevel` attributes will not be allowed on anything other than a crate.
|
||||
pub fn register_attribute(&mut self, name: Symbol, ty: AttributeType) {
|
||||
|
|
|
|||
|
|
@ -732,20 +732,7 @@ impl<'a> Resolver<'a> {
|
|||
return Ok(binding);
|
||||
}
|
||||
|
||||
let determinacy = Determinacy::determined(determinacy == Determinacy::Determined || force);
|
||||
if determinacy == Determinacy::Determined && macro_kind == Some(MacroKind::Attr) &&
|
||||
self.session.features_untracked().custom_attribute {
|
||||
// For single-segment attributes interpret determinate "no resolution" as a custom
|
||||
// attribute. (Lexical resolution implies the first segment and attr kind should imply
|
||||
// the last segment, so we are certainly working with a single-segment attribute here.)
|
||||
assert!(ns == MacroNS);
|
||||
let binding = (Res::NonMacroAttr(NonMacroAttrKind::Custom),
|
||||
ty::Visibility::Public, orig_ident.span, ExpnId::root())
|
||||
.to_name_binding(self.arenas);
|
||||
Ok(binding)
|
||||
} else {
|
||||
Err(determinacy)
|
||||
}
|
||||
Err(Determinacy::determined(determinacy == Determinacy::Determined || force))
|
||||
}
|
||||
|
||||
crate fn finalize_macro_resolutions(&mut self) {
|
||||
|
|
@ -756,16 +743,7 @@ impl<'a> Resolver<'a> {
|
|||
// Make sure compilation does not succeed if preferred macro resolution
|
||||
// has changed after the macro had been expanded. In theory all such
|
||||
// situations should be reported as ambiguity errors, so this is a bug.
|
||||
if initial_res == Res::NonMacroAttr(NonMacroAttrKind::Custom) {
|
||||
// Yeah, legacy custom attributes are implemented using forced resolution
|
||||
// (which is a best effort error recovery tool, basically), so we can't
|
||||
// promise their resolution won't change later.
|
||||
let msg = format!("inconsistent resolution for a macro: first {}, then {}",
|
||||
initial_res.descr(), res.descr());
|
||||
this.session.span_err(span, &msg);
|
||||
} else {
|
||||
span_bug!(span, "inconsistent resolution for a macro");
|
||||
}
|
||||
span_bug!(span, "inconsistent resolution for a macro");
|
||||
}
|
||||
} else {
|
||||
// It's possible that the macro was unresolved (indeterminate) and silently
|
||||
|
|
|
|||
|
|
@ -265,9 +265,6 @@ declare_features! (
|
|||
/// Allows the use of SIMD types in functions declared in `extern` blocks.
|
||||
(active, simd_ffi, "1.0.0", Some(27731), None),
|
||||
|
||||
/// Allows using custom attributes (RFC 572).
|
||||
(active, custom_attribute, "1.0.0", Some(29642), None),
|
||||
|
||||
/// Allows using non lexical lifetimes (RFC 2094).
|
||||
(active, nll, "1.0.0", Some(43234), None),
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ declare_features! (
|
|||
Some("merged into `#![feature(slice_patterns)]`")),
|
||||
(removed, macro_reexport, "1.0.0", Some(29638), None,
|
||||
Some("subsumed by `pub use`")),
|
||||
/// Allows using custom attributes (RFC 572).
|
||||
(removed, custom_attribute, "1.0.0", Some(29642), None,
|
||||
Some("removed in favor of `#![register_tool]` and `#![register_attr]`")),
|
||||
(removed, pushpop_unsafe, "1.2.0", None, None, None),
|
||||
(removed, needs_allocator, "1.4.0", Some(27389), None,
|
||||
Some("subsumed by `#![feature(allocator_internals)]`")),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,15 @@
|
|||
// ignore-stage1
|
||||
// compile-flags: -D crate-not-okay
|
||||
|
||||
#![feature(plugin, custom_attribute, custom_inner_attributes, rustc_attrs)]
|
||||
#![feature(plugin, register_attr, custom_inner_attributes, rustc_attrs)]
|
||||
|
||||
#![register_attr(
|
||||
rustc_crate_okay,
|
||||
rustc_crate_blue,
|
||||
rustc_crate_red,
|
||||
rustc_crate_grey,
|
||||
rustc_crate_green,
|
||||
)]
|
||||
|
||||
#![plugin(lint_for_crate_rpass)]
|
||||
#![rustc_crate_okay]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/issue-15778-pass.rs:8:1
|
||||
--> $DIR/issue-15778-pass.rs:16:1
|
||||
|
|
||||
LL | #![plugin(lint_for_crate_rpass)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
// This test ensures that attributes on formals in generic parameter
|
||||
// lists are included when we are checking for unstable attributes.
|
||||
|
||||
// gate-test-custom_attribute
|
||||
|
||||
struct StLt<#[lt_struct] 'a>(&'a u32);
|
||||
//~^ ERROR cannot find attribute `lt_struct` in this scope
|
||||
struct StTy<#[ty_struct] I>(I);
|
||||
|
|
|
|||
|
|
@ -1,101 +1,101 @@
|
|||
error: cannot find attribute `lt_hof` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:53:21
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:51:21
|
||||
|
|
||||
LL | where Q: for <#[lt_hof] 'i> Fn(&'i [u32]) -> &'i u32
|
||||
| ^^^^^^
|
||||
|
||||
error: cannot find attribute `ty_meth` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:48:15
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:46:15
|
||||
|
|
||||
LL | fn m_ty<#[ty_meth] P>(_: P) { }
|
||||
| ^^^^^^^
|
||||
|
||||
error: cannot find attribute `lt_meth` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:46:15
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:44:15
|
||||
|
|
||||
LL | fn m_lt<#[lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
|
||||
| ^^^^^^^
|
||||
|
||||
error: cannot find attribute `ty_fn` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:42:11
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:40:11
|
||||
|
|
||||
LL | fn f_ty<#[ty_fn] O>(_: O) { }
|
||||
| ^^^^^
|
||||
|
||||
error: cannot find attribute `lt_fn` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:40:11
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:38:11
|
||||
|
|
||||
LL | fn f_lt<#[lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
|
||||
| ^^^^^
|
||||
|
||||
error: cannot find attribute `ty_impl_for` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:35:8
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:33:8
|
||||
|
|
||||
LL | impl<#[ty_impl_for] N> TrTy<N> for StTy<N> {
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `lt_impl_for` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:31:8
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:29:8
|
||||
|
|
||||
LL | impl<#[lt_impl_for] 'f> TrLt<'f> for StLt<'f> {
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `ty_inherent` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:28:8
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:26:8
|
||||
|
|
||||
LL | impl<#[ty_inherent] M> StTy<M> { }
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `lt_inherent` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:26:8
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:24:8
|
||||
|
|
||||
LL | impl<#[lt_inherent] 'e> StLt<'e> { }
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `ty_type` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:23:13
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:21:13
|
||||
|
|
||||
LL | type TyTy<#[ty_type] L> = (L, );
|
||||
| ^^^^^^^
|
||||
|
||||
error: cannot find attribute `lt_type` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:21:13
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:19:13
|
||||
|
|
||||
LL | type TyLt<#[lt_type] 'd> = &'d u32;
|
||||
| ^^^^^^^
|
||||
|
||||
error: cannot find attribute `ty_trait` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:18:14
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:16:14
|
||||
|
|
||||
LL | trait TrTy<#[ty_trait] K> { fn foo(&self, _: K); }
|
||||
| ^^^^^^^^
|
||||
|
||||
error: cannot find attribute `lt_trait` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:16:14
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:14:14
|
||||
|
|
||||
LL | trait TrLt<#[lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
|
||||
| ^^^^^^^^
|
||||
|
||||
error: cannot find attribute `ty_enum` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:13:13
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:11:13
|
||||
|
|
||||
LL | enum EnTy<#[ty_enum] J> { A(J), B }
|
||||
| ^^^^^^^
|
||||
|
||||
error: cannot find attribute `lt_enum` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:11:13
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:9:13
|
||||
|
|
||||
LL | enum EnLt<#[lt_enum] 'b> { A(&'b u32), B }
|
||||
| ^^^^^^^
|
||||
|
||||
error: cannot find attribute `ty_struct` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:8:15
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:6:15
|
||||
|
|
||||
LL | struct StTy<#[ty_struct] I>(I);
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: cannot find attribute `lt_struct` in this scope
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:6:15
|
||||
--> $DIR/feature-gate-custom_attribute2.rs:4:15
|
||||
|
|
||||
LL | struct StLt<#[lt_struct] 'a>(&'a u32);
|
||||
| ^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
// aux-build:derive-unstable-2.rs
|
||||
|
||||
#![feature(custom_attribute)]
|
||||
#![feature(register_attr)]
|
||||
|
||||
#![register_attr(rustc_foo)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate derive_unstable_2;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler
|
||||
--> $DIR/expand-to-unstable-2.rs:8:10
|
||||
--> $DIR/expand-to-unstable-2.rs:10:10
|
||||
|
|
||||
LL | #[derive(Unstable)]
|
||||
| ^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@
|
|||
// FIXME: https://github.com/rust-lang/rust/issues/41430
|
||||
// This is a temporary regression test for the ICE reported in #41211
|
||||
|
||||
#![feature(custom_attribute)]
|
||||
#![feature(custom_inner_attributes)]
|
||||
#![feature(register_attr)]
|
||||
|
||||
#![register_attr(identity_attr)]
|
||||
|
||||
#![identity_attr]
|
||||
//~^ ERROR inconsistent resolution for a macro: first custom attribute, then attribute macro
|
||||
//~^ ERROR `identity_attr` is ambiguous
|
||||
extern crate test_macros;
|
||||
use test_macros::identity_attr;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,21 @@
|
|||
error: inconsistent resolution for a macro: first custom attribute, then attribute macro
|
||||
--> $DIR/issue-41211.rs:9:4
|
||||
error[E0659]: `identity_attr` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
|
||||
--> $DIR/issue-41211.rs:11:4
|
||||
|
|
||||
LL | #![identity_attr]
|
||||
| ^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^ ambiguous name
|
||||
|
|
||||
note: `identity_attr` could refer to the attribute macro imported here
|
||||
--> $DIR/issue-41211.rs:14:5
|
||||
|
|
||||
LL | use test_macros::identity_attr;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: use `crate::identity_attr` to refer to this attribute macro unambiguously
|
||||
note: `identity_attr` could also refer to the explicitly registered attribute defined here
|
||||
--> $DIR/issue-41211.rs:9:18
|
||||
|
|
||||
LL | #![register_attr(identity_attr)]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0659`.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
// gate-test-custom_inner_attributes
|
||||
|
||||
#![feature(custom_attribute)]
|
||||
#![feature(register_attr)]
|
||||
|
||||
#![register_attr(foo)]
|
||||
|
||||
#[foo]
|
||||
mod foo {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0658]: non-builtin inner attributes are unstable
|
||||
--> $DIR/issue-36530.rs:7:5
|
||||
--> $DIR/issue-36530.rs:9:5
|
||||
|
|
||||
LL | #![foo]
|
||||
| ^^^^^^^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue