Skip to content

Commit d48031f

Browse files
committed
---
yaml --- r: 181527 b: refs/heads/snap-stage3 c: 38542cc h: refs/heads/master i: 181525: 6ef8b9e 181523: 1eabdec 181519: c285f61 v: v3
1 parent 42fdc63 commit d48031f

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6c065fc8cb036785f61ff03e05c1563cbb2dd081
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 531a06e593fdf4151c2b3f5673f24c7a0739e3f5
4+
refs/heads/snap-stage3: 38542cca29a0ed6f62b18d543386852e5a544adc
55
refs/heads/try: ccf8fedf1cffcb8f6f3581d53d220039e192fe77
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/libsyntax/feature_gate.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
134134
// Allows using the unsafe_no_drop_flag attribute (unlikely to
135135
// switch to Accepted; see RFC 320)
136136
("unsafe_no_drop_flag", "1.0.0", Active),
137+
138+
// Allows the use of custom attributes; RFC 572
139+
("custom_attribute", "1.0.0", Active)
137140
];
138141
// (changing above list without updating src/doc/reference.md makes @cmr sad)
139142

@@ -155,6 +158,43 @@ enum Status {
155158

156159
// Attributes that have a special meaning to rustc or rustdoc
157160
pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
161+
// Normal attributes
162+
163+
("warn", Normal),
164+
("allow", Normal),
165+
("forbid", Normal),
166+
("deny", Normal),
167+
168+
("macro_reexport", Normal),
169+
("macro_use", Normal),
170+
("plugin", Normal),
171+
("macro_export", Normal),
172+
("plugin_registrar", Normal),
173+
174+
("cfg", Normal),
175+
("main", Normal),
176+
("lang", Normal),
177+
("start", Normal),
178+
("test", Normal),
179+
("bench", Normal),
180+
("simd", Normal),
181+
("repr", Normal),
182+
("path", Normal),
183+
("staged_api", Normal),
184+
("abi", Normal),
185+
("rustc_move_fragments", Normal),
186+
("rustc_variance", Normal),
187+
("unsafe_destructor", Normal),
188+
("automatically_derived", Normal),
189+
("no_mangle", Normal),
190+
("no_link", Normal),
191+
("derive", Normal),
192+
("should_fail", Normal),
193+
("ignore", Normal),
194+
("no_implicit_prelude", Normal),
195+
("reexport_test_harness_main", Normal),
196+
("link_args", Normal),
197+
("macro_escape", Normal),
158198

159199
// FIXME: #14408 whitelist docs since rustdoc looks at them
160200
("doc", Whitelisted),
@@ -199,11 +239,13 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
199239
// Crate level attributes
200240
("crate_name", CrateLevel),
201241
("crate_type", CrateLevel),
242+
("crate_id", CrateLevel),
202243
("feature", CrateLevel),
203244
("no_start", CrateLevel),
204245
("no_main", CrateLevel),
205246
("no_std", CrateLevel),
206247
("no_builtins", CrateLevel),
248+
("recursion_limit", CrateLevel),
207249
];
208250

209251
#[derive(PartialEq, Copy)]
@@ -557,6 +599,18 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
557599
"unsafe_no_drop_flag has unstable semantics \
558600
and may be removed in the future");
559601
}
602+
603+
// Custom attribute check
604+
let name = attr.name();
605+
606+
if KNOWN_ATTRIBUTES.iter().all(|&(n, _)| n != name) {
607+
self.gate_feature("custom_attribute", attr.span,
608+
format!("The attribute `{}` is currently \
609+
unknown to the the compiler and \
610+
may have meaning \
611+
added to it in the future",
612+
attr.name()).as_slice());
613+
}
560614
}
561615

562616
fn visit_pat(&mut self, pattern: &ast::Pat) {

0 commit comments

Comments
 (0)