resolve: Consolidate error reporting for resolved macros in fn resolve_macro_to_def
This commit is contained in:
parent
3a44ee68fb
commit
23e9a1def5
18 changed files with 172 additions and 198 deletions
|
@ -1399,7 +1399,7 @@ pub struct Resolver<'a, 'b: 'a> {
|
|||
proc_mac_errors: Vec<macros::ProcMacError>,
|
||||
/// crate-local macro expanded `macro_export` referred to by a module-relative path
|
||||
macro_expanded_macro_export_errors: BTreeSet<(Span, Span)>,
|
||||
|
||||
/// macro-expanded `macro_rules` shadowing existing macros
|
||||
disallowed_shadowing: Vec<&'a LegacyBinding<'a>>,
|
||||
|
||||
arenas: &'a ResolverArenas<'a>,
|
||||
|
|
|
@ -319,9 +319,9 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
|
|||
None
|
||||
}
|
||||
|
||||
fn resolve_invoc(&mut self, invoc: &Invocation, scope: Mark, force: bool)
|
||||
-> Result<Option<Lrc<SyntaxExtension>>, Determinacy> {
|
||||
let (path, macro_kind, derives_in_scope) = match invoc.kind {
|
||||
fn resolve_macro_invocation(&mut self, invoc: &Invocation, scope: Mark, force: bool)
|
||||
-> Result<Option<Lrc<SyntaxExtension>>, Determinacy> {
|
||||
let (path, kind, derives_in_scope) = match invoc.kind {
|
||||
InvocationKind::Attr { attr: None, .. } =>
|
||||
return Ok(None),
|
||||
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, .. } =>
|
||||
(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 {
|
||||
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();
|
||||
}
|
||||
}
|
||||
let (def, ext) = self.resolve_macro_to_def(path, kind, scope, derives_in_scope, force)?;
|
||||
|
||||
return Ok(Some(Lrc::new(SyntaxExtension::NonMacroAttr {
|
||||
mark_used: attr_kind == NonMacroAttrKind::Tool,
|
||||
})));
|
||||
}
|
||||
_ => {
|
||||
self.report_non_macro_attr(path.span, def);
|
||||
return Err(Determinacy::Determined);
|
||||
}
|
||||
}
|
||||
if let Def::Macro(def_id, _) = def {
|
||||
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);
|
||||
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))
|
||||
}
|
||||
|
||||
fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, kind: MacroKind, force: bool)
|
||||
-> Result<Lrc<SyntaxExtension>, Determinacy> {
|
||||
self.resolve_macro_to_def(scope, path, kind, &[], force).and_then(|def| {
|
||||
if let Def::Macro(_, MacroKind::ProcMacroStub) = def {
|
||||
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 resolve_macro_path(&mut self, path: &ast::Path, kind: MacroKind, scope: Mark,
|
||||
derives_in_scope: &[ast::Path], force: bool)
|
||||
-> Result<Lrc<SyntaxExtension>, Determinacy> {
|
||||
Ok(self.resolve_macro_to_def(path, kind, scope, derives_in_scope, force)?.1)
|
||||
}
|
||||
|
||||
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> {
|
||||
fn report_proc_macro_stub(&self, span: Span) {
|
||||
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,
|
||||
fn resolve_macro_to_def(&mut self, path: &ast::Path, kind: MacroKind, scope: Mark,
|
||||
derives_in_scope: &[ast::Path], force: bool)
|
||||
-> Result<Def, Determinacy> {
|
||||
let def = self.resolve_macro_to_def_inner(scope, path, kind, derives_in_scope, force);
|
||||
-> Result<(Def, Lrc<SyntaxExtension>), Determinacy> {
|
||||
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) {
|
||||
// Do not report duplicated errors on every undetermined resolution.
|
||||
path.segments.iter().find(|segment| segment.args.is_some()).map(|segment| {
|
||||
self.session.span_err(segment.args.as_ref().unwrap().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",
|
||||
);
|
||||
for segment in &path.segments {
|
||||
if let Some(args) = &segment.args {
|
||||
self.session.span_err(args.span(), "generic arguments in macro path");
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
-> Result<Def, Determinacy> {
|
||||
let ast::Path { ref segments, span } = *path;
|
||||
|
@ -550,7 +532,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
|||
enum ConvertToDeriveHelper { Yes, No, DontKnow }
|
||||
let mut convert_to_derive_helper = ConvertToDeriveHelper::No;
|
||||
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 {
|
||||
if inert_attrs.contains(&path[0].name) {
|
||||
convert_to_derive_helper = ConvertToDeriveHelper::Yes;
|
||||
|
|
|
@ -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 mut resolver = cx.resolver.borrow_mut();
|
||||
let mark = Mark::root();
|
||||
let res = resolver
|
||||
.resolve_macro_to_def_inner(mark, &path, MacroKind::Bang, &[], false);
|
||||
if let Ok(def) = res {
|
||||
if let Ok(def) = resolver.resolve_macro_to_def_inner(&path, MacroKind::Bang, mark, &[], false) {
|
||||
if let SyntaxExtension::DeclMacro { .. } = *resolver.get_macro(def) {
|
||||
return Some(def);
|
||||
}
|
||||
|
|
|
@ -727,10 +727,12 @@ pub trait Resolver {
|
|||
fn find_legacy_attr_invoc(&mut self, attrs: &mut Vec<Attribute>, allow_derive: bool)
|
||||
-> Option<Attribute>;
|
||||
|
||||
fn resolve_invoc(&mut self, invoc: &Invocation, scope: Mark, force: bool)
|
||||
-> Result<Option<Lrc<SyntaxExtension>>, Determinacy>;
|
||||
fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, kind: MacroKind, force: bool)
|
||||
-> Result<Lrc<SyntaxExtension>, Determinacy>;
|
||||
fn resolve_macro_invocation(&mut self, invoc: &Invocation, scope: Mark, force: bool)
|
||||
-> Result<Option<Lrc<SyntaxExtension>>, Determinacy>;
|
||||
fn resolve_macro_path(&mut self, path: &ast::Path, kind: MacroKind, scope: Mark,
|
||||
derives_in_scope: &[ast::Path], force: bool)
|
||||
-> Result<Lrc<SyntaxExtension>, Determinacy>;
|
||||
|
||||
fn check_unused_macros(&self);
|
||||
}
|
||||
|
||||
|
@ -761,12 +763,13 @@ impl Resolver for DummyResolver {
|
|||
fn resolve_imports(&mut self) {}
|
||||
fn find_legacy_attr_invoc(&mut self, _attrs: &mut Vec<Attribute>, _allow_derive: bool)
|
||||
-> Option<Attribute> { None }
|
||||
fn resolve_invoc(&mut self, _invoc: &Invocation, _scope: Mark, _force: bool)
|
||||
-> Result<Option<Lrc<SyntaxExtension>>, Determinacy> {
|
||||
fn resolve_macro_invocation(&mut self, _invoc: &Invocation, _scope: Mark, _force: bool)
|
||||
-> Result<Option<Lrc<SyntaxExtension>>, Determinacy> {
|
||||
Err(Determinacy::Determined)
|
||||
}
|
||||
fn resolve_macro(&mut self, _scope: Mark, _path: &ast::Path, _kind: MacroKind,
|
||||
_force: bool) -> Result<Lrc<SyntaxExtension>, Determinacy> {
|
||||
fn resolve_macro_path(&mut self, _path: &ast::Path, _kind: MacroKind, _scope: Mark,
|
||||
_derives_in_scope: &[ast::Path], _force: bool)
|
||||
-> Result<Lrc<SyntaxExtension>, Determinacy> {
|
||||
Err(Determinacy::Determined)
|
||||
}
|
||||
fn check_unused_macros(&self) {}
|
||||
|
|
|
@ -243,15 +243,6 @@ impl Invocation {
|
|||
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> {
|
||||
|
@ -343,7 +334,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
|||
|
||||
let scope =
|
||||
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),
|
||||
Err(Determinacy::Determined) => None,
|
||||
Err(Determinacy::Undetermined) => {
|
||||
|
@ -393,8 +384,8 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
|||
for path in &traits {
|
||||
let mark = Mark::fresh(self.cx.current_expansion.mark);
|
||||
derives.push(mark);
|
||||
let item = match self.cx.resolver.resolve_macro(
|
||||
Mark::root(), path, MacroKind::Derive, false) {
|
||||
let item = match self.cx.resolver.resolve_macro_path(
|
||||
path, MacroKind::Derive, Mark::root(), &[], false) {
|
||||
Ok(ext) => match *ext {
|
||||
BuiltinDerive(..) => item_with_markers.clone(),
|
||||
_ => item.clone(),
|
||||
|
|
|
@ -22,7 +22,7 @@ extern crate proc_macro_gates as 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_inner() {
|
||||
|
|
|
@ -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
|
||||
|
|
||||
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
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: can't use a procedural macro from the same crate that defines it
|
||||
--> $DIR/macro-namespace-reserved-2.rs:40:5
|
||||
|
|
||||
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
|
||||
--> $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
|
||||
| ^^^^^^^^^^^
|
||||
| ^^^^^^^^
|
||||
|
||||
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
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
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
|
||||
| ^^^^^^^^^^
|
||||
| ^^^^^^^
|
||||
|
||||
error: can't use a procedural macro from the same crate that defines it
|
||||
--> $DIR/macro-namespace-reserved-2.rs:50:10
|
||||
|
|
|
@ -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
|
||||
|
|
||||
LL | #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown
|
||||
| ^^^^^^^^
|
||||
| ^^^^^^^
|
||||
...
|
||||
LL | foo!();
|
||||
| ------- in this macro invocation
|
||||
|
|
|
@ -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)
|
||||
--> $DIR/custom_attribute.rs:13:1
|
||||
--> $DIR/custom_attribute.rs:13:3
|
||||
|
|
||||
LL | #[foo] //~ ERROR The attribute `foo`
|
||||
| ^^^^^^
|
||||
| ^^^
|
||||
|
|
||||
= 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)
|
||||
--> $DIR/custom_attribute.rs:15:5
|
||||
--> $DIR/custom_attribute.rs:15:7
|
||||
|
|
||||
LL | #[foo] //~ ERROR The attribute `foo`
|
||||
| ^^^^^^
|
||||
| ^^^
|
||||
|
|
||||
= 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)
|
||||
--> $DIR/custom_attribute.rs:17:5
|
||||
--> $DIR/custom_attribute.rs:17:7
|
||||
|
|
||||
LL | #[foo] //~ ERROR The attribute `foo`
|
||||
| ^^^^^^
|
||||
| ^^^
|
||||
|
|
||||
= help: add #![feature(custom_attribute)] to the crate attributes to enable
|
||||
|
||||
|
|
|
@ -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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= 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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(custom_attribute)] to the crate attributes to enable
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
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]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(custom_derive)] to the crate attributes to enable
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
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]
|
||||
| ^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(rustc_attrs)] to the crate attributes to enable
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
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
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(tool_attributes)] to the crate attributes to enable
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
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 | foo!();
|
||||
| ------- in this macro invocation
|
||||
|
@ -10,10 +10,10 @@ LL | foo!();
|
|||
= 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)
|
||||
--> $DIR/issue-32655.rs:28:5
|
||||
--> $DIR/issue-32655.rs:28:7
|
||||
|
|
||||
LL | #[derive_Clone] //~ ERROR attributes of the form
|
||||
| ^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(custom_derive)] to the crate attributes to enable
|
||||
|
||||
|
|
|
@ -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)
|
||||
--> $DIR/issue-49074.rs:13:1
|
||||
--> $DIR/issue-49074.rs:13:3
|
||||
|
|
||||
LL | #[marco_use] // typo
|
||||
| ^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(custom_attribute)] to the crate attributes to enable
|
||||
|
||||
|
|
|
@ -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)
|
||||
--> $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
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(custom_attribute)] to the crate attributes to enable
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
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
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(rustc_attrs)] to the crate attributes to enable
|
||||
|
||||
|
|
|
@ -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)
|
||||
--> $DIR/issue-36530.rs:11:1
|
||||
--> $DIR/issue-36530.rs:11:3
|
||||
|
|
||||
LL | #[foo] //~ ERROR is currently unknown to the compiler
|
||||
| ^^^^^^
|
||||
| ^^^
|
||||
|
|
||||
= 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)
|
||||
--> $DIR/issue-36530.rs:13:5
|
||||
--> $DIR/issue-36530.rs:13:8
|
||||
|
|
||||
LL | #![foo] //~ ERROR is currently unknown to the compiler
|
||||
| ^^^^^^^
|
||||
| ^^^
|
||||
|
|
||||
= help: add #![feature(custom_attribute)] to the crate attributes to enable
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue