Feature gate rustc attributes harder

This commit is contained in:
Vadim Petrochenkov 2019-06-30 13:00:45 +03:00
parent 0ffb6438a6
commit e4e7eb2d58
11 changed files with 132 additions and 14 deletions

View file

@ -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 {