diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-30 13:00:45 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-30 13:57:12 +0300 |
| commit | e4e7eb2d5891ceb9241f769540dd413e90020971 (patch) | |
| tree | f3aa0719e0588841025aae5e9d019dbe3ac42a62 /src/libsyntax | |
| parent | 0ffb6438a6b19135cdfd3461dbd9efaf0011a149 (diff) | |
| download | rust-e4e7eb2d5891ceb9241f769540dd413e90020971.tar.gz rust-e4e7eb2d5891ceb9241f769540dd413e90020971.zip | |
Feature gate `rustc` attributes harder
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 9aea995831e..6037b06eaf2 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1669,6 +1669,14 @@ impl<'a> Context<'a> { } debug!("check_attribute: {:?} is builtin, {:?}, {:?}", attr.path, ty, gateage); return; + } else { + for segment in &attr.path.segments { + if segment.ident.as_str().starts_with("rustc") { + let msg = "attributes starting with `rustc` are \ + reserved for use by the `rustc` compiler"; + gate_feature!(self, rustc_attrs, segment.ident.span, msg); + } + } } for &(n, ty) in self.plugin_attributes { if attr.path == n { |
