resolve: Consolidate error reporting for resolved macros in fn resolve_macro_to_def

This commit is contained in:
Vadim Petrochenkov 2018-08-15 03:51:12 +03:00
parent 3a44ee68fb
commit 23e9a1def5
18 changed files with 172 additions and 198 deletions

View File

@ -1399,7 +1399,7 @@ pub struct Resolver<'a, 'b: 'a> {
proc_mac_errors: Vec<macros::ProcMacError>, proc_mac_errors: Vec<macros::ProcMacError>,
/// crate-local macro expanded `macro_export` referred to by a module-relative path /// crate-local macro expanded `macro_export` referred to by a module-relative path
macro_expanded_macro_export_errors: BTreeSet<(Span, Span)>, macro_expanded_macro_export_errors: BTreeSet<(Span, Span)>,
/// macro-expanded `macro_rules` shadowing existing macros
disallowed_shadowing: Vec<&'a LegacyBinding<'a>>, disallowed_shadowing: Vec<&'a LegacyBinding<'a>>,
arenas: &'a ResolverArenas<'a>, arenas: &'a ResolverArenas<'a>,

View File

@ -319,9 +319,9 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
None None
} }
fn resolve_invoc(&mut self, invoc: &Invocation, scope: Mark, force: bool) fn resolve_macro_invocation(&mut self, invoc: &Invocation, scope: Mark, force: bool)
-> Result<Option<Lrc<SyntaxExtension>>, Determinacy> { -> Result<Option<Lrc<SyntaxExtension>>, Determinacy> {
let (path, macro_kind, derives_in_scope) = match invoc.kind { let (path, kind, derives_in_scope) = match invoc.kind {
InvocationKind::Attr { attr: None, .. } => InvocationKind::Attr { attr: None, .. } =>
return Ok(None), return Ok(None),
InvocationKind::Attr { attr: Some(ref attr), ref traits, .. } => InvocationKind::Attr { attr: Some(ref attr), ref traits, .. } =>
@ -331,90 +331,26 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
InvocationKind::Derive { ref path, .. } => InvocationKind::Derive { ref path, .. } =>
(path, MacroKind::Derive, &[][..]), (path, MacroKind::Derive, &[][..]),
}; };
let def = self.resolve_macro_to_def(scope, path, macro_kind, derives_in_scope, force)?;
if let Def::Macro(_, MacroKind::ProcMacroStub) = def { let (def, ext) = self.resolve_macro_to_def(path, kind, scope, derives_in_scope, force)?;
self.report_proc_macro_stub(invoc.span());
return Err(Determinacy::Determined);
} else if let Def::NonMacroAttr(attr_kind) = def {
// Note that not only attributes, but anything in macro namespace can result in a
// `Def::NonMacroAttr` definition (e.g. `inline!()`), so we must report the error
// below for these cases.
let is_attr_invoc =
if let InvocationKind::Attr { .. } = invoc.kind { true } else { false };
let path = invoc.path().expect("no path for non-macro attr");
match attr_kind {
NonMacroAttrKind::Tool | NonMacroAttrKind::DeriveHelper |
NonMacroAttrKind::Custom if is_attr_invoc => {
let features = self.session.features_untracked();
if attr_kind == NonMacroAttrKind::Tool &&
!features.tool_attributes {
feature_err(&self.session.parse_sess, "tool_attributes",
invoc.span(), GateIssue::Language,
"tool attributes are unstable").emit();
}
if attr_kind == NonMacroAttrKind::Custom {
assert!(path.segments.len() == 1);
let name = path.segments[0].ident.name.as_str();
if name.starts_with("rustc_") {
if !features.rustc_attrs {
let msg = "unless otherwise specified, attributes with the prefix \
`rustc_` are reserved for internal compiler diagnostics";
feature_err(&self.session.parse_sess, "rustc_attrs", invoc.span(),
GateIssue::Language, &msg).emit();
}
} else if name.starts_with("derive_") {
if !features.custom_derive {
feature_err(&self.session.parse_sess, "custom_derive", invoc.span(),
GateIssue::Language, EXPLAIN_DERIVE_UNDERSCORE).emit();
}
} else if !features.custom_attribute {
let msg = format!("The attribute `{}` is currently unknown to the \
compiler and may have meaning added to it in the \
future", path);
feature_err(&self.session.parse_sess, "custom_attribute", invoc.span(),
GateIssue::Language, &msg).emit();
}
}
return Ok(Some(Lrc::new(SyntaxExtension::NonMacroAttr { if let Def::Macro(def_id, _) = def {
mark_used: attr_kind == NonMacroAttrKind::Tool, self.macro_defs.insert(invoc.expansion_data.mark, def_id);
}))); let normal_module_def_id =
} self.macro_def_scope(invoc.expansion_data.mark).normal_ancestor_id;
_ => { self.definitions.add_parent_module_of_macro_def(invoc.expansion_data.mark,
self.report_non_macro_attr(path.span, def); normal_module_def_id);
return Err(Determinacy::Determined); invoc.expansion_data.mark.set_default_transparency(ext.default_transparency());
} invoc.expansion_data.mark.set_is_builtin(def_id.krate == BUILTIN_MACROS_CRATE);
}
} }
let def_id = def.def_id();
self.macro_defs.insert(invoc.expansion_data.mark, def_id);
let normal_module_def_id =
self.macro_def_scope(invoc.expansion_data.mark).normal_ancestor_id;
self.definitions.add_parent_module_of_macro_def(invoc.expansion_data.mark,
normal_module_def_id);
self.unused_macros.remove(&def_id);
let ext = self.get_macro(def);
invoc.expansion_data.mark.set_default_transparency(ext.default_transparency());
invoc.expansion_data.mark.set_is_builtin(def_id.krate == BUILTIN_MACROS_CRATE);
Ok(Some(ext)) Ok(Some(ext))
} }
fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, kind: MacroKind, force: bool) fn resolve_macro_path(&mut self, path: &ast::Path, kind: MacroKind, scope: Mark,
-> Result<Lrc<SyntaxExtension>, Determinacy> { derives_in_scope: &[ast::Path], force: bool)
self.resolve_macro_to_def(scope, path, kind, &[], force).and_then(|def| { -> Result<Lrc<SyntaxExtension>, Determinacy> {
if let Def::Macro(_, MacroKind::ProcMacroStub) = def { Ok(self.resolve_macro_to_def(path, kind, scope, derives_in_scope, force)?.1)
self.report_proc_macro_stub(path.span);
return Err(Determinacy::Determined);
} else if let Def::NonMacroAttr(..) = def {
self.report_non_macro_attr(path.span, def);
return Err(Determinacy::Determined);
}
self.unused_macros.remove(&def.def_id());
Ok(self.get_macro(def))
})
} }
fn check_unused_macros(&self) { fn check_unused_macros(&self) {
@ -436,43 +372,89 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
} }
impl<'a, 'cl> Resolver<'a, 'cl> { impl<'a, 'cl> Resolver<'a, 'cl> {
fn report_proc_macro_stub(&self, span: Span) { fn resolve_macro_to_def(&mut self, path: &ast::Path, kind: MacroKind, scope: Mark,
self.session.span_err(span,
"can't use a procedural macro from the same crate that defines it");
}
fn report_non_macro_attr(&self, span: Span, def: Def) {
self.session.span_err(span, &format!("expected a macro, found {}", def.kind_name()));
}
fn resolve_macro_to_def(&mut self, scope: Mark, path: &ast::Path, kind: MacroKind,
derives_in_scope: &[ast::Path], force: bool) derives_in_scope: &[ast::Path], force: bool)
-> Result<Def, Determinacy> { -> Result<(Def, Lrc<SyntaxExtension>), Determinacy> {
let def = self.resolve_macro_to_def_inner(scope, path, kind, derives_in_scope, force); let def = self.resolve_macro_to_def_inner(path, kind, scope, derives_in_scope, force);
// Report errors and enforce feature gates for the resolved macro.
if def != Err(Determinacy::Undetermined) { if def != Err(Determinacy::Undetermined) {
// Do not report duplicated errors on every undetermined resolution. // Do not report duplicated errors on every undetermined resolution.
path.segments.iter().find(|segment| segment.args.is_some()).map(|segment| { for segment in &path.segments {
self.session.span_err(segment.args.as_ref().unwrap().span(), if let Some(args) = &segment.args {
"generic arguments in macro path"); self.session.span_err(args.span(), "generic arguments in macro path");
}); }
}
if kind != MacroKind::Bang && path.segments.len() > 1 &&
def != Ok(Def::NonMacroAttr(NonMacroAttrKind::Tool)) {
if !self.session.features_untracked().proc_macro_path_invoc {
emit_feature_err(
&self.session.parse_sess,
"proc_macro_path_invoc",
path.span,
GateIssue::Language,
"paths of length greater than one in macro invocations are \
currently unstable",
);
} }
} }
def
let def = def?;
if path.segments.len() > 1 {
if kind != MacroKind::Bang {
if def != Def::NonMacroAttr(NonMacroAttrKind::Tool) &&
!self.session.features_untracked().proc_macro_path_invoc {
let msg = format!("non-ident {} paths are unstable", kind.descr());
emit_feature_err(&self.session.parse_sess, "proc_macro_path_invoc",
path.span, GateIssue::Language, &msg);
}
}
}
match def {
Def::Macro(def_id, macro_kind) => {
self.unused_macros.remove(&def_id);
if macro_kind == MacroKind::ProcMacroStub {
let msg = "can't use a procedural macro from the same crate that defines it";
self.session.span_err(path.span, msg);
return Err(Determinacy::Determined);
}
}
Def::NonMacroAttr(attr_kind) => {
if kind == MacroKind::Attr {
let features = self.session.features_untracked();
if attr_kind == NonMacroAttrKind::Tool && !features.tool_attributes {
feature_err(&self.session.parse_sess, "tool_attributes", path.span,
GateIssue::Language, "tool attributes are unstable").emit();
}
if attr_kind == NonMacroAttrKind::Custom {
assert!(path.segments.len() == 1);
let name = path.segments[0].ident.name.as_str();
if name.starts_with("rustc_") {
if !features.rustc_attrs {
let msg = "unless otherwise specified, attributes with the prefix \
`rustc_` are reserved for internal compiler diagnostics";
feature_err(&self.session.parse_sess, "rustc_attrs", path.span,
GateIssue::Language, &msg).emit();
}
} else if name.starts_with("derive_") {
if !features.custom_derive {
feature_err(&self.session.parse_sess, "custom_derive", path.span,
GateIssue::Language, EXPLAIN_DERIVE_UNDERSCORE).emit();
}
} else if !features.custom_attribute {
let msg = format!("The attribute `{}` is currently unknown to the \
compiler and may have meaning added to it in the \
future", path);
feature_err(&self.session.parse_sess, "custom_attribute", path.span,
GateIssue::Language, &msg).emit();
}
}
} else {
// Not only attributes, but anything in macro namespace can result in
// `Def::NonMacroAttr` definition (e.g. `inline!()`), so we must report
// an error for those cases.
let msg = format!("expected a macro, found {}", def.kind_name());
self.session.span_err(path.span, &msg);
return Err(Determinacy::Determined);
}
}
_ => panic!("expected `Def::Macro` or `Def::NonMacroAttr`"),
}
Ok((def, self.get_macro(def)))
} }
pub fn resolve_macro_to_def_inner(&mut self, scope: Mark, path: &ast::Path, kind: MacroKind, pub fn resolve_macro_to_def_inner(&mut self, path: &ast::Path, kind: MacroKind, scope: Mark,
derives_in_scope: &[ast::Path], force: bool) derives_in_scope: &[ast::Path], force: bool)
-> Result<Def, Determinacy> { -> Result<Def, Determinacy> {
let ast::Path { ref segments, span } = *path; let ast::Path { ref segments, span } = *path;
@ -550,7 +532,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
enum ConvertToDeriveHelper { Yes, No, DontKnow } enum ConvertToDeriveHelper { Yes, No, DontKnow }
let mut convert_to_derive_helper = ConvertToDeriveHelper::No; let mut convert_to_derive_helper = ConvertToDeriveHelper::No;
for derive in derives_in_scope { for derive in derives_in_scope {
match self.resolve_macro(scope, derive, MacroKind::Derive, force) { match self.resolve_macro_path(derive, MacroKind::Derive, scope, &[], force) {
Ok(ext) => if let SyntaxExtension::ProcMacroDerive(_, ref inert_attrs, _) = *ext { Ok(ext) => if let SyntaxExtension::ProcMacroDerive(_, ref inert_attrs, _) = *ext {
if inert_attrs.contains(&path[0].name) { if inert_attrs.contains(&path[0].name) {
convert_to_derive_helper = ConvertToDeriveHelper::Yes; convert_to_derive_helper = ConvertToDeriveHelper::Yes;

View File

@ -403,9 +403,7 @@ fn macro_resolve(cx: &DocContext, path_str: &str) -> Option<Def> {
let path = ast::Path { segments: vec![segment], span: DUMMY_SP }; let path = ast::Path { segments: vec![segment], span: DUMMY_SP };
let mut resolver = cx.resolver.borrow_mut(); let mut resolver = cx.resolver.borrow_mut();
let mark = Mark::root(); let mark = Mark::root();
let res = resolver if let Ok(def) = resolver.resolve_macro_to_def_inner(&path, MacroKind::Bang, mark, &[], false) {
.resolve_macro_to_def_inner(mark, &path, MacroKind::Bang, &[], false);
if let Ok(def) = res {
if let SyntaxExtension::DeclMacro { .. } = *resolver.get_macro(def) { if let SyntaxExtension::DeclMacro { .. } = *resolver.get_macro(def) {
return Some(def); return Some(def);
} }

View File

@ -727,10 +727,12 @@ pub trait Resolver {
fn find_legacy_attr_invoc(&mut self, attrs: &mut Vec<Attribute>, allow_derive: bool) fn find_legacy_attr_invoc(&mut self, attrs: &mut Vec<Attribute>, allow_derive: bool)
-> Option<Attribute>; -> Option<Attribute>;
fn resolve_invoc(&mut self, invoc: &Invocation, scope: Mark, force: bool) fn resolve_macro_invocation(&mut self, invoc: &Invocation, scope: Mark, force: bool)
-> Result<Option<Lrc<SyntaxExtension>>, Determinacy>; -> Result<Option<Lrc<SyntaxExtension>>, Determinacy>;
fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, kind: MacroKind, force: bool) fn resolve_macro_path(&mut self, path: &ast::Path, kind: MacroKind, scope: Mark,
-> Result<Lrc<SyntaxExtension>, Determinacy>; derives_in_scope: &[ast::Path], force: bool)
-> Result<Lrc<SyntaxExtension>, Determinacy>;
fn check_unused_macros(&self); fn check_unused_macros(&self);
} }
@ -761,12 +763,13 @@ impl Resolver for DummyResolver {
fn resolve_imports(&mut self) {} fn resolve_imports(&mut self) {}
fn find_legacy_attr_invoc(&mut self, _attrs: &mut Vec<Attribute>, _allow_derive: bool) fn find_legacy_attr_invoc(&mut self, _attrs: &mut Vec<Attribute>, _allow_derive: bool)
-> Option<Attribute> { None } -> Option<Attribute> { None }
fn resolve_invoc(&mut self, _invoc: &Invocation, _scope: Mark, _force: bool) fn resolve_macro_invocation(&mut self, _invoc: &Invocation, _scope: Mark, _force: bool)
-> Result<Option<Lrc<SyntaxExtension>>, Determinacy> { -> Result<Option<Lrc<SyntaxExtension>>, Determinacy> {
Err(Determinacy::Determined) Err(Determinacy::Determined)
} }
fn resolve_macro(&mut self, _scope: Mark, _path: &ast::Path, _kind: MacroKind, fn resolve_macro_path(&mut self, _path: &ast::Path, _kind: MacroKind, _scope: Mark,
_force: bool) -> Result<Lrc<SyntaxExtension>, Determinacy> { _derives_in_scope: &[ast::Path], _force: bool)
-> Result<Lrc<SyntaxExtension>, Determinacy> {
Err(Determinacy::Determined) Err(Determinacy::Determined)
} }
fn check_unused_macros(&self) {} fn check_unused_macros(&self) {}

View File

@ -243,15 +243,6 @@ impl Invocation {
InvocationKind::Derive { ref path, .. } => path.span, InvocationKind::Derive { ref path, .. } => path.span,
} }
} }
pub fn path(&self) -> Option<&Path> {
match self.kind {
InvocationKind::Bang { ref mac, .. } => Some(&mac.node.path),
InvocationKind::Attr { attr: Some(ref attr), .. } => Some(&attr.path),
InvocationKind::Attr { attr: None, .. } => None,
InvocationKind::Derive { ref path, .. } => Some(path),
}
}
} }
pub struct MacroExpander<'a, 'b:'a> { pub struct MacroExpander<'a, 'b:'a> {
@ -343,7 +334,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
let scope = let scope =
if self.monotonic { invoc.expansion_data.mark } else { orig_expansion_data.mark }; if self.monotonic { invoc.expansion_data.mark } else { orig_expansion_data.mark };
let ext = match self.cx.resolver.resolve_invoc(&invoc, scope, force) { let ext = match self.cx.resolver.resolve_macro_invocation(&invoc, scope, force) {
Ok(ext) => Some(ext), Ok(ext) => Some(ext),
Err(Determinacy::Determined) => None, Err(Determinacy::Determined) => None,
Err(Determinacy::Undetermined) => { Err(Determinacy::Undetermined) => {
@ -393,8 +384,8 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
for path in &traits { for path in &traits {
let mark = Mark::fresh(self.cx.current_expansion.mark); let mark = Mark::fresh(self.cx.current_expansion.mark);
derives.push(mark); derives.push(mark);
let item = match self.cx.resolver.resolve_macro( let item = match self.cx.resolver.resolve_macro_path(
Mark::root(), path, MacroKind::Derive, false) { path, MacroKind::Derive, Mark::root(), &[], false) {
Ok(ext) => match *ext { Ok(ext) => match *ext {
BuiltinDerive(..) => item_with_markers.clone(), BuiltinDerive(..) => item_with_markers.clone(),
_ => item.clone(), _ => item.clone(),

View File

@ -22,7 +22,7 @@ extern crate proc_macro_gates as foo;
use foo::*; use foo::*;
#[foo::a] //~ ERROR: paths of length greater than one #[foo::a] //~ ERROR: non-ident attribute macro paths are unstable
fn _test() {} fn _test() {}
fn _test_inner() { fn _test_inner() {

View File

@ -2,37 +2,37 @@ error: can't use a procedural macro from the same crate that defines it
--> $DIR/macro-namespace-reserved-2.rs:34:5 --> $DIR/macro-namespace-reserved-2.rs:34:5
| |
LL | my_macro!(); //~ ERROR can't use a procedural macro from the same crate that defines it LL | my_macro!(); //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^^^ | ^^^^^^^^
error: can't use a procedural macro from the same crate that defines it error: can't use a procedural macro from the same crate that defines it
--> $DIR/macro-namespace-reserved-2.rs:37:5 --> $DIR/macro-namespace-reserved-2.rs:37:5
| |
LL | my_macro_attr!(); //~ ERROR can't use a procedural macro from the same crate that defines it LL | my_macro_attr!(); //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: can't use a procedural macro from the same crate that defines it error: can't use a procedural macro from the same crate that defines it
--> $DIR/macro-namespace-reserved-2.rs:40:5 --> $DIR/macro-namespace-reserved-2.rs:40:5
| |
LL | MyTrait!(); //~ ERROR can't use a procedural macro from the same crate that defines it LL | MyTrait!(); //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^^ | ^^^^^^^
error: can't use a procedural macro from the same crate that defines it error: can't use a procedural macro from the same crate that defines it
--> $DIR/macro-namespace-reserved-2.rs:43:1 --> $DIR/macro-namespace-reserved-2.rs:44:3
| |
LL | #[my_macro] //~ ERROR can't use a procedural macro from the same crate that defines it LL | #[my_macro] //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^^ | ^^^^^^^^
error: can't use a procedural macro from the same crate that defines it error: can't use a procedural macro from the same crate that defines it
--> $DIR/macro-namespace-reserved-2.rs:45:1 --> $DIR/macro-namespace-reserved-2.rs:46:3
| |
LL | #[my_macro_attr] //~ ERROR can't use a procedural macro from the same crate that defines it LL | #[my_macro_attr] //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: can't use a procedural macro from the same crate that defines it error: can't use a procedural macro from the same crate that defines it
--> $DIR/macro-namespace-reserved-2.rs:47:1 --> $DIR/macro-namespace-reserved-2.rs:48:3
| |
LL | #[MyTrait] //~ ERROR can't use a procedural macro from the same crate that defines it LL | #[MyTrait] //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^ | ^^^^^^^
error: can't use a procedural macro from the same crate that defines it error: can't use a procedural macro from the same crate that defines it
--> $DIR/macro-namespace-reserved-2.rs:50:10 --> $DIR/macro-namespace-reserved-2.rs:50:10

View File

@ -2,7 +2,7 @@ error[E0658]: The attribute `unknown` is currently unknown to the compiler and m
--> $DIR/cfg-attr-unknown-attribute-macro-expansion.rs:13:27 --> $DIR/cfg-attr-unknown-attribute-macro-expansion.rs:13:27
| |
LL | #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown LL | #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown
| ^^^^^^^^ | ^^^^^^^
... ...
LL | foo!(); LL | foo!();
| ------- in this macro invocation | ------- in this macro invocation

View File

@ -1,24 +1,24 @@
error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/custom_attribute.rs:13:1 --> $DIR/custom_attribute.rs:13:3
| |
LL | #[foo] //~ ERROR The attribute `foo` LL | #[foo] //~ ERROR The attribute `foo`
| ^^^^^^ | ^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/custom_attribute.rs:15:5 --> $DIR/custom_attribute.rs:15:7
| |
LL | #[foo] //~ ERROR The attribute `foo` LL | #[foo] //~ ERROR The attribute `foo`
| ^^^^^^ | ^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/custom_attribute.rs:17:5 --> $DIR/custom_attribute.rs:17:7
| |
LL | #[foo] //~ ERROR The attribute `foo` LL | #[foo] //~ ERROR The attribute `foo`
| ^^^^^^ | ^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable

View File

@ -1,104 +1,104 @@
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:17:1 --> $DIR/feature-gate-custom_attribute.rs:17:3
| |
LL | #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:18:1 --> $DIR/feature-gate-custom_attribute.rs:18:3
| |
LL | #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:19:1 --> $DIR/feature-gate-custom_attribute.rs:19:3
| |
LL | #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:20:1 --> $DIR/feature-gate-custom_attribute.rs:20:3
| |
LL | #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:21:1 --> $DIR/feature-gate-custom_attribute.rs:21:3
| |
LL | #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:22:1 --> $DIR/feature-gate-custom_attribute.rs:22:3
| |
LL | #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:23:1 --> $DIR/feature-gate-custom_attribute.rs:23:3
| |
LL | #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:24:1 --> $DIR/feature-gate-custom_attribute.rs:24:3
| |
LL | #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:25:1 --> $DIR/feature-gate-custom_attribute.rs:25:3
| |
LL | #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:26:1 --> $DIR/feature-gate-custom_attribute.rs:26:3
| |
LL | #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:27:1 --> $DIR/feature-gate-custom_attribute.rs:27:3
| |
LL | #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:28:1 --> $DIR/feature-gate-custom_attribute.rs:28:3
| |
LL | #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown LL | #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `fake_doc` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `fake_doc` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:29:1 --> $DIR/feature-gate-custom_attribute.rs:29:3
| |
LL | #[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown LL | #[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable

View File

@ -1,8 +1,8 @@
error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644) error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644)
--> $DIR/feature-gate-custom_derive.rs:11:1 --> $DIR/feature-gate-custom_derive.rs:11:3
| |
LL | #[derive_Clone] LL | #[derive_Clone]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= help: add #![feature(custom_derive)] to the crate attributes to enable = help: add #![feature(custom_derive)] to the crate attributes to enable

View File

@ -1,8 +1,8 @@
error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642) error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642)
--> $DIR/feature-gate-rustc-attrs.rs:15:1 --> $DIR/feature-gate-rustc-attrs.rs:15:3
| |
LL | #[rustc_foo] LL | #[rustc_foo]
| ^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(rustc_attrs)] to the crate attributes to enable = help: add #![feature(rustc_attrs)] to the crate attributes to enable

View File

@ -1,8 +1,8 @@
error[E0658]: tool attributes are unstable (see issue #44690) error[E0658]: tool attributes are unstable (see issue #44690)
--> $DIR/feature-gate-tool_attributes.rs:12:5 --> $DIR/feature-gate-tool_attributes.rs:12:7
| |
LL | #[rustfmt::skip] //~ ERROR tool attributes are unstable LL | #[rustfmt::skip] //~ ERROR tool attributes are unstable
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
| |
= help: add #![feature(tool_attributes)] to the crate attributes to enable = help: add #![feature(tool_attributes)] to the crate attributes to enable

View File

@ -1,8 +1,8 @@
error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644) error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644)
--> $DIR/issue-32655.rs:16:9 --> $DIR/issue-32655.rs:16:11
| |
LL | #[derive_Clone] //~ ERROR attributes of the form LL | #[derive_Clone] //~ ERROR attributes of the form
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^
... ...
LL | foo!(); LL | foo!();
| ------- in this macro invocation | ------- in this macro invocation
@ -10,10 +10,10 @@ LL | foo!();
= help: add #![feature(custom_derive)] to the crate attributes to enable = help: add #![feature(custom_derive)] to the crate attributes to enable
error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644) error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644)
--> $DIR/issue-32655.rs:28:5 --> $DIR/issue-32655.rs:28:7
| |
LL | #[derive_Clone] //~ ERROR attributes of the form LL | #[derive_Clone] //~ ERROR attributes of the form
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= help: add #![feature(custom_derive)] to the crate attributes to enable = help: add #![feature(custom_derive)] to the crate attributes to enable

View File

@ -1,8 +1,8 @@
error[E0658]: The attribute `marco_use` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `marco_use` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/issue-49074.rs:13:1 --> $DIR/issue-49074.rs:13:3
| |
LL | #[marco_use] // typo LL | #[marco_use] // typo
| ^^^^^^^^^^^^ | ^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable

View File

@ -11,10 +11,10 @@ LL | #![feature(macro_reexport)] //~ ERROR feature has been removed
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error[E0658]: The attribute `macro_reexport` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `macro_reexport` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/macro-reexport-removed.rs:15:1 --> $DIR/macro-reexport-removed.rs:15:3
| |
LL | #[macro_reexport(macro_one)] //~ ERROR attribute `macro_reexport` is currently unknown LL | #[macro_reexport(macro_one)] //~ ERROR attribute `macro_reexport` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable

View File

@ -1,8 +1,8 @@
error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642) error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642)
--> $DIR/reserved-attr-on-macro.rs:11:1 --> $DIR/reserved-attr-on-macro.rs:11:3
| |
LL | #[rustc_attribute_should_be_reserved] //~ ERROR attributes with the prefix `rustc_` are reserved LL | #[rustc_attribute_should_be_reserved] //~ ERROR attributes with the prefix `rustc_` are reserved
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: add #![feature(rustc_attrs)] to the crate attributes to enable = help: add #![feature(rustc_attrs)] to the crate attributes to enable

View File

@ -1,16 +1,16 @@
error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/issue-36530.rs:11:1 --> $DIR/issue-36530.rs:11:3
| |
LL | #[foo] //~ ERROR is currently unknown to the compiler LL | #[foo] //~ ERROR is currently unknown to the compiler
| ^^^^^^ | ^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable
error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/issue-36530.rs:13:5 --> $DIR/issue-36530.rs:13:8
| |
LL | #![foo] //~ ERROR is currently unknown to the compiler LL | #![foo] //~ ERROR is currently unknown to the compiler
| ^^^^^^^ | ^^^
| |
= help: add #![feature(custom_attribute)] to the crate attributes to enable = help: add #![feature(custom_attribute)] to the crate attributes to enable