Skip to content

Commit 441e5ae

Browse files
committed
Remove #[feature(custom_attribute)]
1 parent 3a223a9 commit 441e5ae

File tree

15 files changed

+60
-61
lines changed

15 files changed

+60
-61
lines changed

src/librustc/hir/def.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ pub enum NonMacroAttrKind {
4444
Registered,
4545
/// Single-segment custom attribute registered by a legacy plugin (`register_attribute`).
4646
LegacyPluginHelper,
47-
/// Single-segment custom attribute not registered in any way (`#[my_attr]`).
48-
Custom,
4947
}
5048

5149
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)]
@@ -333,7 +331,6 @@ impl NonMacroAttrKind {
333331
NonMacroAttrKind::DeriveHelper => "derive helper attribute",
334332
NonMacroAttrKind::Registered => "explicitly registered attribute",
335333
NonMacroAttrKind::LegacyPluginHelper => "legacy plugin helper attribute",
336-
NonMacroAttrKind::Custom => "custom attribute",
337334
}
338335
}
339336
}

src/librustc_plugin/registry.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ impl<'a> Registry<'a> {
101101

102102
/// Register an attribute with an attribute type.
103103
///
104-
/// Registered attributes will bypass the `custom_attribute` feature gate.
105104
/// `Whitelisted` attributes will additionally not trigger the `unused_attribute`
106105
/// lint. `CrateLevel` attributes will not be allowed on anything other than a crate.
107106
pub fn register_attribute(&mut self, name: Symbol, ty: AttributeType) {

src/librustc_resolve/macros.rs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -732,20 +732,7 @@ impl<'a> Resolver<'a> {
732732
return Ok(binding);
733733
}
734734

735-
let determinacy = Determinacy::determined(determinacy == Determinacy::Determined || force);
736-
if determinacy == Determinacy::Determined && macro_kind == Some(MacroKind::Attr) &&
737-
self.session.features_untracked().custom_attribute {
738-
// For single-segment attributes interpret determinate "no resolution" as a custom
739-
// attribute. (Lexical resolution implies the first segment and attr kind should imply
740-
// the last segment, so we are certainly working with a single-segment attribute here.)
741-
assert!(ns == MacroNS);
742-
let binding = (Res::NonMacroAttr(NonMacroAttrKind::Custom),
743-
ty::Visibility::Public, orig_ident.span, ExpnId::root())
744-
.to_name_binding(self.arenas);
745-
Ok(binding)
746-
} else {
747-
Err(determinacy)
748-
}
735+
Err(Determinacy::determined(determinacy == Determinacy::Determined || force))
749736
}
750737

751738
crate fn finalize_macro_resolutions(&mut self) {
@@ -756,16 +743,7 @@ impl<'a> Resolver<'a> {
756743
// Make sure compilation does not succeed if preferred macro resolution
757744
// has changed after the macro had been expanded. In theory all such
758745
// situations should be reported as ambiguity errors, so this is a bug.
759-
if initial_res == Res::NonMacroAttr(NonMacroAttrKind::Custom) {
760-
// Yeah, legacy custom attributes are implemented using forced resolution
761-
// (which is a best effort error recovery tool, basically), so we can't
762-
// promise their resolution won't change later.
763-
let msg = format!("inconsistent resolution for a macro: first {}, then {}",
764-
initial_res.descr(), res.descr());
765-
this.session.span_err(span, &msg);
766-
} else {
767-
span_bug!(span, "inconsistent resolution for a macro");
768-
}
746+
span_bug!(span, "inconsistent resolution for a macro");
769747
}
770748
} else {
771749
// It's possible that the macro was unresolved (indeterminate) and silently

src/libsyntax/feature_gate/active.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,6 @@ declare_features! (
265265
/// Allows the use of SIMD types in functions declared in `extern` blocks.
266266
(active, simd_ffi, "1.0.0", Some(27731), None),
267267

268-
/// Allows using custom attributes (RFC 572).
269-
(active, custom_attribute, "1.0.0", Some(29642), None),
270-
271268
/// Allows using non lexical lifetimes (RFC 2094).
272269
(active, nll, "1.0.0", Some(43234), None),
273270

src/libsyntax/feature_gate/removed.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ declare_features! (
6767
Some("merged into `#![feature(slice_patterns)]`")),
6868
(removed, macro_reexport, "1.0.0", Some(29638), None,
6969
Some("subsumed by `pub use`")),
70+
/// Allows using custom attributes (RFC 572).
71+
(removed, custom_attribute, "1.0.0", Some(29642), None,
72+
Some("removed in favor of `#![register_tool]` and `#![register_attr]`")),
7073
(removed, pushpop_unsafe, "1.2.0", None, None, None),
7174
(removed, needs_allocator, "1.4.0", Some(27389), None,
7275
Some("subsumed by `#![feature(allocator_internals)]`")),

src/test/ui-fulldeps/issue-15778-pass.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
// ignore-stage1
44
// compile-flags: -D crate-not-okay
55

6-
#![feature(plugin, custom_attribute, custom_inner_attributes, rustc_attrs)]
6+
#![feature(plugin, register_attr, custom_inner_attributes, rustc_attrs)]
7+
8+
#![register_attr(
9+
rustc_crate_okay,
10+
rustc_crate_blue,
11+
rustc_crate_red,
12+
rustc_crate_grey,
13+
rustc_crate_green,
14+
)]
715

816
#![plugin(lint_for_crate_rpass)]
917
#![rustc_crate_okay]

src/test/ui-fulldeps/issue-15778-pass.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
2-
--> $DIR/issue-15778-pass.rs:8:1
2+
--> $DIR/issue-15778-pass.rs:16:1
33
|
44
LL | #![plugin(lint_for_crate_rpass)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version

src/test/ui/feature-gates/feature-gate-custom_attribute2.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// This test ensures that attributes on formals in generic parameter
22
// lists are included when we are checking for unstable attributes.
33

4-
// gate-test-custom_attribute
5-
64
struct StLt<#[lt_struct] 'a>(&'a u32);
75
//~^ ERROR cannot find attribute `lt_struct` in this scope
86
struct StTy<#[ty_struct] I>(I);

src/test/ui/feature-gates/feature-gate-custom_attribute2.stderr

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,101 @@
11
error: cannot find attribute `lt_hof` in this scope
2-
--> $DIR/feature-gate-custom_attribute2.rs:53:21
2+
--> $DIR/feature-gate-custom_attribute2.rs:51:21
33
|
44
LL | where Q: for <#[lt_hof] 'i> Fn(&'i [u32]) -> &'i u32
55
| ^^^^^^
66

77
error: cannot find attribute `ty_meth` in this scope
8-
--> $DIR/feature-gate-custom_attribute2.rs:48:15
8+
--> $DIR/feature-gate-custom_attribute2.rs:46:15
99
|
1010
LL | fn m_ty<#[ty_meth] P>(_: P) { }
1111
| ^^^^^^^
1212

1313
error: cannot find attribute `lt_meth` in this scope
14-
--> $DIR/feature-gate-custom_attribute2.rs:46:15
14+
--> $DIR/feature-gate-custom_attribute2.rs:44:15
1515
|
1616
LL | fn m_lt<#[lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
1717
| ^^^^^^^
1818

1919
error: cannot find attribute `ty_fn` in this scope
20-
--> $DIR/feature-gate-custom_attribute2.rs:42:11
20+
--> $DIR/feature-gate-custom_attribute2.rs:40:11
2121
|
2222
LL | fn f_ty<#[ty_fn] O>(_: O) { }
2323
| ^^^^^
2424

2525
error: cannot find attribute `lt_fn` in this scope
26-
--> $DIR/feature-gate-custom_attribute2.rs:40:11
26+
--> $DIR/feature-gate-custom_attribute2.rs:38:11
2727
|
2828
LL | fn f_lt<#[lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
2929
| ^^^^^
3030

3131
error: cannot find attribute `ty_impl_for` in this scope
32-
--> $DIR/feature-gate-custom_attribute2.rs:35:8
32+
--> $DIR/feature-gate-custom_attribute2.rs:33:8
3333
|
3434
LL | impl<#[ty_impl_for] N> TrTy<N> for StTy<N> {
3535
| ^^^^^^^^^^^
3636

3737
error: cannot find attribute `lt_impl_for` in this scope
38-
--> $DIR/feature-gate-custom_attribute2.rs:31:8
38+
--> $DIR/feature-gate-custom_attribute2.rs:29:8
3939
|
4040
LL | impl<#[lt_impl_for] 'f> TrLt<'f> for StLt<'f> {
4141
| ^^^^^^^^^^^
4242

4343
error: cannot find attribute `ty_inherent` in this scope
44-
--> $DIR/feature-gate-custom_attribute2.rs:28:8
44+
--> $DIR/feature-gate-custom_attribute2.rs:26:8
4545
|
4646
LL | impl<#[ty_inherent] M> StTy<M> { }
4747
| ^^^^^^^^^^^
4848

4949
error: cannot find attribute `lt_inherent` in this scope
50-
--> $DIR/feature-gate-custom_attribute2.rs:26:8
50+
--> $DIR/feature-gate-custom_attribute2.rs:24:8
5151
|
5252
LL | impl<#[lt_inherent] 'e> StLt<'e> { }
5353
| ^^^^^^^^^^^
5454

5555
error: cannot find attribute `ty_type` in this scope
56-
--> $DIR/feature-gate-custom_attribute2.rs:23:13
56+
--> $DIR/feature-gate-custom_attribute2.rs:21:13
5757
|
5858
LL | type TyTy<#[ty_type] L> = (L, );
5959
| ^^^^^^^
6060

6161
error: cannot find attribute `lt_type` in this scope
62-
--> $DIR/feature-gate-custom_attribute2.rs:21:13
62+
--> $DIR/feature-gate-custom_attribute2.rs:19:13
6363
|
6464
LL | type TyLt<#[lt_type] 'd> = &'d u32;
6565
| ^^^^^^^
6666

6767
error: cannot find attribute `ty_trait` in this scope
68-
--> $DIR/feature-gate-custom_attribute2.rs:18:14
68+
--> $DIR/feature-gate-custom_attribute2.rs:16:14
6969
|
7070
LL | trait TrTy<#[ty_trait] K> { fn foo(&self, _: K); }
7171
| ^^^^^^^^
7272

7373
error: cannot find attribute `lt_trait` in this scope
74-
--> $DIR/feature-gate-custom_attribute2.rs:16:14
74+
--> $DIR/feature-gate-custom_attribute2.rs:14:14
7575
|
7676
LL | trait TrLt<#[lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
7777
| ^^^^^^^^
7878

7979
error: cannot find attribute `ty_enum` in this scope
80-
--> $DIR/feature-gate-custom_attribute2.rs:13:13
80+
--> $DIR/feature-gate-custom_attribute2.rs:11:13
8181
|
8282
LL | enum EnTy<#[ty_enum] J> { A(J), B }
8383
| ^^^^^^^
8484

8585
error: cannot find attribute `lt_enum` in this scope
86-
--> $DIR/feature-gate-custom_attribute2.rs:11:13
86+
--> $DIR/feature-gate-custom_attribute2.rs:9:13
8787
|
8888
LL | enum EnLt<#[lt_enum] 'b> { A(&'b u32), B }
8989
| ^^^^^^^
9090

9191
error: cannot find attribute `ty_struct` in this scope
92-
--> $DIR/feature-gate-custom_attribute2.rs:8:15
92+
--> $DIR/feature-gate-custom_attribute2.rs:6:15
9393
|
9494
LL | struct StTy<#[ty_struct] I>(I);
9595
| ^^^^^^^^^
9696

9797
error: cannot find attribute `lt_struct` in this scope
98-
--> $DIR/feature-gate-custom_attribute2.rs:6:15
98+
--> $DIR/feature-gate-custom_attribute2.rs:4:15
9999
|
100100
LL | struct StLt<#[lt_struct] 'a>(&'a u32);
101101
| ^^^^^^^^^

src/test/ui/proc-macro/expand-to-unstable-2.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// aux-build:derive-unstable-2.rs
22

3-
#![feature(custom_attribute)]
3+
#![feature(register_attr)]
4+
5+
#![register_attr(rustc_foo)]
46

57
#[macro_use]
68
extern crate derive_unstable_2;

src/test/ui/proc-macro/expand-to-unstable-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler
2-
--> $DIR/expand-to-unstable-2.rs:8:10
2+
--> $DIR/expand-to-unstable-2.rs:10:10
33
|
44
LL | #[derive(Unstable)]
55
| ^^^^^^^^

src/test/ui/proc-macro/issue-41211.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
// FIXME: https://github.com/rust-lang/rust/issues/41430
44
// This is a temporary regression test for the ICE reported in #41211
55

6-
#![feature(custom_attribute)]
76
#![feature(custom_inner_attributes)]
7+
#![feature(register_attr)]
8+
9+
#![register_attr(identity_attr)]
810

911
#![identity_attr]
10-
//~^ ERROR inconsistent resolution for a macro: first custom attribute, then attribute macro
12+
//~^ ERROR `identity_attr` is ambiguous
1113
extern crate test_macros;
1214
use test_macros::identity_attr;
1315

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
error: inconsistent resolution for a macro: first custom attribute, then attribute macro
2-
--> $DIR/issue-41211.rs:9:4
1+
error[E0659]: `identity_attr` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution)
2+
--> $DIR/issue-41211.rs:11:4
33
|
44
LL | #![identity_attr]
5-
| ^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^ ambiguous name
6+
|
7+
note: `identity_attr` could refer to the attribute macro imported here
8+
--> $DIR/issue-41211.rs:14:5
9+
|
10+
LL | use test_macros::identity_attr;
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
= help: use `crate::identity_attr` to refer to this attribute macro unambiguously
13+
note: `identity_attr` could also refer to the explicitly registered attribute defined here
14+
--> $DIR/issue-41211.rs:9:18
15+
|
16+
LL | #![register_attr(identity_attr)]
17+
| ^^^^^^^^^^^^^
618

719
error: aborting due to previous error
820

21+
For more information about this error, try `rustc --explain E0659`.

src/test/ui/span/issue-36530.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// gate-test-custom_inner_attributes
22

3-
#![feature(custom_attribute)]
3+
#![feature(register_attr)]
4+
5+
#![register_attr(foo)]
46

57
#[foo]
68
mod foo {

src/test/ui/span/issue-36530.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: non-builtin inner attributes are unstable
2-
--> $DIR/issue-36530.rs:7:5
2+
--> $DIR/issue-36530.rs:9:5
33
|
44
LL | #![foo]
55
| ^^^^^^^

0 commit comments

Comments
 (0)