Auto merge of #64313 - Centril:rollup-7w8b67g, r=Centril
Rollup of 5 pull requests Successful merges: - #63468 (Resolve attributes in several places) - #64121 (Override `StepBy::{try_fold, try_rfold}`) - #64278 (check git in bootstrap.py) - #64306 (Fix typo in config.toml.example) - #64312 (Unify escape usage) Failed merges: r? @ghost
This commit is contained in:
commit
0b36e9dea3
42 changed files with 1251 additions and 547 deletions
|
@ -184,7 +184,7 @@
|
||||||
# default.
|
# default.
|
||||||
#extended = false
|
#extended = false
|
||||||
|
|
||||||
# Installs chosen set of extended tools if enables. By default builds all.
|
# Installs chosen set of extended tools if enabled. By default builds all.
|
||||||
# If chosen tool failed to build the installation fails.
|
# If chosen tool failed to build the installation fails.
|
||||||
#tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src"]
|
#tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src"]
|
||||||
|
|
||||||
|
|
|
@ -708,6 +708,14 @@ class RustBuild(object):
|
||||||
if (not os.path.exists(os.path.join(self.rust_root, ".git"))) or \
|
if (not os.path.exists(os.path.join(self.rust_root, ".git"))) or \
|
||||||
self.get_toml('submodules') == "false":
|
self.get_toml('submodules') == "false":
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# check the existence of 'git' command
|
||||||
|
try:
|
||||||
|
subprocess.check_output(['git', '--version'])
|
||||||
|
except (subprocess.CalledProcessError, OSError):
|
||||||
|
print("error: `git` is not found, please make sure it's installed and in the path.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
slow_submodules = self.get_toml('fast-submodules') == "false"
|
slow_submodules = self.get_toml('fast-submodules') == "false"
|
||||||
start_time = time()
|
start_time = time()
|
||||||
if slow_submodules:
|
if slow_submodules:
|
||||||
|
|
|
@ -5,7 +5,7 @@ use crate::usize;
|
||||||
use crate::intrinsics;
|
use crate::intrinsics;
|
||||||
|
|
||||||
use super::{Iterator, DoubleEndedIterator, ExactSizeIterator, FusedIterator, TrustedLen};
|
use super::{Iterator, DoubleEndedIterator, ExactSizeIterator, FusedIterator, TrustedLen};
|
||||||
use super::LoopState;
|
use super::{LoopState, from_fn};
|
||||||
|
|
||||||
mod chain;
|
mod chain;
|
||||||
mod flatten;
|
mod flatten;
|
||||||
|
@ -534,6 +534,26 @@ impl<I> Iterator for StepBy<I> where I: Iterator {
|
||||||
self.iter.nth(nth - 1);
|
self.iter.nth(nth - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn try_fold<Acc, F, R>(&mut self, mut acc: Acc, mut f: F) -> R
|
||||||
|
where
|
||||||
|
F: FnMut(Acc, Self::Item) -> R,
|
||||||
|
R: Try<Ok = Acc>,
|
||||||
|
{
|
||||||
|
#[inline]
|
||||||
|
fn nth<I: Iterator>(iter: &mut I, step: usize) -> impl FnMut() -> Option<I::Item> + '_ {
|
||||||
|
move || iter.nth(step)
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.first_take {
|
||||||
|
self.first_take = false;
|
||||||
|
match self.iter.next() {
|
||||||
|
None => return Try::from_ok(acc),
|
||||||
|
Some(x) => acc = f(acc, x)?,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
from_fn(nth(&mut self.iter, self.step)).try_fold(acc, f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I> StepBy<I> where I: ExactSizeIterator {
|
impl<I> StepBy<I> where I: ExactSizeIterator {
|
||||||
|
@ -567,6 +587,28 @@ impl<I> DoubleEndedIterator for StepBy<I> where I: DoubleEndedIterator + ExactSi
|
||||||
.saturating_add(self.next_back_index());
|
.saturating_add(self.next_back_index());
|
||||||
self.iter.nth_back(n)
|
self.iter.nth_back(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn try_rfold<Acc, F, R>(&mut self, init: Acc, mut f: F) -> R
|
||||||
|
where
|
||||||
|
F: FnMut(Acc, Self::Item) -> R,
|
||||||
|
R: Try<Ok = Acc>,
|
||||||
|
{
|
||||||
|
#[inline]
|
||||||
|
fn nth_back<I: DoubleEndedIterator>(
|
||||||
|
iter: &mut I,
|
||||||
|
step: usize,
|
||||||
|
) -> impl FnMut() -> Option<I::Item> + '_ {
|
||||||
|
move || iter.nth_back(step)
|
||||||
|
}
|
||||||
|
|
||||||
|
match self.next_back() {
|
||||||
|
None => Try::from_ok(init),
|
||||||
|
Some(x) => {
|
||||||
|
let acc = f(init, x)?;
|
||||||
|
from_fn(nth_back(&mut self.iter, self.step)).try_fold(acc, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StepBy can only make the iterator shorter, so the len will still fit.
|
// StepBy can only make the iterator shorter, so the len will still fit.
|
||||||
|
|
|
@ -385,6 +385,23 @@ fn test_iterator_step_by_nth_overflow() {
|
||||||
assert_eq!(it.0, (usize::MAX as Bigger) * 1);
|
assert_eq!(it.0, (usize::MAX as Bigger) * 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_iterator_step_by_nth_try_fold() {
|
||||||
|
let mut it = (0..).step_by(10);
|
||||||
|
assert_eq!(it.try_fold(0, i8::checked_add), None);
|
||||||
|
assert_eq!(it.next(), Some(60));
|
||||||
|
assert_eq!(it.try_fold(0, i8::checked_add), None);
|
||||||
|
assert_eq!(it.next(), Some(90));
|
||||||
|
|
||||||
|
let mut it = (100..).step_by(10);
|
||||||
|
assert_eq!(it.try_fold(50, i8::checked_add), None);
|
||||||
|
assert_eq!(it.next(), Some(110));
|
||||||
|
|
||||||
|
let mut it = (100..=100).step_by(10);
|
||||||
|
assert_eq!(it.next(), Some(100));
|
||||||
|
assert_eq!(it.try_fold(0, i8::checked_add), Some(0));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_iterator_step_by_nth_back() {
|
fn test_iterator_step_by_nth_back() {
|
||||||
let mut it = (0..16).step_by(5);
|
let mut it = (0..16).step_by(5);
|
||||||
|
@ -410,6 +427,24 @@ fn test_iterator_step_by_nth_back() {
|
||||||
assert_eq!(it().nth_back(42), None);
|
assert_eq!(it().nth_back(42), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_iterator_step_by_nth_try_rfold() {
|
||||||
|
let mut it = (0..100).step_by(10);
|
||||||
|
assert_eq!(it.try_rfold(0, i8::checked_add), None);
|
||||||
|
assert_eq!(it.next_back(), Some(70));
|
||||||
|
assert_eq!(it.next(), Some(0));
|
||||||
|
assert_eq!(it.try_rfold(0, i8::checked_add), None);
|
||||||
|
assert_eq!(it.next_back(), Some(30));
|
||||||
|
|
||||||
|
let mut it = (0..100).step_by(10);
|
||||||
|
assert_eq!(it.try_rfold(50, i8::checked_add), None);
|
||||||
|
assert_eq!(it.next_back(), Some(80));
|
||||||
|
|
||||||
|
let mut it = (100..=100).step_by(10);
|
||||||
|
assert_eq!(it.next_back(), Some(100));
|
||||||
|
assert_eq!(it.try_fold(0, i8::checked_add), Some(0));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_iterator_step_by_zero() {
|
fn test_iterator_step_by_zero() {
|
||||||
|
|
|
@ -155,6 +155,9 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_variant(&mut self, v: &'a Variant) {
|
fn visit_variant(&mut self, v: &'a Variant) {
|
||||||
|
if v.is_placeholder {
|
||||||
|
return self.visit_macro_invoc(v.id);
|
||||||
|
}
|
||||||
let def = self.create_def(v.id,
|
let def = self.create_def(v.id,
|
||||||
DefPathData::TypeNs(v.ident.as_interned_str()),
|
DefPathData::TypeNs(v.ident.as_interned_str()),
|
||||||
v.span);
|
v.span);
|
||||||
|
@ -168,16 +171,24 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
|
||||||
|
|
||||||
fn visit_variant_data(&mut self, data: &'a VariantData) {
|
fn visit_variant_data(&mut self, data: &'a VariantData) {
|
||||||
for (index, field) in data.fields().iter().enumerate() {
|
for (index, field) in data.fields().iter().enumerate() {
|
||||||
|
if field.is_placeholder {
|
||||||
|
self.visit_macro_invoc(field.id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let name = field.ident.map(|ident| ident.name)
|
let name = field.ident.map(|ident| ident.name)
|
||||||
.unwrap_or_else(|| sym::integer(index));
|
.unwrap_or_else(|| sym::integer(index));
|
||||||
let def = self.create_def(field.id,
|
let def = self.create_def(field.id,
|
||||||
DefPathData::ValueNs(name.as_interned_str()),
|
DefPathData::ValueNs(name.as_interned_str()),
|
||||||
field.span);
|
field.span);
|
||||||
self.with_parent(def, |this| this.visit_struct_field(field));
|
self.with_parent(def, |this| visit::walk_struct_field(this, field));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_generic_param(&mut self, param: &'a GenericParam) {
|
fn visit_generic_param(&mut self, param: &'a GenericParam) {
|
||||||
|
if param.is_placeholder {
|
||||||
|
self.visit_macro_invoc(param.id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
let name = param.ident.as_interned_str();
|
let name = param.ident.as_interned_str();
|
||||||
let def_path_data = match param.kind {
|
let def_path_data = match param.kind {
|
||||||
GenericParamKind::Lifetime { .. } => DefPathData::LifetimeNs(name),
|
GenericParamKind::Lifetime { .. } => DefPathData::LifetimeNs(name),
|
||||||
|
@ -294,4 +305,49 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_arm(&mut self, arm: &'a Arm) {
|
||||||
|
if arm.is_placeholder {
|
||||||
|
self.visit_macro_invoc(arm.id)
|
||||||
|
} else {
|
||||||
|
visit::walk_arm(self, arm)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_field(&mut self, f: &'a Field) {
|
||||||
|
if f.is_placeholder {
|
||||||
|
self.visit_macro_invoc(f.id)
|
||||||
|
} else {
|
||||||
|
visit::walk_field(self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_field_pattern(&mut self, fp: &'a FieldPat) {
|
||||||
|
if fp.is_placeholder {
|
||||||
|
self.visit_macro_invoc(fp.id)
|
||||||
|
} else {
|
||||||
|
visit::walk_field_pattern(self, fp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_param(&mut self, p: &'a Param) {
|
||||||
|
if p.is_placeholder {
|
||||||
|
self.visit_macro_invoc(p.id)
|
||||||
|
} else {
|
||||||
|
visit::walk_param(self, p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_struct_field(&mut self, sf: &'a StructField) {
|
||||||
|
if sf.is_placeholder {
|
||||||
|
self.visit_macro_invoc(sf.id)
|
||||||
|
} else {
|
||||||
|
let name = sf.ident.map(|ident| ident.name)
|
||||||
|
.unwrap_or_else(|| panic!("don't know the field number in this context"));
|
||||||
|
let def = self.create_def(sf.id,
|
||||||
|
DefPathData::ValueNs(name.as_interned_str()),
|
||||||
|
sf.span);
|
||||||
|
self.with_parent(def, |this| visit::walk_struct_field(this, sf));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ use syntax::ast::{Name, Ident};
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
|
|
||||||
use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId};
|
use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId};
|
||||||
use syntax::ast::{MetaItemKind, StmtKind, TraitItem, TraitItemKind, Variant};
|
use syntax::ast::{MetaItemKind, StmtKind, TraitItem, TraitItemKind};
|
||||||
use syntax::ext::base::{MacroKind, SyntaxExtension};
|
use syntax::ext::base::{MacroKind, SyntaxExtension};
|
||||||
use syntax::ext::expand::AstFragment;
|
use syntax::ext::expand::AstFragment;
|
||||||
use syntax::ext::hygiene::ExpnId;
|
use syntax::ext::hygiene::ExpnId;
|
||||||
|
@ -580,7 +580,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs the reduced graph for one item.
|
/// Constructs the reduced graph for one item.
|
||||||
fn build_reduced_graph_for_item(&mut self, item: &Item) {
|
fn build_reduced_graph_for_item(&mut self, item: &'b Item) {
|
||||||
let parent_scope = &self.parent_scope;
|
let parent_scope = &self.parent_scope;
|
||||||
let parent = parent_scope.module;
|
let parent = parent_scope.module;
|
||||||
let expansion = parent_scope.expansion;
|
let expansion = parent_scope.expansion;
|
||||||
|
@ -716,12 +716,10 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
||||||
self.r.define(parent, ident, TypeNS, (res, vis, sp, expansion));
|
self.r.define(parent, ident, TypeNS, (res, vis, sp, expansion));
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemKind::Enum(ref enum_definition, _) => {
|
ItemKind::Enum(_, _) => {
|
||||||
let module_kind = ModuleKind::Def(
|
let def_id = self.r.definitions.local_def_id(item.id);
|
||||||
DefKind::Enum,
|
self.r.variant_vis.insert(def_id, vis);
|
||||||
self.r.definitions.local_def_id(item.id),
|
let module_kind = ModuleKind::Def(DefKind::Enum, def_id, ident.name);
|
||||||
ident.name,
|
|
||||||
);
|
|
||||||
let module = self.r.new_module(parent,
|
let module = self.r.new_module(parent,
|
||||||
module_kind,
|
module_kind,
|
||||||
parent.normal_ancestor_id,
|
parent.normal_ancestor_id,
|
||||||
|
@ -729,10 +727,6 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
||||||
item.span);
|
item.span);
|
||||||
self.r.define(parent, ident, TypeNS, (module, vis, sp, expansion));
|
self.r.define(parent, ident, TypeNS, (module, vis, sp, expansion));
|
||||||
self.parent_scope.module = module;
|
self.parent_scope.module = module;
|
||||||
|
|
||||||
for variant in &(*enum_definition).variants {
|
|
||||||
self.build_reduced_graph_for_variant(variant, vis);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemKind::TraitAlias(..) => {
|
ItemKind::TraitAlias(..) => {
|
||||||
|
@ -817,38 +811,6 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructs the reduced graph for one variant. Variants exist in the
|
|
||||||
// type and value namespaces.
|
|
||||||
fn build_reduced_graph_for_variant(&mut self, variant: &Variant, vis: ty::Visibility) {
|
|
||||||
let parent = self.parent_scope.module;
|
|
||||||
let expn_id = self.parent_scope.expansion;
|
|
||||||
let ident = variant.ident;
|
|
||||||
|
|
||||||
// Define a name in the type namespace.
|
|
||||||
let def_id = self.r.definitions.local_def_id(variant.id);
|
|
||||||
let res = Res::Def(DefKind::Variant, def_id);
|
|
||||||
self.r.define(parent, ident, TypeNS, (res, vis, variant.span, expn_id));
|
|
||||||
|
|
||||||
// If the variant is marked as non_exhaustive then lower the visibility to within the
|
|
||||||
// crate.
|
|
||||||
let mut ctor_vis = vis;
|
|
||||||
let has_non_exhaustive = attr::contains_name(&variant.attrs, sym::non_exhaustive);
|
|
||||||
if has_non_exhaustive && vis == ty::Visibility::Public {
|
|
||||||
ctor_vis = ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define a constructor name in the value namespace.
|
|
||||||
// Braced variants, unlike structs, generate unusable names in
|
|
||||||
// value namespace, they are reserved for possible future use.
|
|
||||||
// It's ok to use the variant's id as a ctor id since an
|
|
||||||
// error will be reported on any use of such resolution anyway.
|
|
||||||
let ctor_node_id = variant.data.ctor_id().unwrap_or(variant.id);
|
|
||||||
let ctor_def_id = self.r.definitions.local_def_id(ctor_node_id);
|
|
||||||
let ctor_kind = CtorKind::from_ast(&variant.data);
|
|
||||||
let ctor_res = Res::Def(DefKind::Ctor(CtorOf::Variant, ctor_kind), ctor_def_id);
|
|
||||||
self.r.define(parent, ident, ValueNS, (ctor_res, ctor_vis, variant.span, expn_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Constructs the reduced graph for one foreign item.
|
/// Constructs the reduced graph for one foreign item.
|
||||||
fn build_reduced_graph_for_foreign_item(&mut self, item: &ForeignItem) {
|
fn build_reduced_graph_for_foreign_item(&mut self, item: &ForeignItem) {
|
||||||
let (res, ns) = match item.node {
|
let (res, ns) = match item.node {
|
||||||
|
@ -1188,7 +1150,6 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
|
||||||
ItemKind::Mod(..) => self.contains_macro_use(&item.attrs),
|
ItemKind::Mod(..) => self.contains_macro_use(&item.attrs),
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let orig_current_module = self.parent_scope.module;
|
let orig_current_module = self.parent_scope.module;
|
||||||
let orig_current_legacy_scope = self.parent_scope.legacy;
|
let orig_current_legacy_scope = self.parent_scope.legacy;
|
||||||
self.build_reduced_graph_for_item(item);
|
self.build_reduced_graph_for_item(item);
|
||||||
|
@ -1271,4 +1232,92 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
|
||||||
}
|
}
|
||||||
visit::walk_attribute(self, attr);
|
visit::walk_attribute(self, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_arm(&mut self, arm: &'b ast::Arm) {
|
||||||
|
if arm.is_placeholder {
|
||||||
|
self.visit_invoc(arm.id);
|
||||||
|
} else {
|
||||||
|
visit::walk_arm(self, arm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_field(&mut self, f: &'b ast::Field) {
|
||||||
|
if f.is_placeholder {
|
||||||
|
self.visit_invoc(f.id);
|
||||||
|
} else {
|
||||||
|
visit::walk_field(self, f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_field_pattern(&mut self, fp: &'b ast::FieldPat) {
|
||||||
|
if fp.is_placeholder {
|
||||||
|
self.visit_invoc(fp.id);
|
||||||
|
} else {
|
||||||
|
visit::walk_field_pattern(self, fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_generic_param(&mut self, param: &'b ast::GenericParam) {
|
||||||
|
if param.is_placeholder {
|
||||||
|
self.visit_invoc(param.id);
|
||||||
|
} else {
|
||||||
|
visit::walk_generic_param(self, param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_param(&mut self, p: &'b ast::Param) {
|
||||||
|
if p.is_placeholder {
|
||||||
|
self.visit_invoc(p.id);
|
||||||
|
} else {
|
||||||
|
visit::walk_param(self, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_struct_field(&mut self, sf: &'b ast::StructField) {
|
||||||
|
if sf.is_placeholder {
|
||||||
|
self.visit_invoc(sf.id);
|
||||||
|
} else {
|
||||||
|
visit::walk_struct_field(self, sf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructs the reduced graph for one variant. Variants exist in the
|
||||||
|
// type and value namespaces.
|
||||||
|
fn visit_variant(&mut self, variant: &'b ast::Variant) {
|
||||||
|
if variant.is_placeholder {
|
||||||
|
self.visit_invoc(variant.id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let parent = self.parent_scope.module;
|
||||||
|
let vis = self.r.variant_vis[&parent.def_id().expect("enum without def-id")];
|
||||||
|
let expn_id = self.parent_scope.expansion;
|
||||||
|
let ident = variant.ident;
|
||||||
|
|
||||||
|
// Define a name in the type namespace.
|
||||||
|
let def_id = self.r.definitions.local_def_id(variant.id);
|
||||||
|
let res = Res::Def(DefKind::Variant, def_id);
|
||||||
|
self.r.define(parent, ident, TypeNS, (res, vis, variant.span, expn_id));
|
||||||
|
|
||||||
|
// If the variant is marked as non_exhaustive then lower the visibility to within the
|
||||||
|
// crate.
|
||||||
|
let mut ctor_vis = vis;
|
||||||
|
let has_non_exhaustive = attr::contains_name(&variant.attrs, sym::non_exhaustive);
|
||||||
|
if has_non_exhaustive && vis == ty::Visibility::Public {
|
||||||
|
ctor_vis = ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define a constructor name in the value namespace.
|
||||||
|
// Braced variants, unlike structs, generate unusable names in
|
||||||
|
// value namespace, they are reserved for possible future use.
|
||||||
|
// It's ok to use the variant's id as a ctor id since an
|
||||||
|
// error will be reported on any use of such resolution anyway.
|
||||||
|
let ctor_node_id = variant.data.ctor_id().unwrap_or(variant.id);
|
||||||
|
let ctor_def_id = self.r.definitions.local_def_id(ctor_node_id);
|
||||||
|
let ctor_kind = CtorKind::from_ast(&variant.data);
|
||||||
|
let ctor_res = Res::Def(DefKind::Ctor(CtorOf::Variant, ctor_kind), ctor_def_id);
|
||||||
|
self.r.define(parent, ident, ValueNS, (ctor_res, ctor_vis, variant.span, expn_id));
|
||||||
|
|
||||||
|
visit::walk_variant(self, variant);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -952,6 +952,10 @@ pub struct Resolver<'a> {
|
||||||
|
|
||||||
/// Features enabled for this crate.
|
/// Features enabled for this crate.
|
||||||
active_features: FxHashSet<Symbol>,
|
active_features: FxHashSet<Symbol>,
|
||||||
|
|
||||||
|
/// Stores enum visibilities to properly build a reduced graph
|
||||||
|
/// when visiting the correspondent variants.
|
||||||
|
variant_vis: DefIdMap<ty::Visibility>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Nothing really interesting here; it just provides memory for the rest of the crate.
|
/// Nothing really interesting here; it just provides memory for the rest of the crate.
|
||||||
|
@ -1214,6 +1218,7 @@ impl<'a> Resolver<'a> {
|
||||||
features.declared_lib_features.iter().map(|(feat, ..)| *feat)
|
features.declared_lib_features.iter().map(|(feat, ..)| *feat)
|
||||||
.chain(features.declared_lang_features.iter().map(|(feat, ..)| *feat))
|
.chain(features.declared_lang_features.iter().map(|(feat, ..)| *feat))
|
||||||
.collect(),
|
.collect(),
|
||||||
|
variant_vis: Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ use syntax::attr::StabilityLevel;
|
||||||
use syntax::edition::Edition;
|
use syntax::edition::Edition;
|
||||||
use syntax::ext::base::{self, InvocationRes, Indeterminate, SpecialDerives};
|
use syntax::ext::base::{self, InvocationRes, Indeterminate, SpecialDerives};
|
||||||
use syntax::ext::base::{MacroKind, SyntaxExtension};
|
use syntax::ext::base::{MacroKind, SyntaxExtension};
|
||||||
use syntax::ext::expand::{AstFragment, Invocation, InvocationKind};
|
use syntax::ext::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind};
|
||||||
use syntax::ext::hygiene::{self, ExpnId, ExpnData, ExpnKind};
|
use syntax::ext::hygiene::{self, ExpnId, ExpnData, ExpnKind};
|
||||||
use syntax::ext::tt::macro_rules;
|
use syntax::ext::tt::macro_rules;
|
||||||
use syntax::feature_gate::{emit_feature_err, is_builtin_attr_name};
|
use syntax::feature_gate::{emit_feature_err, is_builtin_attr_name};
|
||||||
|
@ -225,6 +225,26 @@ impl<'a> base::Resolver for Resolver<'a> {
|
||||||
self.definitions.add_parent_module_of_macro_def(invoc_id, normal_module_def_id);
|
self.definitions.add_parent_module_of_macro_def(invoc_id, normal_module_def_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
match invoc.fragment_kind {
|
||||||
|
AstFragmentKind::Arms
|
||||||
|
| AstFragmentKind::Fields
|
||||||
|
| AstFragmentKind::FieldPats
|
||||||
|
| AstFragmentKind::GenericParams
|
||||||
|
| AstFragmentKind::Params
|
||||||
|
| AstFragmentKind::StructFields
|
||||||
|
| AstFragmentKind::Variants =>
|
||||||
|
{
|
||||||
|
if let Res::Def(..) = res {
|
||||||
|
self.session.span_err(
|
||||||
|
span,
|
||||||
|
"expected an inert attribute, found an attribute macro"
|
||||||
|
);
|
||||||
|
return Ok(InvocationRes::Single(self.dummy_ext(kind)));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(InvocationRes::Single(ext))
|
Ok(InvocationRes::Single(ext))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -519,15 +519,15 @@ fn convert_variant_ctor(tcx: TyCtxt<'_>, ctor_id: hir::HirId) {
|
||||||
tcx.predicates_of(def_id);
|
tcx.predicates_of(def_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_enum_variant_types<'tcx>(
|
fn convert_enum_variant_types(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
variants: &[hir::Variant]
|
variants: &[hir::Variant]
|
||||||
) {
|
) {
|
||||||
let def = tcx.adt_def(def_id);
|
let def = tcx.adt_def(def_id);
|
||||||
let repr_type = def.repr.discr_type();
|
let repr_type = def.repr.discr_type();
|
||||||
let initial = repr_type.initial_discriminant(tcx);
|
let initial = repr_type.initial_discriminant(tcx);
|
||||||
let mut prev_discr = None::<Discr<'tcx>>;
|
let mut prev_discr = None::<Discr<'_>>;
|
||||||
|
|
||||||
// fill the discriminant values and field types
|
// fill the discriminant values and field types
|
||||||
for variant in variants {
|
for variant in variants {
|
||||||
|
|
|
@ -39,6 +39,14 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSearchInput() {
|
||||||
|
return document.getElementsByClassName("search-input")[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSearchElement() {
|
||||||
|
return document.getElementById("search");
|
||||||
|
}
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -71,7 +79,7 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
"derive",
|
"derive",
|
||||||
"traitalias"];
|
"traitalias"];
|
||||||
|
|
||||||
var search_input = document.getElementsByClassName("search-input")[0];
|
var search_input = getSearchInput();
|
||||||
|
|
||||||
// On the search screen, so you remain on the last tab you opened.
|
// On the search screen, so you remain on the last tab you opened.
|
||||||
//
|
//
|
||||||
|
@ -158,7 +166,7 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
// If we're in mobile mode, we should add the sidebar in any case.
|
// If we're in mobile mode, we should add the sidebar in any case.
|
||||||
hideSidebar();
|
hideSidebar();
|
||||||
var elem;
|
var elem;
|
||||||
var search = document.getElementById("search");
|
var search = getSearchElement();
|
||||||
var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
|
var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
|
||||||
if (match) {
|
if (match) {
|
||||||
from = parseInt(match[1], 10);
|
from = parseInt(match[1], 10);
|
||||||
|
@ -250,7 +258,12 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
return String.fromCharCode(c);
|
return String.fromCharCode(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getHelpElement() {
|
||||||
|
return document.getElementById("help");
|
||||||
|
}
|
||||||
|
|
||||||
function displayHelp(display, ev, help) {
|
function displayHelp(display, ev, help) {
|
||||||
|
var help = help ? help : getHelpElement();
|
||||||
if (display === true) {
|
if (display === true) {
|
||||||
if (hasClass(help, "hidden")) {
|
if (hasClass(help, "hidden")) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
@ -264,9 +277,10 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleEscape(ev, help) {
|
function handleEscape(ev) {
|
||||||
|
var help = getHelpElement();
|
||||||
|
var search = getSearchElement();
|
||||||
hideModal();
|
hideModal();
|
||||||
var search = document.getElementById("search");
|
|
||||||
if (hasClass(help, "hidden") === false) {
|
if (hasClass(help, "hidden") === false) {
|
||||||
displayHelp(false, ev, help);
|
displayHelp(false, ev, help);
|
||||||
} else if (hasClass(search, "hidden") === false) {
|
} else if (hasClass(search, "hidden") === false) {
|
||||||
|
@ -284,22 +298,21 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var help = document.getElementById("help");
|
|
||||||
if (document.activeElement.tagName === "INPUT") {
|
if (document.activeElement.tagName === "INPUT") {
|
||||||
switch (getVirtualKey(ev)) {
|
switch (getVirtualKey(ev)) {
|
||||||
case "Escape":
|
case "Escape":
|
||||||
handleEscape(ev, help);
|
handleEscape(ev);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (getVirtualKey(ev)) {
|
switch (getVirtualKey(ev)) {
|
||||||
case "Escape":
|
case "Escape":
|
||||||
handleEscape(ev, help);
|
handleEscape(ev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "s":
|
case "s":
|
||||||
case "S":
|
case "S":
|
||||||
displayHelp(false, ev, help);
|
displayHelp(false, ev);
|
||||||
hideModal();
|
hideModal();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
focusSearchBar();
|
focusSearchBar();
|
||||||
|
@ -314,7 +327,7 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
case "?":
|
case "?":
|
||||||
if (ev.shiftKey) {
|
if (ev.shiftKey) {
|
||||||
hideModal();
|
hideModal();
|
||||||
displayHelp(true, ev, help);
|
displayHelp(true, ev);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1281,9 +1294,7 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
} else if (e.which === 16) { // shift
|
} else if (e.which === 16) { // shift
|
||||||
// Does nothing, it's just to avoid losing "focus" on the highlighted element.
|
// Does nothing, it's just to avoid losing "focus" on the highlighted element.
|
||||||
} else if (e.which === 27) { // escape
|
} else if (e.which === 27) { // escape
|
||||||
removeClass(actives[currentTab][0], "highlighted");
|
handleEscape(e);
|
||||||
search_input.value = "";
|
|
||||||
defocusSearchBar();
|
|
||||||
} else if (actives[currentTab].length > 0) {
|
} else if (actives[currentTab].length > 0) {
|
||||||
removeClass(actives[currentTab][0], "highlighted");
|
removeClass(actives[currentTab][0], "highlighted");
|
||||||
}
|
}
|
||||||
|
@ -1434,7 +1445,7 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
ret_others[0] + ret_in_args[0] + ret_returned[0] + "</div>";
|
ret_others[0] + ret_in_args[0] + ret_returned[0] + "</div>";
|
||||||
|
|
||||||
addClass(main, "hidden");
|
addClass(main, "hidden");
|
||||||
var search = document.getElementById("search");
|
var search = getSearchElement();
|
||||||
removeClass(search, "hidden");
|
removeClass(search, "hidden");
|
||||||
search.innerHTML = output;
|
search.innerHTML = output;
|
||||||
var tds = search.getElementsByTagName("td");
|
var tds = search.getElementsByTagName("td");
|
||||||
|
@ -1644,7 +1655,7 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
if (hasClass(main, "content")) {
|
if (hasClass(main, "content")) {
|
||||||
removeClass(main, "hidden");
|
removeClass(main, "hidden");
|
||||||
}
|
}
|
||||||
var search_c = document.getElementById("search");
|
var search_c = getSearchElement();
|
||||||
if (hasClass(search_c, "content")) {
|
if (hasClass(search_c, "content")) {
|
||||||
addClass(search_c, "hidden");
|
addClass(search_c, "hidden");
|
||||||
}
|
}
|
||||||
|
@ -1691,7 +1702,7 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
if (hasClass(main, "content")) {
|
if (hasClass(main, "content")) {
|
||||||
removeClass(main, "hidden");
|
removeClass(main, "hidden");
|
||||||
}
|
}
|
||||||
var search_c = document.getElementById("search");
|
var search_c = getSearchElement();
|
||||||
if (hasClass(search_c, "content")) {
|
if (hasClass(search_c, "content")) {
|
||||||
addClass(search_c, "hidden");
|
addClass(search_c, "hidden");
|
||||||
}
|
}
|
||||||
|
@ -2460,7 +2471,7 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
var params = getQueryStringParams();
|
var params = getQueryStringParams();
|
||||||
if (params && params.search) {
|
if (params && params.search) {
|
||||||
addClass(main, "hidden");
|
addClass(main, "hidden");
|
||||||
var search = document.getElementById("search");
|
var search = getSearchElement();
|
||||||
removeClass(search, "hidden");
|
removeClass(search, "hidden");
|
||||||
search.innerHTML = "<h3 style=\"text-align: center;\">Loading search results...</h3>";
|
search.innerHTML = "<h3 style=\"text-align: center;\">Loading search results...</h3>";
|
||||||
}
|
}
|
||||||
|
@ -2545,10 +2556,10 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
|
|
||||||
// Sets the focus on the search bar at the top of the page
|
// Sets the focus on the search bar at the top of the page
|
||||||
function focusSearchBar() {
|
function focusSearchBar() {
|
||||||
document.getElementsByClassName("search-input")[0].focus();
|
getSearchInput().focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removes the focus from the search bar
|
// Removes the focus from the search bar
|
||||||
function defocusSearchBar() {
|
function defocusSearchBar() {
|
||||||
document.getElementsByClassName("search-input")[0].blur();
|
getSearchInput().blur();
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,7 +352,7 @@ pub struct GenericParam {
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
pub attrs: ThinVec<Attribute>,
|
pub attrs: ThinVec<Attribute>,
|
||||||
pub bounds: GenericBounds,
|
pub bounds: GenericBounds,
|
||||||
|
pub is_placeholder: bool,
|
||||||
pub kind: GenericParamKind,
|
pub kind: GenericParamKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,6 +613,7 @@ pub struct FieldPat {
|
||||||
pub attrs: ThinVec<Attribute>,
|
pub attrs: ThinVec<Attribute>,
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
pub is_placeholder: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
|
@ -935,6 +936,7 @@ pub struct Arm {
|
||||||
pub body: P<Expr>,
|
pub body: P<Expr>,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
|
pub is_placeholder: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
|
@ -945,6 +947,7 @@ pub struct Field {
|
||||||
pub is_shorthand: bool,
|
pub is_shorthand: bool,
|
||||||
pub attrs: ThinVec<Attribute>,
|
pub attrs: ThinVec<Attribute>,
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
|
pub is_placeholder: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
|
@ -1798,6 +1801,7 @@ pub struct Param {
|
||||||
pub pat: P<Pat>,
|
pub pat: P<Pat>,
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
pub is_placeholder: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Alternative representation for `Arg`s describing `self` parameter of methods.
|
/// Alternative representation for `Arg`s describing `self` parameter of methods.
|
||||||
|
@ -1859,6 +1863,7 @@ impl Param {
|
||||||
span,
|
span,
|
||||||
ty,
|
ty,
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
|
is_placeholder: false
|
||||||
};
|
};
|
||||||
match eself.node {
|
match eself.node {
|
||||||
SelfKind::Explicit(ty, mutbl) => param(mutbl, ty),
|
SelfKind::Explicit(ty, mutbl) => param(mutbl, ty),
|
||||||
|
@ -2054,6 +2059,8 @@ pub struct Variant {
|
||||||
pub disr_expr: Option<AnonConst>,
|
pub disr_expr: Option<AnonConst>,
|
||||||
/// Span
|
/// Span
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
/// Is a macro placeholder
|
||||||
|
pub is_placeholder: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Part of `use` item to the right of its prefix.
|
/// Part of `use` item to the right of its prefix.
|
||||||
|
@ -2216,6 +2223,7 @@ pub struct StructField {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub ty: P<Ty>,
|
pub ty: P<Ty>,
|
||||||
pub attrs: Vec<Attribute>,
|
pub attrs: Vec<Attribute>,
|
||||||
|
pub is_placeholder: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fields and constructor ids of enum variants and structs.
|
/// Fields and constructor ids of enum variants and structs.
|
||||||
|
|
|
@ -35,6 +35,13 @@ pub enum Annotatable {
|
||||||
ForeignItem(P<ast::ForeignItem>),
|
ForeignItem(P<ast::ForeignItem>),
|
||||||
Stmt(P<ast::Stmt>),
|
Stmt(P<ast::Stmt>),
|
||||||
Expr(P<ast::Expr>),
|
Expr(P<ast::Expr>),
|
||||||
|
Arm(ast::Arm),
|
||||||
|
Field(ast::Field),
|
||||||
|
FieldPat(ast::FieldPat),
|
||||||
|
GenericParam(ast::GenericParam),
|
||||||
|
Param(ast::Param),
|
||||||
|
StructField(ast::StructField),
|
||||||
|
Variant(ast::Variant),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasAttrs for Annotatable {
|
impl HasAttrs for Annotatable {
|
||||||
|
@ -46,6 +53,13 @@ impl HasAttrs for Annotatable {
|
||||||
Annotatable::ForeignItem(ref foreign_item) => &foreign_item.attrs,
|
Annotatable::ForeignItem(ref foreign_item) => &foreign_item.attrs,
|
||||||
Annotatable::Stmt(ref stmt) => stmt.attrs(),
|
Annotatable::Stmt(ref stmt) => stmt.attrs(),
|
||||||
Annotatable::Expr(ref expr) => &expr.attrs,
|
Annotatable::Expr(ref expr) => &expr.attrs,
|
||||||
|
Annotatable::Arm(ref arm) => &arm.attrs,
|
||||||
|
Annotatable::Field(ref field) => &field.attrs,
|
||||||
|
Annotatable::FieldPat(ref fp) => &fp.attrs,
|
||||||
|
Annotatable::GenericParam(ref gp) => &gp.attrs,
|
||||||
|
Annotatable::Param(ref p) => &p.attrs,
|
||||||
|
Annotatable::StructField(ref sf) => &sf.attrs,
|
||||||
|
Annotatable::Variant(ref v) => &v.attrs(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +71,13 @@ impl HasAttrs for Annotatable {
|
||||||
Annotatable::ForeignItem(foreign_item) => foreign_item.visit_attrs(f),
|
Annotatable::ForeignItem(foreign_item) => foreign_item.visit_attrs(f),
|
||||||
Annotatable::Stmt(stmt) => stmt.visit_attrs(f),
|
Annotatable::Stmt(stmt) => stmt.visit_attrs(f),
|
||||||
Annotatable::Expr(expr) => expr.visit_attrs(f),
|
Annotatable::Expr(expr) => expr.visit_attrs(f),
|
||||||
|
Annotatable::Arm(arm) => arm.visit_attrs(f),
|
||||||
|
Annotatable::Field(field) => field.visit_attrs(f),
|
||||||
|
Annotatable::FieldPat(fp) => fp.visit_attrs(f),
|
||||||
|
Annotatable::GenericParam(gp) => gp.visit_attrs(f),
|
||||||
|
Annotatable::Param(p) => p.visit_attrs(f),
|
||||||
|
Annotatable::StructField(sf) => sf.visit_attrs(f),
|
||||||
|
Annotatable::Variant(v) => v.visit_attrs(f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +91,13 @@ impl Annotatable {
|
||||||
Annotatable::ForeignItem(ref foreign_item) => foreign_item.span,
|
Annotatable::ForeignItem(ref foreign_item) => foreign_item.span,
|
||||||
Annotatable::Stmt(ref stmt) => stmt.span,
|
Annotatable::Stmt(ref stmt) => stmt.span,
|
||||||
Annotatable::Expr(ref expr) => expr.span,
|
Annotatable::Expr(ref expr) => expr.span,
|
||||||
|
Annotatable::Arm(ref arm) => arm.span,
|
||||||
|
Annotatable::Field(ref field) => field.span,
|
||||||
|
Annotatable::FieldPat(ref fp) => fp.pat.span,
|
||||||
|
Annotatable::GenericParam(ref gp) => gp.ident.span,
|
||||||
|
Annotatable::Param(ref p) => p.span,
|
||||||
|
Annotatable::StructField(ref sf) => sf.span,
|
||||||
|
Annotatable::Variant(ref v) => v.span,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +109,13 @@ impl Annotatable {
|
||||||
Annotatable::ForeignItem(foreign_item) => visitor.visit_foreign_item(foreign_item),
|
Annotatable::ForeignItem(foreign_item) => visitor.visit_foreign_item(foreign_item),
|
||||||
Annotatable::Stmt(stmt) => visitor.visit_stmt(stmt),
|
Annotatable::Stmt(stmt) => visitor.visit_stmt(stmt),
|
||||||
Annotatable::Expr(expr) => visitor.visit_expr(expr),
|
Annotatable::Expr(expr) => visitor.visit_expr(expr),
|
||||||
|
Annotatable::Arm(arm) => visitor.visit_arm(arm),
|
||||||
|
Annotatable::Field(field) => visitor.visit_field(field),
|
||||||
|
Annotatable::FieldPat(fp) => visitor.visit_field_pattern(fp),
|
||||||
|
Annotatable::GenericParam(gp) => visitor.visit_generic_param(gp),
|
||||||
|
Annotatable::Param(p) => visitor.visit_param(p),
|
||||||
|
Annotatable::StructField(sf) =>visitor.visit_struct_field(sf),
|
||||||
|
Annotatable::Variant(v) => visitor.visit_variant(v),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +171,55 @@ impl Annotatable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn expect_arm(self) -> ast::Arm {
|
||||||
|
match self {
|
||||||
|
Annotatable::Arm(arm) => arm,
|
||||||
|
_ => panic!("expected match arm")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn expect_field(self) -> ast::Field {
|
||||||
|
match self {
|
||||||
|
Annotatable::Field(field) => field,
|
||||||
|
_ => panic!("expected field")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn expect_field_pattern(self) -> ast::FieldPat {
|
||||||
|
match self {
|
||||||
|
Annotatable::FieldPat(fp) => fp,
|
||||||
|
_ => panic!("expected field pattern")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn expect_generic_param(self) -> ast::GenericParam {
|
||||||
|
match self {
|
||||||
|
Annotatable::GenericParam(gp) => gp,
|
||||||
|
_ => panic!("expected generic parameter")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn expect_param(self) -> ast::Param {
|
||||||
|
match self {
|
||||||
|
Annotatable::Param(param) => param,
|
||||||
|
_ => panic!("expected parameter")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn expect_struct_field(self) -> ast::StructField {
|
||||||
|
match self {
|
||||||
|
Annotatable::StructField(sf) => sf,
|
||||||
|
_ => panic!("expected struct field")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn expect_variant(self) -> ast::Variant {
|
||||||
|
match self {
|
||||||
|
Annotatable::Variant(v) => v,
|
||||||
|
_ => panic!("expected variant")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn derive_allowed(&self) -> bool {
|
pub fn derive_allowed(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
Annotatable::Item(ref item) => match item.node {
|
Annotatable::Item(ref item) => match item.node {
|
||||||
|
@ -325,6 +409,34 @@ pub trait MacResult {
|
||||||
fn make_ty(self: Box<Self>) -> Option<P<ast::Ty>> {
|
fn make_ty(self: Box<Self>) -> Option<P<ast::Ty>> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn make_arms(self: Box<Self>) -> Option<SmallVec<[ast::Arm; 1]>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_fields(self: Box<Self>) -> Option<SmallVec<[ast::Field; 1]>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_field_patterns(self: Box<Self>) -> Option<SmallVec<[ast::FieldPat; 1]>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_generic_params(self: Box<Self>) -> Option<SmallVec<[ast::GenericParam; 1]>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_params(self: Box<Self>) -> Option<SmallVec<[ast::Param; 1]>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_struct_fields(self: Box<Self>) -> Option<SmallVec<[ast::StructField; 1]>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_variants(self: Box<Self>) -> Option<SmallVec<[ast::Variant; 1]>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! make_MacEager {
|
macro_rules! make_MacEager {
|
||||||
|
@ -498,6 +610,34 @@ impl MacResult for DummyResult {
|
||||||
fn make_ty(self: Box<DummyResult>) -> Option<P<ast::Ty>> {
|
fn make_ty(self: Box<DummyResult>) -> Option<P<ast::Ty>> {
|
||||||
Some(DummyResult::raw_ty(self.span, self.is_error))
|
Some(DummyResult::raw_ty(self.span, self.is_error))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn make_arms(self: Box<DummyResult>) -> Option<SmallVec<[ast::Arm; 1]>> {
|
||||||
|
Some(SmallVec::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_fields(self: Box<DummyResult>) -> Option<SmallVec<[ast::Field; 1]>> {
|
||||||
|
Some(SmallVec::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_field_patterns(self: Box<DummyResult>) -> Option<SmallVec<[ast::FieldPat; 1]>> {
|
||||||
|
Some(SmallVec::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_generic_params(self: Box<DummyResult>) -> Option<SmallVec<[ast::GenericParam; 1]>> {
|
||||||
|
Some(SmallVec::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_params(self: Box<DummyResult>) -> Option<SmallVec<[ast::Param; 1]>> {
|
||||||
|
Some(SmallVec::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_struct_fields(self: Box<DummyResult>) -> Option<SmallVec<[ast::StructField; 1]>> {
|
||||||
|
Some(SmallVec::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_variants(self: Box<DummyResult>) -> Option<SmallVec<[ast::Variant; 1]>> {
|
||||||
|
Some(SmallVec::new())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A syntax extension kind.
|
/// A syntax extension kind.
|
||||||
|
|
|
@ -166,7 +166,8 @@ impl<'a> ExtCtxt<'a> {
|
||||||
bounds,
|
bounds,
|
||||||
kind: ast::GenericParamKind::Type {
|
kind: ast::GenericParamKind::Type {
|
||||||
default,
|
default,
|
||||||
}
|
},
|
||||||
|
is_placeholder: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +208,7 @@ impl<'a> ExtCtxt<'a> {
|
||||||
attrs: attrs.into(),
|
attrs: attrs.into(),
|
||||||
bounds,
|
bounds,
|
||||||
kind: ast::GenericParamKind::Lifetime,
|
kind: ast::GenericParamKind::Lifetime,
|
||||||
|
is_placeholder: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +406,7 @@ impl<'a> ExtCtxt<'a> {
|
||||||
is_shorthand: false,
|
is_shorthand: false,
|
||||||
attrs: ThinVec::new(),
|
attrs: ThinVec::new(),
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
|
is_placeholder: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn expr_struct(
|
pub fn expr_struct(
|
||||||
|
@ -614,6 +617,7 @@ impl<'a> ExtCtxt<'a> {
|
||||||
body: expr,
|
body: expr,
|
||||||
span,
|
span,
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
|
is_placeholder: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,6 +705,7 @@ impl<'a> ExtCtxt<'a> {
|
||||||
pat: arg_pat,
|
pat: arg_pat,
|
||||||
span,
|
span,
|
||||||
ty,
|
ty,
|
||||||
|
is_placeholder: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,6 +779,7 @@ impl<'a> ExtCtxt<'a> {
|
||||||
vis: respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited),
|
vis: respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited),
|
||||||
attrs: Vec::new(),
|
attrs: Vec::new(),
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
|
is_placeholder: false,
|
||||||
}
|
}
|
||||||
}).collect();
|
}).collect();
|
||||||
|
|
||||||
|
@ -790,6 +796,7 @@ impl<'a> ExtCtxt<'a> {
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
ident,
|
ident,
|
||||||
span,
|
span,
|
||||||
|
is_placeholder: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,40 @@ ast_fragments! {
|
||||||
"impl item"; many fn flat_map_impl_item; fn visit_impl_item; fn make_impl_items;
|
"impl item"; many fn flat_map_impl_item; fn visit_impl_item; fn make_impl_items;
|
||||||
}
|
}
|
||||||
ForeignItems(SmallVec<[ast::ForeignItem; 1]>) {
|
ForeignItems(SmallVec<[ast::ForeignItem; 1]>) {
|
||||||
"foreign item"; many fn flat_map_foreign_item; fn visit_foreign_item; fn make_foreign_items;
|
"foreign item";
|
||||||
|
many fn flat_map_foreign_item;
|
||||||
|
fn visit_foreign_item;
|
||||||
|
fn make_foreign_items;
|
||||||
|
}
|
||||||
|
Arms(SmallVec<[ast::Arm; 1]>) {
|
||||||
|
"match arm"; many fn flat_map_arm; fn visit_arm; fn make_arms;
|
||||||
|
}
|
||||||
|
Fields(SmallVec<[ast::Field; 1]>) {
|
||||||
|
"field expression"; many fn flat_map_field; fn visit_field; fn make_fields;
|
||||||
|
}
|
||||||
|
FieldPats(SmallVec<[ast::FieldPat; 1]>) {
|
||||||
|
"field pattern";
|
||||||
|
many fn flat_map_field_pattern;
|
||||||
|
fn visit_field_pattern;
|
||||||
|
fn make_field_patterns;
|
||||||
|
}
|
||||||
|
GenericParams(SmallVec<[ast::GenericParam; 1]>) {
|
||||||
|
"generic parameter";
|
||||||
|
many fn flat_map_generic_param;
|
||||||
|
fn visit_generic_param;
|
||||||
|
fn make_generic_params;
|
||||||
|
}
|
||||||
|
Params(SmallVec<[ast::Param; 1]>) {
|
||||||
|
"function parameter"; many fn flat_map_param; fn visit_param; fn make_params;
|
||||||
|
}
|
||||||
|
StructFields(SmallVec<[ast::StructField; 1]>) {
|
||||||
|
"field";
|
||||||
|
many fn flat_map_struct_field;
|
||||||
|
fn visit_struct_field;
|
||||||
|
fn make_struct_fields;
|
||||||
|
}
|
||||||
|
Variants(SmallVec<[ast::Variant; 1]>) {
|
||||||
|
"variant"; many fn flat_map_variant; fn visit_variant; fn make_variants;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +187,21 @@ impl AstFragmentKind {
|
||||||
-> AstFragment {
|
-> AstFragment {
|
||||||
let mut items = items.into_iter();
|
let mut items = items.into_iter();
|
||||||
match self {
|
match self {
|
||||||
|
AstFragmentKind::Arms =>
|
||||||
|
AstFragment::Arms(items.map(Annotatable::expect_arm).collect()),
|
||||||
|
AstFragmentKind::Fields =>
|
||||||
|
AstFragment::Fields(items.map(Annotatable::expect_field).collect()),
|
||||||
|
AstFragmentKind::FieldPats =>
|
||||||
|
AstFragment::FieldPats(items.map(Annotatable::expect_field_pattern).collect()),
|
||||||
|
AstFragmentKind::GenericParams =>
|
||||||
|
AstFragment::GenericParams(items.map(Annotatable::expect_generic_param).collect()),
|
||||||
|
AstFragmentKind::Params =>
|
||||||
|
AstFragment::Params(items.map(Annotatable::expect_param).collect()),
|
||||||
|
AstFragmentKind::StructFields => AstFragment::StructFields(
|
||||||
|
items.map(Annotatable::expect_struct_field).collect()
|
||||||
|
),
|
||||||
|
AstFragmentKind::Variants =>
|
||||||
|
AstFragment::Variants(items.map(Annotatable::expect_variant).collect()),
|
||||||
AstFragmentKind::Items =>
|
AstFragmentKind::Items =>
|
||||||
AstFragment::Items(items.map(Annotatable::expect_item).collect()),
|
AstFragment::Items(items.map(Annotatable::expect_item).collect()),
|
||||||
AstFragmentKind::ImplItems =>
|
AstFragmentKind::ImplItems =>
|
||||||
|
@ -177,7 +225,7 @@ impl AstFragmentKind {
|
||||||
|
|
||||||
pub struct Invocation {
|
pub struct Invocation {
|
||||||
pub kind: InvocationKind,
|
pub kind: InvocationKind,
|
||||||
fragment_kind: AstFragmentKind,
|
pub fragment_kind: AstFragmentKind,
|
||||||
pub expansion_data: ExpansionData,
|
pub expansion_data: ExpansionData,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,6 +530,27 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||||
Annotatable::Expr(mut expr) => {
|
Annotatable::Expr(mut expr) => {
|
||||||
Annotatable::Expr({ cfg.visit_expr(&mut expr); expr })
|
Annotatable::Expr({ cfg.visit_expr(&mut expr); expr })
|
||||||
}
|
}
|
||||||
|
Annotatable::Arm(arm) => {
|
||||||
|
Annotatable::Arm(cfg.flat_map_arm(arm).pop().unwrap())
|
||||||
|
}
|
||||||
|
Annotatable::Field(field) => {
|
||||||
|
Annotatable::Field(cfg.flat_map_field(field).pop().unwrap())
|
||||||
|
}
|
||||||
|
Annotatable::FieldPat(fp) => {
|
||||||
|
Annotatable::FieldPat(cfg.flat_map_field_pattern(fp).pop().unwrap())
|
||||||
|
}
|
||||||
|
Annotatable::GenericParam(param) => {
|
||||||
|
Annotatable::GenericParam(cfg.flat_map_generic_param(param).pop().unwrap())
|
||||||
|
}
|
||||||
|
Annotatable::Param(param) => {
|
||||||
|
Annotatable::Param(cfg.flat_map_param(param).pop().unwrap())
|
||||||
|
}
|
||||||
|
Annotatable::StructField(sf) => {
|
||||||
|
Annotatable::StructField(cfg.flat_map_struct_field(sf).pop().unwrap())
|
||||||
|
}
|
||||||
|
Annotatable::Variant(v) => {
|
||||||
|
Annotatable::Variant(cfg.flat_map_variant(v).pop().unwrap())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,6 +616,14 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||||
Annotatable::ForeignItem(item) => token::NtForeignItem(item.into_inner()),
|
Annotatable::ForeignItem(item) => token::NtForeignItem(item.into_inner()),
|
||||||
Annotatable::Stmt(stmt) => token::NtStmt(stmt.into_inner()),
|
Annotatable::Stmt(stmt) => token::NtStmt(stmt.into_inner()),
|
||||||
Annotatable::Expr(expr) => token::NtExpr(expr),
|
Annotatable::Expr(expr) => token::NtExpr(expr),
|
||||||
|
Annotatable::Arm(..)
|
||||||
|
| Annotatable::Field(..)
|
||||||
|
| Annotatable::FieldPat(..)
|
||||||
|
| Annotatable::GenericParam(..)
|
||||||
|
| Annotatable::Param(..)
|
||||||
|
| Annotatable::StructField(..)
|
||||||
|
| Annotatable::Variant(..)
|
||||||
|
=> panic!("unexpected annotatable"),
|
||||||
})), DUMMY_SP).into();
|
})), DUMMY_SP).into();
|
||||||
let input = self.extract_proc_macro_attr_input(attr.tokens, span);
|
let input = self.extract_proc_macro_attr_input(attr.tokens, span);
|
||||||
let tok_result = expander.expand(self.cx, span, input, item_tok);
|
let tok_result = expander.expand(self.cx, span, input, item_tok);
|
||||||
|
@ -625,6 +702,14 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||||
Annotatable::Expr(_) if self.cx.ecfg.proc_macro_hygiene() => return,
|
Annotatable::Expr(_) if self.cx.ecfg.proc_macro_hygiene() => return,
|
||||||
Annotatable::Stmt(_) => ("statements", sym::proc_macro_hygiene),
|
Annotatable::Stmt(_) => ("statements", sym::proc_macro_hygiene),
|
||||||
Annotatable::Expr(_) => ("expressions", sym::proc_macro_hygiene),
|
Annotatable::Expr(_) => ("expressions", sym::proc_macro_hygiene),
|
||||||
|
Annotatable::Arm(..)
|
||||||
|
| Annotatable::Field(..)
|
||||||
|
| Annotatable::FieldPat(..)
|
||||||
|
| Annotatable::GenericParam(..)
|
||||||
|
| Annotatable::Param(..)
|
||||||
|
| Annotatable::StructField(..)
|
||||||
|
| Annotatable::Variant(..)
|
||||||
|
=> panic!("unexpected annotatable"),
|
||||||
};
|
};
|
||||||
emit_feature_err(
|
emit_feature_err(
|
||||||
self.cx.parse_sess,
|
self.cx.parse_sess,
|
||||||
|
@ -681,6 +766,14 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||||
AstFragmentKind::TraitItems => return,
|
AstFragmentKind::TraitItems => return,
|
||||||
AstFragmentKind::ImplItems => return,
|
AstFragmentKind::ImplItems => return,
|
||||||
AstFragmentKind::ForeignItems => return,
|
AstFragmentKind::ForeignItems => return,
|
||||||
|
AstFragmentKind::Arms
|
||||||
|
| AstFragmentKind::Fields
|
||||||
|
| AstFragmentKind::FieldPats
|
||||||
|
| AstFragmentKind::GenericParams
|
||||||
|
| AstFragmentKind::Params
|
||||||
|
| AstFragmentKind::StructFields
|
||||||
|
| AstFragmentKind::Variants
|
||||||
|
=> panic!("unexpected AST fragment kind"),
|
||||||
};
|
};
|
||||||
if self.cx.ecfg.proc_macro_hygiene() {
|
if self.cx.ecfg.proc_macro_hygiene() {
|
||||||
return
|
return
|
||||||
|
@ -771,6 +864,14 @@ impl<'a> Parser<'a> {
|
||||||
},
|
},
|
||||||
AstFragmentKind::Ty => AstFragment::Ty(self.parse_ty()?),
|
AstFragmentKind::Ty => AstFragment::Ty(self.parse_ty()?),
|
||||||
AstFragmentKind::Pat => AstFragment::Pat(self.parse_pat(None)?),
|
AstFragmentKind::Pat => AstFragment::Pat(self.parse_pat(None)?),
|
||||||
|
AstFragmentKind::Arms
|
||||||
|
| AstFragmentKind::Fields
|
||||||
|
| AstFragmentKind::FieldPats
|
||||||
|
| AstFragmentKind::GenericParams
|
||||||
|
| AstFragmentKind::Params
|
||||||
|
| AstFragmentKind::StructFields
|
||||||
|
| AstFragmentKind::Variants
|
||||||
|
=> panic!("unexpected AST fragment kind"),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -972,6 +1073,84 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn flat_map_arm(&mut self, arm: ast::Arm) -> SmallVec<[ast::Arm; 1]> {
|
||||||
|
let mut arm = configure!(self, arm);
|
||||||
|
|
||||||
|
let (attr, traits, after_derive) = self.classify_item(&mut arm);
|
||||||
|
if attr.is_some() || !traits.is_empty() {
|
||||||
|
return self.collect_attr(attr, traits, Annotatable::Arm(arm),
|
||||||
|
AstFragmentKind::Arms, after_derive)
|
||||||
|
.make_arms();
|
||||||
|
}
|
||||||
|
|
||||||
|
noop_flat_map_arm(arm, self)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flat_map_field(&mut self, field: ast::Field) -> SmallVec<[ast::Field; 1]> {
|
||||||
|
let mut field = configure!(self, field);
|
||||||
|
|
||||||
|
let (attr, traits, after_derive) = self.classify_item(&mut field);
|
||||||
|
if attr.is_some() || !traits.is_empty() {
|
||||||
|
return self.collect_attr(attr, traits, Annotatable::Field(field),
|
||||||
|
AstFragmentKind::Fields, after_derive)
|
||||||
|
.make_fields();
|
||||||
|
}
|
||||||
|
|
||||||
|
noop_flat_map_field(field, self)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flat_map_field_pattern(&mut self, fp: ast::FieldPat) -> SmallVec<[ast::FieldPat; 1]> {
|
||||||
|
let mut fp = configure!(self, fp);
|
||||||
|
|
||||||
|
let (attr, traits, after_derive) = self.classify_item(&mut fp);
|
||||||
|
if attr.is_some() || !traits.is_empty() {
|
||||||
|
return self.collect_attr(attr, traits, Annotatable::FieldPat(fp),
|
||||||
|
AstFragmentKind::FieldPats, after_derive)
|
||||||
|
.make_field_patterns();
|
||||||
|
}
|
||||||
|
|
||||||
|
noop_flat_map_field_pattern(fp, self)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flat_map_param(&mut self, p: ast::Param) -> SmallVec<[ast::Param; 1]> {
|
||||||
|
let mut p = configure!(self, p);
|
||||||
|
|
||||||
|
let (attr, traits, after_derive) = self.classify_item(&mut p);
|
||||||
|
if attr.is_some() || !traits.is_empty() {
|
||||||
|
return self.collect_attr(attr, traits, Annotatable::Param(p),
|
||||||
|
AstFragmentKind::Params, after_derive)
|
||||||
|
.make_params();
|
||||||
|
}
|
||||||
|
|
||||||
|
noop_flat_map_param(p, self)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flat_map_struct_field(&mut self, sf: ast::StructField) -> SmallVec<[ast::StructField; 1]> {
|
||||||
|
let mut sf = configure!(self, sf);
|
||||||
|
|
||||||
|
let (attr, traits, after_derive) = self.classify_item(&mut sf);
|
||||||
|
if attr.is_some() || !traits.is_empty() {
|
||||||
|
return self.collect_attr(attr, traits, Annotatable::StructField(sf),
|
||||||
|
AstFragmentKind::StructFields, after_derive)
|
||||||
|
.make_struct_fields();
|
||||||
|
}
|
||||||
|
|
||||||
|
noop_flat_map_struct_field(sf, self)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flat_map_variant(&mut self, variant: ast::Variant) -> SmallVec<[ast::Variant; 1]> {
|
||||||
|
let mut variant = configure!(self, variant);
|
||||||
|
|
||||||
|
let (attr, traits, after_derive) = self.classify_item(&mut variant);
|
||||||
|
if attr.is_some() || !traits.is_empty() {
|
||||||
|
return self.collect_attr(attr, traits, Annotatable::Variant(variant),
|
||||||
|
AstFragmentKind::Variants, after_derive)
|
||||||
|
.make_variants();
|
||||||
|
}
|
||||||
|
|
||||||
|
noop_flat_map_variant(variant, self)
|
||||||
|
}
|
||||||
|
|
||||||
fn filter_map_expr(&mut self, expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
|
fn filter_map_expr(&mut self, expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
|
||||||
let expr = configure!(self, expr);
|
let expr = configure!(self, expr);
|
||||||
expr.filter_map(|mut expr| {
|
expr.filter_map(|mut expr| {
|
||||||
|
@ -1227,12 +1406,20 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn flat_map_generic_param(
|
fn flat_map_generic_param(
|
||||||
&mut self,
|
&mut self,
|
||||||
param: ast::GenericParam
|
param: ast::GenericParam
|
||||||
) -> SmallVec<[ast::GenericParam; 1]>
|
) -> SmallVec<[ast::GenericParam; 1]>
|
||||||
{
|
{
|
||||||
let param = configure!(self, param);
|
let mut param = configure!(self, param);
|
||||||
|
|
||||||
|
let (attr, traits, after_derive) = self.classify_item(&mut param);
|
||||||
|
if attr.is_some() || !traits.is_empty() {
|
||||||
|
return self.collect_attr(attr, traits, Annotatable::GenericParam(param),
|
||||||
|
AstFragmentKind::GenericParams, after_derive)
|
||||||
|
.make_generic_params();
|
||||||
|
}
|
||||||
|
|
||||||
noop_flat_map_generic_param(param, self)
|
noop_flat_map_generic_param(param, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,16 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
|
||||||
attrs: ThinVec::new(),
|
attrs: ThinVec::new(),
|
||||||
node: ast::ExprKind::Mac(mac_placeholder()),
|
node: ast::ExprKind::Mac(mac_placeholder()),
|
||||||
});
|
});
|
||||||
|
let ty = P(ast::Ty {
|
||||||
|
id,
|
||||||
|
node: ast::TyKind::Mac(mac_placeholder()),
|
||||||
|
span,
|
||||||
|
});
|
||||||
|
let pat = P(ast::Pat {
|
||||||
|
id,
|
||||||
|
node: ast::PatKind::Mac(mac_placeholder()),
|
||||||
|
span,
|
||||||
|
});
|
||||||
|
|
||||||
match kind {
|
match kind {
|
||||||
AstFragmentKind::Expr => AstFragment::Expr(expr_placeholder()),
|
AstFragmentKind::Expr => AstFragment::Expr(expr_placeholder()),
|
||||||
|
@ -67,6 +77,81 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
|
||||||
let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ThinVec::new()));
|
let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ThinVec::new()));
|
||||||
ast::Stmt { id, span, node: ast::StmtKind::Mac(mac) }
|
ast::Stmt { id, span, node: ast::StmtKind::Mac(mac) }
|
||||||
}]),
|
}]),
|
||||||
|
AstFragmentKind::Arms => AstFragment::Arms(smallvec![
|
||||||
|
ast::Arm {
|
||||||
|
attrs: Default::default(),
|
||||||
|
body: expr_placeholder(),
|
||||||
|
guard: None,
|
||||||
|
id,
|
||||||
|
pat,
|
||||||
|
span,
|
||||||
|
is_placeholder: true,
|
||||||
|
}
|
||||||
|
]),
|
||||||
|
AstFragmentKind::Fields => AstFragment::Fields(smallvec![
|
||||||
|
ast::Field {
|
||||||
|
attrs: Default::default(),
|
||||||
|
expr: expr_placeholder(),
|
||||||
|
id,
|
||||||
|
ident,
|
||||||
|
is_shorthand: false,
|
||||||
|
span,
|
||||||
|
is_placeholder: true,
|
||||||
|
}
|
||||||
|
]),
|
||||||
|
AstFragmentKind::FieldPats => AstFragment::FieldPats(smallvec![
|
||||||
|
ast::FieldPat {
|
||||||
|
attrs: Default::default(),
|
||||||
|
id,
|
||||||
|
ident,
|
||||||
|
is_shorthand: false,
|
||||||
|
pat,
|
||||||
|
span,
|
||||||
|
is_placeholder: true,
|
||||||
|
}
|
||||||
|
]),
|
||||||
|
AstFragmentKind::GenericParams => AstFragment::GenericParams(smallvec![{
|
||||||
|
ast::GenericParam {
|
||||||
|
attrs: Default::default(),
|
||||||
|
bounds: Default::default(),
|
||||||
|
id,
|
||||||
|
ident,
|
||||||
|
is_placeholder: true,
|
||||||
|
kind: ast::GenericParamKind::Lifetime,
|
||||||
|
}
|
||||||
|
}]),
|
||||||
|
AstFragmentKind::Params => AstFragment::Params(smallvec![
|
||||||
|
ast::Param {
|
||||||
|
attrs: Default::default(),
|
||||||
|
id,
|
||||||
|
pat,
|
||||||
|
span,
|
||||||
|
ty,
|
||||||
|
is_placeholder: true,
|
||||||
|
}
|
||||||
|
]),
|
||||||
|
AstFragmentKind::StructFields => AstFragment::StructFields(smallvec![
|
||||||
|
ast::StructField {
|
||||||
|
attrs: Default::default(),
|
||||||
|
id,
|
||||||
|
ident: None,
|
||||||
|
span,
|
||||||
|
ty,
|
||||||
|
vis,
|
||||||
|
is_placeholder: true,
|
||||||
|
}
|
||||||
|
]),
|
||||||
|
AstFragmentKind::Variants => AstFragment::Variants(smallvec![
|
||||||
|
ast::Variant {
|
||||||
|
attrs: Default::default(),
|
||||||
|
data: ast::VariantData::Struct(Default::default(), false),
|
||||||
|
disr_expr: None,
|
||||||
|
id,
|
||||||
|
ident,
|
||||||
|
span,
|
||||||
|
is_placeholder: true,
|
||||||
|
}
|
||||||
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +190,66 @@ impl<'a, 'b> PlaceholderExpander<'a, 'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> {
|
impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> {
|
||||||
|
fn flat_map_arm(&mut self, arm: ast::Arm) -> SmallVec<[ast::Arm; 1]> {
|
||||||
|
if arm.is_placeholder {
|
||||||
|
self.remove(arm.id).make_arms()
|
||||||
|
} else {
|
||||||
|
noop_flat_map_arm(arm, self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flat_map_field(&mut self, field: ast::Field) -> SmallVec<[ast::Field; 1]> {
|
||||||
|
if field.is_placeholder {
|
||||||
|
self.remove(field.id).make_fields()
|
||||||
|
} else {
|
||||||
|
noop_flat_map_field(field, self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flat_map_field_pattern(&mut self, fp: ast::FieldPat) -> SmallVec<[ast::FieldPat; 1]> {
|
||||||
|
if fp.is_placeholder {
|
||||||
|
self.remove(fp.id).make_field_patterns()
|
||||||
|
} else {
|
||||||
|
noop_flat_map_field_pattern(fp, self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flat_map_generic_param(
|
||||||
|
&mut self,
|
||||||
|
param: ast::GenericParam
|
||||||
|
) -> SmallVec<[ast::GenericParam; 1]>
|
||||||
|
{
|
||||||
|
if param.is_placeholder {
|
||||||
|
self.remove(param.id).make_generic_params()
|
||||||
|
} else {
|
||||||
|
noop_flat_map_generic_param(param, self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flat_map_param(&mut self, p: ast::Param) -> SmallVec<[ast::Param; 1]> {
|
||||||
|
if p.is_placeholder {
|
||||||
|
self.remove(p.id).make_params()
|
||||||
|
} else {
|
||||||
|
noop_flat_map_param(p, self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flat_map_struct_field(&mut self, sf: ast::StructField) -> SmallVec<[ast::StructField; 1]> {
|
||||||
|
if sf.is_placeholder {
|
||||||
|
self.remove(sf.id).make_struct_fields()
|
||||||
|
} else {
|
||||||
|
noop_flat_map_struct_field(sf, self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flat_map_variant(&mut self, variant: ast::Variant) -> SmallVec<[ast::Variant; 1]> {
|
||||||
|
if variant.is_placeholder {
|
||||||
|
self.remove(variant.id).make_variants()
|
||||||
|
} else {
|
||||||
|
noop_flat_map_variant(variant, self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn flat_map_item(&mut self, item: P<ast::Item>) -> SmallVec<[P<ast::Item>; 1]> {
|
fn flat_map_item(&mut self, item: P<ast::Item>) -> SmallVec<[P<ast::Item>; 1]> {
|
||||||
match item.node {
|
match item.node {
|
||||||
ast::ItemKind::Mac(_) => return self.remove(item.id).make_items(),
|
ast::ItemKind::Mac(_) => return self.remove(item.id).make_items(),
|
||||||
|
|
|
@ -88,6 +88,14 @@ impl MultiItemModifier for ProcMacroDerive {
|
||||||
item: Annotatable)
|
item: Annotatable)
|
||||||
-> Vec<Annotatable> {
|
-> Vec<Annotatable> {
|
||||||
let item = match item {
|
let item = match item {
|
||||||
|
Annotatable::Arm(..) |
|
||||||
|
Annotatable::Field(..) |
|
||||||
|
Annotatable::FieldPat(..) |
|
||||||
|
Annotatable::GenericParam(..) |
|
||||||
|
Annotatable::Param(..) |
|
||||||
|
Annotatable::StructField(..) |
|
||||||
|
Annotatable::Variant(..)
|
||||||
|
=> panic!("unexpected annotatable"),
|
||||||
Annotatable::Item(item) => item,
|
Annotatable::Item(item) => item,
|
||||||
Annotatable::ImplItem(_) |
|
Annotatable::ImplItem(_) |
|
||||||
Annotatable::TraitItem(_) |
|
Annotatable::TraitItem(_) |
|
||||||
|
|
|
@ -370,6 +370,7 @@ pub fn noop_flat_map_field_pattern<T: MutVisitor>(
|
||||||
attrs,
|
attrs,
|
||||||
id,
|
id,
|
||||||
ident,
|
ident,
|
||||||
|
is_placeholder: _,
|
||||||
is_shorthand: _,
|
is_shorthand: _,
|
||||||
pat,
|
pat,
|
||||||
span,
|
span,
|
||||||
|
@ -403,7 +404,7 @@ pub fn noop_visit_use_tree<T: MutVisitor>(use_tree: &mut UseTree, vis: &mut T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_flat_map_arm<T: MutVisitor>(mut arm: Arm, vis: &mut T) -> SmallVec<[Arm; 1]> {
|
pub fn noop_flat_map_arm<T: MutVisitor>(mut arm: Arm, vis: &mut T) -> SmallVec<[Arm; 1]> {
|
||||||
let Arm { attrs, pat, guard, body, span, id } = &mut arm;
|
let Arm { attrs, pat, guard, body, span, id, is_placeholder: _ } = &mut arm;
|
||||||
visit_attrs(attrs, vis);
|
visit_attrs(attrs, vis);
|
||||||
vis.visit_id(id);
|
vis.visit_id(id);
|
||||||
vis.visit_pat(pat);
|
vis.visit_pat(pat);
|
||||||
|
@ -477,7 +478,7 @@ pub fn noop_visit_foreign_mod<T: MutVisitor>(foreign_mod: &mut ForeignMod, vis:
|
||||||
pub fn noop_flat_map_variant<T: MutVisitor>(mut variant: Variant, vis: &mut T)
|
pub fn noop_flat_map_variant<T: MutVisitor>(mut variant: Variant, vis: &mut T)
|
||||||
-> SmallVec<[Variant; 1]>
|
-> SmallVec<[Variant; 1]>
|
||||||
{
|
{
|
||||||
let Variant { ident, attrs, id, data, disr_expr, span } = &mut variant;
|
let Variant { ident, attrs, id, data, disr_expr, span, is_placeholder: _ } = &mut variant;
|
||||||
vis.visit_ident(ident);
|
vis.visit_ident(ident);
|
||||||
visit_attrs(attrs, vis);
|
visit_attrs(attrs, vis);
|
||||||
vis.visit_id(id);
|
vis.visit_id(id);
|
||||||
|
@ -585,7 +586,7 @@ pub fn noop_visit_meta_item<T: MutVisitor>(mi: &mut MetaItem, vis: &mut T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_flat_map_param<T: MutVisitor>(mut param: Param, vis: &mut T) -> SmallVec<[Param; 1]> {
|
pub fn noop_flat_map_param<T: MutVisitor>(mut param: Param, vis: &mut T) -> SmallVec<[Param; 1]> {
|
||||||
let Param { attrs, id, pat, span, ty } = &mut param;
|
let Param { attrs, id, pat, span, ty, is_placeholder: _ } = &mut param;
|
||||||
vis.visit_id(id);
|
vis.visit_id(id);
|
||||||
visit_thin_attrs(attrs, vis);
|
visit_thin_attrs(attrs, vis);
|
||||||
vis.visit_pat(pat);
|
vis.visit_pat(pat);
|
||||||
|
@ -736,7 +737,7 @@ pub fn noop_flat_map_generic_param<T: MutVisitor>(
|
||||||
vis: &mut T
|
vis: &mut T
|
||||||
) -> SmallVec<[GenericParam; 1]>
|
) -> SmallVec<[GenericParam; 1]>
|
||||||
{
|
{
|
||||||
let GenericParam { id, ident, attrs, bounds, kind } = &mut param;
|
let GenericParam { id, ident, attrs, bounds, kind, is_placeholder: _ } = &mut param;
|
||||||
vis.visit_id(id);
|
vis.visit_id(id);
|
||||||
vis.visit_ident(ident);
|
vis.visit_ident(ident);
|
||||||
visit_thin_attrs(attrs, vis);
|
visit_thin_attrs(attrs, vis);
|
||||||
|
@ -828,7 +829,7 @@ pub fn noop_visit_poly_trait_ref<T: MutVisitor>(p: &mut PolyTraitRef, vis: &mut
|
||||||
pub fn noop_flat_map_struct_field<T: MutVisitor>(mut sf: StructField, visitor: &mut T)
|
pub fn noop_flat_map_struct_field<T: MutVisitor>(mut sf: StructField, visitor: &mut T)
|
||||||
-> SmallVec<[StructField; 1]>
|
-> SmallVec<[StructField; 1]>
|
||||||
{
|
{
|
||||||
let StructField { span, ident, vis, id, ty, attrs } = &mut sf;
|
let StructField { span, ident, vis, id, ty, attrs, is_placeholder: _ } = &mut sf;
|
||||||
visitor.visit_span(span);
|
visitor.visit_span(span);
|
||||||
visit_opt(ident, |ident| visitor.visit_ident(ident));
|
visit_opt(ident, |ident| visitor.visit_ident(ident));
|
||||||
visitor.visit_vis(vis);
|
visitor.visit_vis(vis);
|
||||||
|
@ -839,7 +840,7 @@ pub fn noop_flat_map_struct_field<T: MutVisitor>(mut sf: StructField, visitor: &
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_flat_map_field<T: MutVisitor>(mut f: Field, vis: &mut T) -> SmallVec<[Field; 1]> {
|
pub fn noop_flat_map_field<T: MutVisitor>(mut f: Field, vis: &mut T) -> SmallVec<[Field; 1]> {
|
||||||
let Field { ident, expr, span, is_shorthand: _, attrs, id } = &mut f;
|
let Field { ident, expr, span, is_shorthand: _, attrs, id, is_placeholder: _ } = &mut f;
|
||||||
vis.visit_ident(ident);
|
vis.visit_ident(ident);
|
||||||
vis.visit_expr(expr);
|
vis.visit_expr(expr);
|
||||||
vis.visit_id(id);
|
vis.visit_id(id);
|
||||||
|
|
|
@ -29,7 +29,14 @@ crate fn dummy_arg(ident: Ident) -> Param {
|
||||||
span: ident.span,
|
span: ident.span,
|
||||||
id: ast::DUMMY_NODE_ID
|
id: ast::DUMMY_NODE_ID
|
||||||
};
|
};
|
||||||
Param { attrs: ThinVec::default(), id: ast::DUMMY_NODE_ID, pat, span: ident.span, ty: P(ty) }
|
Param {
|
||||||
|
attrs: ThinVec::default(),
|
||||||
|
id: ast::DUMMY_NODE_ID,
|
||||||
|
pat,
|
||||||
|
span: ident.span,
|
||||||
|
ty: P(ty),
|
||||||
|
is_placeholder: false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
|
|
|
@ -1040,7 +1040,14 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
let span = lo.to(self.token.span);
|
let span = lo.to(self.token.span);
|
||||||
|
|
||||||
Ok(Param { attrs: attrs.into(), id: DUMMY_NODE_ID, pat, span, ty })
|
Ok(Param {
|
||||||
|
attrs: attrs.into(),
|
||||||
|
id: ast::DUMMY_NODE_ID,
|
||||||
|
is_placeholder: false,
|
||||||
|
pat,
|
||||||
|
span,
|
||||||
|
ty,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses mutability (`mut` or nothing).
|
/// Parses mutability (`mut` or nothing).
|
||||||
|
|
|
@ -1193,7 +1193,8 @@ impl<'a> Parser<'a> {
|
||||||
ty: t,
|
ty: t,
|
||||||
pat,
|
pat,
|
||||||
span,
|
span,
|
||||||
id: DUMMY_NODE_ID
|
id: DUMMY_NODE_ID,
|
||||||
|
is_placeholder: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1455,6 +1456,7 @@ impl<'a> Parser<'a> {
|
||||||
body: expr,
|
body: expr,
|
||||||
span: lo.to(hi),
|
span: lo.to(hi),
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
|
is_placeholder: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1611,6 +1613,7 @@ impl<'a> Parser<'a> {
|
||||||
is_shorthand: false,
|
is_shorthand: false,
|
||||||
attrs: ThinVec::new(),
|
attrs: ThinVec::new(),
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
|
is_placeholder: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1697,6 +1700,7 @@ impl<'a> Parser<'a> {
|
||||||
is_shorthand,
|
is_shorthand,
|
||||||
attrs: attrs.into(),
|
attrs: attrs.into(),
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
|
is_placeholder: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@ impl<'a> Parser<'a> {
|
||||||
bounds,
|
bounds,
|
||||||
kind: GenericParamKind::Type {
|
kind: GenericParamKind::Type {
|
||||||
default,
|
default,
|
||||||
}
|
},
|
||||||
|
is_placeholder: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +67,8 @@ impl<'a> Parser<'a> {
|
||||||
bounds: Vec::new(),
|
bounds: Vec::new(),
|
||||||
kind: GenericParamKind::Const {
|
kind: GenericParamKind::Const {
|
||||||
ty,
|
ty,
|
||||||
}
|
},
|
||||||
|
is_placeholder: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +92,7 @@ impl<'a> Parser<'a> {
|
||||||
attrs: attrs.into(),
|
attrs: attrs.into(),
|
||||||
bounds,
|
bounds,
|
||||||
kind: ast::GenericParamKind::Lifetime,
|
kind: ast::GenericParamKind::Lifetime,
|
||||||
|
is_placeholder: false
|
||||||
});
|
});
|
||||||
} else if self.check_keyword(kw::Const) {
|
} else if self.check_keyword(kw::Const) {
|
||||||
// Parse const parameter.
|
// Parse const parameter.
|
||||||
|
|
|
@ -1575,6 +1575,7 @@ impl<'a> Parser<'a> {
|
||||||
data: struct_def,
|
data: struct_def,
|
||||||
disr_expr,
|
disr_expr,
|
||||||
span: vlo.to(self.prev_span),
|
span: vlo.to(self.prev_span),
|
||||||
|
is_placeholder: false,
|
||||||
};
|
};
|
||||||
variants.push(vr);
|
variants.push(vr);
|
||||||
|
|
||||||
|
@ -1730,6 +1731,7 @@ impl<'a> Parser<'a> {
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
ty,
|
ty,
|
||||||
attrs,
|
attrs,
|
||||||
|
is_placeholder: false,
|
||||||
})
|
})
|
||||||
}).map(|(r, _)| r)
|
}).map(|(r, _)| r)
|
||||||
}
|
}
|
||||||
|
@ -1821,6 +1823,7 @@ impl<'a> Parser<'a> {
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
ty,
|
ty,
|
||||||
attrs,
|
attrs,
|
||||||
|
is_placeholder: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -882,6 +882,7 @@ impl<'a> Parser<'a> {
|
||||||
attrs: attrs.into(),
|
attrs: attrs.into(),
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
span: lo.to(hi),
|
span: lo.to(hi),
|
||||||
|
is_placeholder: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ fn test_variant_to_string() {
|
||||||
data: ast::VariantData::Unit(ast::DUMMY_NODE_ID),
|
data: ast::VariantData::Unit(ast::DUMMY_NODE_ID),
|
||||||
disr_expr: None,
|
disr_expr: None,
|
||||||
span: syntax_pos::DUMMY_SP,
|
span: syntax_pos::DUMMY_SP,
|
||||||
|
is_placeholder: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let varstr = variant_to_string(&var);
|
let varstr = variant_to_string(&var);
|
||||||
|
|
|
@ -1620,6 +1620,7 @@ impl<'a> TraitDef<'a> {
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
span: pat.span.with_ctxt(self.span.ctxt()),
|
span: pat.span.with_ctxt(self.span.ctxt()),
|
||||||
pat,
|
pat,
|
||||||
|
is_placeholder: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
40
src/test/ui/attrs-resolution-errors.rs
Normal file
40
src/test/ui/attrs-resolution-errors.rs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
enum FooEnum {
|
||||||
|
#[test]
|
||||||
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
|
Bar(i32),
|
||||||
|
}
|
||||||
|
|
||||||
|
struct FooStruct {
|
||||||
|
#[test]
|
||||||
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
|
bar: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let foo_enum_bar = FooEnum::Bar(1);
|
||||||
|
match foo_enum_bar {
|
||||||
|
FooEnum::Bar(x) => {},
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
let foo_struct = FooStruct { bar: 1 };
|
||||||
|
match foo_struct {
|
||||||
|
FooStruct {
|
||||||
|
#[test] bar
|
||||||
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
|
} => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
match 1 {
|
||||||
|
0 => {}
|
||||||
|
#[test]
|
||||||
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
let _another_foo_strunct = FooStruct {
|
||||||
|
#[test]
|
||||||
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
|
bar: 1,
|
||||||
|
};
|
||||||
|
}
|
32
src/test/ui/attrs-resolution-errors.stderr
Normal file
32
src/test/ui/attrs-resolution-errors.stderr
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/attrs-resolution-errors.rs:2:5
|
||||||
|
|
|
||||||
|
LL | #[test]
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/attrs-resolution-errors.rs:8:5
|
||||||
|
|
|
||||||
|
LL | #[test]
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/attrs-resolution-errors.rs:23:13
|
||||||
|
|
|
||||||
|
LL | #[test] bar
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/attrs-resolution-errors.rs:30:9
|
||||||
|
|
|
||||||
|
LL | #[test]
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/attrs-resolution-errors.rs:36:9
|
||||||
|
|
|
||||||
|
LL | #[test]
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 5 previous errors
|
||||||
|
|
37
src/test/ui/attrs-resolution.rs
Normal file
37
src/test/ui/attrs-resolution.rs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
// check-pass
|
||||||
|
|
||||||
|
enum FooEnum {
|
||||||
|
#[rustfmt::skip]
|
||||||
|
Bar(i32),
|
||||||
|
}
|
||||||
|
|
||||||
|
struct FooStruct {
|
||||||
|
#[rustfmt::skip]
|
||||||
|
bar: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let foo_enum_bar = FooEnum::Bar(1);
|
||||||
|
match foo_enum_bar {
|
||||||
|
FooEnum::Bar(x) => {}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
let foo_struct = FooStruct { bar: 1 };
|
||||||
|
match foo_struct {
|
||||||
|
FooStruct {
|
||||||
|
#[rustfmt::skip] bar
|
||||||
|
} => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
match 1 {
|
||||||
|
0 => {}
|
||||||
|
#[rustfmt::skip]
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
let _another_foo_strunct = FooStruct {
|
||||||
|
#[rustfmt::skip]
|
||||||
|
bar: 1,
|
||||||
|
};
|
||||||
|
}
|
|
@ -16,21 +16,23 @@ struct WhereBad where for<#[cfg(no)] 'a, #[cfg(yes)] T> u8: Copy;
|
||||||
//~^ ERROR only lifetime parameters can be used in this context
|
//~^ ERROR only lifetime parameters can be used in this context
|
||||||
|
|
||||||
fn f_lt_no<#[cfg_attr(no, unknown)] 'a>() {} // OK
|
fn f_lt_no<#[cfg_attr(no, unknown)] 'a>() {} // OK
|
||||||
fn f_lt_yes<#[cfg_attr(yes, unknown)] 'a>() {} //~ ERROR attribute `unknown` is currently unknown
|
fn f_lt_yes<#[cfg_attr(yes, unknown)] 'a>() {}
|
||||||
|
//~^ ERROR cannot find attribute macro `unknown` in this scope
|
||||||
fn f_ty_no<#[cfg_attr(no, unknown)] T>() {} // OK
|
fn f_ty_no<#[cfg_attr(no, unknown)] T>() {} // OK
|
||||||
fn f_ty_yes<#[cfg_attr(yes, unknown)] T>() {} //~ ERROR attribute `unknown` is currently unknown
|
fn f_ty_yes<#[cfg_attr(yes, unknown)] T>() {}
|
||||||
|
//~^ ERROR cannot find attribute macro `unknown` in this scope
|
||||||
|
|
||||||
type FnNo = for<#[cfg_attr(no, unknown)] 'a> fn(); // OK
|
type FnNo = for<#[cfg_attr(no, unknown)] 'a> fn(); // OK
|
||||||
type FnYes = for<#[cfg_attr(yes, unknown)] 'a> fn();
|
type FnYes = for<#[cfg_attr(yes, unknown)] 'a> fn();
|
||||||
//~^ ERROR attribute `unknown` is currently unknown
|
//~^ ERROR cannot find attribute macro `unknown` in this scope
|
||||||
|
|
||||||
type PolyNo = dyn for<#[cfg_attr(no, unknown)] 'a> Copy; // OK
|
type PolyNo = dyn for<#[cfg_attr(no, unknown)] 'a> Copy; // OK
|
||||||
type PolyYes = dyn for<#[cfg_attr(yes, unknown)] 'a> Copy;
|
type PolyYes = dyn for<#[cfg_attr(yes, unknown)] 'a> Copy;
|
||||||
//~^ ERROR attribute `unknown` is currently unknown
|
//~^ ERROR cannot find attribute macro `unknown` in this scope
|
||||||
|
|
||||||
struct WhereNo where for<#[cfg_attr(no, unknown)] 'a> u8: Copy; // OK
|
struct WhereNo where for<#[cfg_attr(no, unknown)] 'a> u8: Copy; // OK
|
||||||
struct WhereYes where for<#[cfg_attr(yes, unknown)] 'a> u8: Copy;
|
struct WhereYes where for<#[cfg_attr(yes, unknown)] 'a> u8: Copy;
|
||||||
//~^ ERROR attribute `unknown` is currently unknown
|
//~^ ERROR cannot find attribute macro `unknown` in this scope
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
f_lt::<'static>();
|
f_lt::<'static>();
|
||||||
|
|
|
@ -16,51 +16,35 @@ error: only lifetime parameters can be used in this context
|
||||||
LL | struct WhereBad where for<#[cfg(no)] 'a, #[cfg(yes)] T> u8: Copy;
|
LL | struct WhereBad where for<#[cfg(no)] 'a, #[cfg(yes)] T> u8: Copy;
|
||||||
| ^
|
| ^
|
||||||
|
|
||||||
error[E0658]: the attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future
|
error: cannot find attribute macro `unknown` in this scope
|
||||||
|
--> $DIR/cfg-generic-params.rs:34:43
|
||||||
|
|
|
||||||
|
LL | struct WhereYes where for<#[cfg_attr(yes, unknown)] 'a> u8: Copy;
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `unknown` in this scope
|
||||||
|
--> $DIR/cfg-generic-params.rs:30:40
|
||||||
|
|
|
||||||
|
LL | type PolyYes = dyn for<#[cfg_attr(yes, unknown)] 'a> Copy;
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `unknown` in this scope
|
||||||
|
--> $DIR/cfg-generic-params.rs:26:34
|
||||||
|
|
|
||||||
|
LL | type FnYes = for<#[cfg_attr(yes, unknown)] 'a> fn();
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `unknown` in this scope
|
||||||
|
--> $DIR/cfg-generic-params.rs:22:29
|
||||||
|
|
|
||||||
|
LL | fn f_ty_yes<#[cfg_attr(yes, unknown)] T>() {}
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `unknown` in this scope
|
||||||
--> $DIR/cfg-generic-params.rs:19:29
|
--> $DIR/cfg-generic-params.rs:19:29
|
||||||
|
|
|
|
||||||
LL | fn f_lt_yes<#[cfg_attr(yes, unknown)] 'a>() {}
|
LL | fn f_lt_yes<#[cfg_attr(yes, unknown)] 'a>() {}
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/cfg-generic-params.rs:21:29
|
|
||||||
|
|
|
||||||
LL | fn f_ty_yes<#[cfg_attr(yes, unknown)] T>() {}
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/cfg-generic-params.rs:24:34
|
|
||||||
|
|
|
||||||
LL | type FnYes = for<#[cfg_attr(yes, unknown)] 'a> fn();
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/cfg-generic-params.rs:28:40
|
|
||||||
|
|
|
||||||
LL | type PolyYes = dyn for<#[cfg_attr(yes, unknown)] 'a> Copy;
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/cfg-generic-params.rs:32:43
|
|
||||||
|
|
|
||||||
LL | struct WhereYes where for<#[cfg_attr(yes, unknown)] 'a> u8: Copy;
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
|
||||||
|
|
|
@ -4,54 +4,54 @@
|
||||||
// gate-test-custom_attribute
|
// gate-test-custom_attribute
|
||||||
|
|
||||||
struct StLt<#[lt_struct] 'a>(&'a u32);
|
struct StLt<#[lt_struct] 'a>(&'a u32);
|
||||||
//~^ ERROR the attribute `lt_struct` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `lt_struct` in this scope
|
||||||
struct StTy<#[ty_struct] I>(I);
|
struct StTy<#[ty_struct] I>(I);
|
||||||
//~^ ERROR the attribute `ty_struct` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `ty_struct` in this scope
|
||||||
|
|
||||||
enum EnLt<#[lt_enum] 'b> { A(&'b u32), B }
|
enum EnLt<#[lt_enum] 'b> { A(&'b u32), B }
|
||||||
//~^ ERROR the attribute `lt_enum` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `lt_enum` in this scope
|
||||||
enum EnTy<#[ty_enum] J> { A(J), B }
|
enum EnTy<#[ty_enum] J> { A(J), B }
|
||||||
//~^ ERROR the attribute `ty_enum` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `ty_enum` in this scope
|
||||||
|
|
||||||
trait TrLt<#[lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
|
trait TrLt<#[lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
|
||||||
//~^ ERROR the attribute `lt_trait` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `lt_trait` in this scope
|
||||||
trait TrTy<#[ty_trait] K> { fn foo(&self, _: K); }
|
trait TrTy<#[ty_trait] K> { fn foo(&self, _: K); }
|
||||||
//~^ ERROR the attribute `ty_trait` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `ty_trait` in this scope
|
||||||
|
|
||||||
type TyLt<#[lt_type] 'd> = &'d u32;
|
type TyLt<#[lt_type] 'd> = &'d u32;
|
||||||
//~^ ERROR the attribute `lt_type` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `lt_type` in this scope
|
||||||
type TyTy<#[ty_type] L> = (L, );
|
type TyTy<#[ty_type] L> = (L, );
|
||||||
//~^ ERROR the attribute `ty_type` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `ty_type` in this scope
|
||||||
|
|
||||||
impl<#[lt_inherent] 'e> StLt<'e> { }
|
impl<#[lt_inherent] 'e> StLt<'e> { }
|
||||||
//~^ ERROR the attribute `lt_inherent` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `lt_inherent` in this scope
|
||||||
impl<#[ty_inherent] M> StTy<M> { }
|
impl<#[ty_inherent] M> StTy<M> { }
|
||||||
//~^ ERROR the attribute `ty_inherent` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `ty_inherent` in this scope
|
||||||
|
|
||||||
impl<#[lt_impl_for] 'f> TrLt<'f> for StLt<'f> {
|
impl<#[lt_impl_for] 'f> TrLt<'f> for StLt<'f> {
|
||||||
//~^ ERROR the attribute `lt_impl_for` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `lt_impl_for` in this scope
|
||||||
fn foo(&self, _: &'f [u32]) -> &'f u32 { loop { } }
|
fn foo(&self, _: &'f [u32]) -> &'f u32 { loop { } }
|
||||||
}
|
}
|
||||||
impl<#[ty_impl_for] N> TrTy<N> for StTy<N> {
|
impl<#[ty_impl_for] N> TrTy<N> for StTy<N> {
|
||||||
//~^ ERROR the attribute `ty_impl_for` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `ty_impl_for` in this scope
|
||||||
fn foo(&self, _: N) { }
|
fn foo(&self, _: N) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f_lt<#[lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
|
fn f_lt<#[lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
|
||||||
//~^ ERROR the attribute `lt_fn` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `lt_fn` in this scope
|
||||||
fn f_ty<#[ty_fn] O>(_: O) { }
|
fn f_ty<#[ty_fn] O>(_: O) { }
|
||||||
//~^ ERROR the attribute `ty_fn` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `ty_fn` in this scope
|
||||||
|
|
||||||
impl<I> StTy<I> {
|
impl<I> StTy<I> {
|
||||||
fn m_lt<#[lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
|
fn m_lt<#[lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
|
||||||
//~^ ERROR the attribute `lt_meth` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `lt_meth` in this scope
|
||||||
fn m_ty<#[ty_meth] P>(_: P) { }
|
fn m_ty<#[ty_meth] P>(_: P) { }
|
||||||
//~^ ERROR the attribute `ty_meth` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `ty_meth` in this scope
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hof_lt<Q>(_: Q)
|
fn hof_lt<Q>(_: Q)
|
||||||
where Q: for <#[lt_hof] 'i> Fn(&'i [u32]) -> &'i u32
|
where Q: for <#[lt_hof] 'i> Fn(&'i [u32]) -> &'i u32
|
||||||
//~^ ERROR the attribute `lt_hof` is currently unknown to the compiler
|
//~^ ERROR cannot find attribute macro `lt_hof` in this scope
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,156 +1,104 @@
|
||||||
error[E0658]: the attribute `lt_struct` is currently unknown to the compiler and may have meaning added to it in the future
|
error: cannot find attribute macro `lt_hof` in this scope
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:6:13
|
--> $DIR/feature-gate-custom_attribute2.rs:53:21
|
||||||
|
|
|
||||||
LL | struct StLt<#[lt_struct] 'a>(&'a u32);
|
|
||||||
| ^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `ty_struct` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:8:13
|
|
||||||
|
|
|
||||||
LL | struct StTy<#[ty_struct] I>(I);
|
|
||||||
| ^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `lt_enum` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:11:11
|
|
||||||
|
|
|
||||||
LL | enum EnLt<#[lt_enum] 'b> { A(&'b u32), B }
|
|
||||||
| ^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `ty_enum` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:13:11
|
|
||||||
|
|
|
||||||
LL | enum EnTy<#[ty_enum] J> { A(J), B }
|
|
||||||
| ^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `lt_trait` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:16:12
|
|
||||||
|
|
|
||||||
LL | trait TrLt<#[lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
|
|
||||||
| ^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `ty_trait` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:18:12
|
|
||||||
|
|
|
||||||
LL | trait TrTy<#[ty_trait] K> { fn foo(&self, _: K); }
|
|
||||||
| ^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `lt_type` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:21:11
|
|
||||||
|
|
|
||||||
LL | type TyLt<#[lt_type] 'd> = &'d u32;
|
|
||||||
| ^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `ty_type` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:23:11
|
|
||||||
|
|
|
||||||
LL | type TyTy<#[ty_type] L> = (L, );
|
|
||||||
| ^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `lt_inherent` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:26:6
|
|
||||||
|
|
|
||||||
LL | impl<#[lt_inherent] 'e> StLt<'e> { }
|
|
||||||
| ^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `ty_inherent` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:28:6
|
|
||||||
|
|
|
||||||
LL | impl<#[ty_inherent] M> StTy<M> { }
|
|
||||||
| ^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `lt_impl_for` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:31:6
|
|
||||||
|
|
|
||||||
LL | impl<#[lt_impl_for] 'f> TrLt<'f> for StLt<'f> {
|
|
||||||
| ^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `ty_impl_for` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:35:6
|
|
||||||
|
|
|
||||||
LL | impl<#[ty_impl_for] N> TrTy<N> for StTy<N> {
|
|
||||||
| ^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `lt_fn` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:40:9
|
|
||||||
|
|
|
||||||
LL | fn f_lt<#[lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `ty_fn` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:42:9
|
|
||||||
|
|
|
||||||
LL | fn f_ty<#[ty_fn] O>(_: O) { }
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `lt_meth` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:46:13
|
|
||||||
|
|
|
||||||
LL | fn m_lt<#[lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
|
|
||||||
| ^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `ty_meth` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:48:13
|
|
||||||
|
|
|
||||||
LL | fn m_ty<#[ty_meth] P>(_: P) { }
|
|
||||||
| ^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `lt_hof` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/feature-gate-custom_attribute2.rs:53:19
|
|
||||||
|
|
|
|
||||||
LL | where Q: for <#[lt_hof] 'i> Fn(&'i [u32]) -> &'i u32
|
LL | where Q: for <#[lt_hof] 'i> Fn(&'i [u32]) -> &'i u32
|
||||||
| ^^^^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `ty_meth` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:48:15
|
||||||
|
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
LL | fn m_ty<#[ty_meth] P>(_: P) { }
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `lt_meth` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:46:15
|
||||||
|
|
|
||||||
|
LL | fn m_lt<#[lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `ty_fn` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:42:11
|
||||||
|
|
|
||||||
|
LL | fn f_ty<#[ty_fn] O>(_: O) { }
|
||||||
|
| ^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `lt_fn` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:40:11
|
||||||
|
|
|
||||||
|
LL | fn f_lt<#[lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
|
||||||
|
| ^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `ty_impl_for` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:35:8
|
||||||
|
|
|
||||||
|
LL | impl<#[ty_impl_for] N> TrTy<N> for StTy<N> {
|
||||||
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `lt_impl_for` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:31:8
|
||||||
|
|
|
||||||
|
LL | impl<#[lt_impl_for] 'f> TrLt<'f> for StLt<'f> {
|
||||||
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `ty_inherent` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:28:8
|
||||||
|
|
|
||||||
|
LL | impl<#[ty_inherent] M> StTy<M> { }
|
||||||
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `lt_inherent` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:26:8
|
||||||
|
|
|
||||||
|
LL | impl<#[lt_inherent] 'e> StLt<'e> { }
|
||||||
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `ty_type` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:23:13
|
||||||
|
|
|
||||||
|
LL | type TyTy<#[ty_type] L> = (L, );
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `lt_type` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:21:13
|
||||||
|
|
|
||||||
|
LL | type TyLt<#[lt_type] 'd> = &'d u32;
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `ty_trait` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:18:14
|
||||||
|
|
|
||||||
|
LL | trait TrTy<#[ty_trait] K> { fn foo(&self, _: K); }
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `lt_trait` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:16:14
|
||||||
|
|
|
||||||
|
LL | trait TrLt<#[lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `ty_enum` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:13:13
|
||||||
|
|
|
||||||
|
LL | enum EnTy<#[ty_enum] J> { A(J), B }
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `lt_enum` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:11:13
|
||||||
|
|
|
||||||
|
LL | enum EnLt<#[lt_enum] 'b> { A(&'b u32), B }
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `ty_struct` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:8:15
|
||||||
|
|
|
||||||
|
LL | struct StTy<#[ty_struct] I>(I);
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
|
error: cannot find attribute macro `lt_struct` in this scope
|
||||||
|
--> $DIR/feature-gate-custom_attribute2.rs:6:15
|
||||||
|
|
|
||||||
|
LL | struct StLt<#[lt_struct] 'a>(&'a u32);
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 17 previous errors
|
error: aborting due to 17 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
|
||||||
|
|
13
src/test/ui/issues/issue-49934-errors.rs
Normal file
13
src/test/ui/issues/issue-49934-errors.rs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
fn foo<#[derive(Debug)] T>() {
|
||||||
|
//~^ ERROR `derive` may only be applied to structs, enums and unions
|
||||||
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
|
match 0 {
|
||||||
|
#[derive(Debug)]
|
||||||
|
//~^ ERROR `derive` may only be applied to structs, enums and unions
|
||||||
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
}
|
26
src/test/ui/issues/issue-49934-errors.stderr
Normal file
26
src/test/ui/issues/issue-49934-errors.stderr
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
error: `derive` may only be applied to structs, enums and unions
|
||||||
|
--> $DIR/issue-49934-errors.rs:1:8
|
||||||
|
|
|
||||||
|
LL | fn foo<#[derive(Debug)] T>() {
|
||||||
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/issue-49934-errors.rs:1:17
|
||||||
|
|
|
||||||
|
LL | fn foo<#[derive(Debug)] T>() {
|
||||||
|
| ^^^^^
|
||||||
|
|
||||||
|
error: `derive` may only be applied to structs, enums and unions
|
||||||
|
--> $DIR/issue-49934-errors.rs:5:9
|
||||||
|
|
|
||||||
|
LL | #[derive(Debug)]
|
||||||
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/issue-49934-errors.rs:5:18
|
||||||
|
|
|
||||||
|
LL | #[derive(Debug)]
|
||||||
|
| ^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
// build-pass (FIXME(62277): could be check-pass?)
|
// check-pass
|
||||||
|
|
||||||
#![feature(stmt_expr_attributes)]
|
#![feature(stmt_expr_attributes)]
|
||||||
#![warn(unused_attributes)] //~ NOTE lint level defined here
|
#![warn(unused_attributes)] //~ NOTE lint level defined here
|
||||||
|
|
||||||
fn foo<#[derive(Debug)] T>() { //~ WARN unused attribute
|
|
||||||
match 0 {
|
|
||||||
#[derive(Debug)] //~ WARN unused attribute
|
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// fold_stmt (Item)
|
// fold_stmt (Item)
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
warning: `#[derive]` does nothing on macro invocations
|
warning: `#[derive]` does nothing on macro invocations
|
||||||
--> $DIR/issue-49934.rs:20:5
|
--> $DIR/issue-49934.rs:13:5
|
||||||
|
|
|
|
||||||
LL | #[derive(Debug)]
|
LL | #[derive(Debug)]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
@ -7,10 +7,10 @@ LL | #[derive(Debug)]
|
||||||
= note: this may become a hard error in a future release
|
= note: this may become a hard error in a future release
|
||||||
|
|
||||||
warning: unused attribute
|
warning: unused attribute
|
||||||
--> $DIR/issue-49934.rs:6:8
|
--> $DIR/issue-49934.rs:19:5
|
||||||
|
|
|
|
||||||
LL | fn foo<#[derive(Debug)] T>() {
|
LL | #[derive(Debug)]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: lint level defined here
|
note: lint level defined here
|
||||||
--> $DIR/issue-49934.rs:4:9
|
--> $DIR/issue-49934.rs:4:9
|
||||||
|
@ -19,31 +19,19 @@ LL | #![warn(unused_attributes)]
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: unused attribute
|
warning: unused attribute
|
||||||
--> $DIR/issue-49934.rs:8:9
|
--> $DIR/issue-49934.rs:23:5
|
||||||
|
|
|
||||||
LL | #[derive(Debug)]
|
|
||||||
| ^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
warning: unused attribute
|
|
||||||
--> $DIR/issue-49934.rs:26:5
|
|
||||||
|
|
|
|
||||||
LL | #[derive(Debug)]
|
LL | #[derive(Debug)]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: unused attribute
|
warning: unused attribute
|
||||||
--> $DIR/issue-49934.rs:30:5
|
--> $DIR/issue-49934.rs:27:13
|
||||||
|
|
|
||||||
LL | #[derive(Debug)]
|
|
||||||
| ^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
warning: unused attribute
|
|
||||||
--> $DIR/issue-49934.rs:34:13
|
|
||||||
|
|
|
|
||||||
LL | let _ = #[derive(Debug)] "Hello, world!";
|
LL | let _ = #[derive(Debug)] "Hello, world!";
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: unused attribute
|
warning: unused attribute
|
||||||
--> $DIR/issue-49934.rs:39:9
|
--> $DIR/issue-49934.rs:32:9
|
||||||
|
|
|
|
||||||
LL | #[derive(Debug)]
|
LL | #[derive(Debug)]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
|
@ -10,11 +10,11 @@ extern crate test_macros;
|
||||||
// should either require a feature gate or not be allowed on stable.
|
// should either require a feature gate or not be allowed on stable.
|
||||||
|
|
||||||
fn _test6<#[empty_attr] T>() {}
|
fn _test6<#[empty_attr] T>() {}
|
||||||
//~^ ERROR: unknown to the compiler
|
//~^ ERROR: expected an inert attribute, found an attribute macro
|
||||||
|
|
||||||
fn _test7() {
|
fn _test7() {
|
||||||
match 1 {
|
match 1 {
|
||||||
#[empty_attr] //~ ERROR: unknown to the compiler
|
#[empty_attr] //~ ERROR: expected an inert attribute, found an attribute macro
|
||||||
0 => {}
|
0 => {}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,14 @@
|
||||||
error[E0658]: the attribute `empty_attr` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-gates2.rs:12:11
|
--> $DIR/proc-macro-gates2.rs:12:11
|
||||||
|
|
|
|
||||||
LL | fn _test6<#[empty_attr] T>() {}
|
LL | fn _test6<#[empty_attr] T>() {}
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `empty_attr` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-gates2.rs:17:9
|
--> $DIR/proc-macro-gates2.rs:17:9
|
||||||
|
|
|
|
||||||
LL | #[empty_attr]
|
LL | #[empty_attr]
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ extern "C" {
|
||||||
/// Foo
|
/// Foo
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[test] a: i32,
|
#[test] a: i32,
|
||||||
//~^ ERROR the attribute `test` is currently unknown to the compiler and may have
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
/// Bar
|
/// Bar
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
@ -21,7 +21,7 @@ type FnType = fn(
|
||||||
/// Foo
|
/// Foo
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[test] a: u32,
|
#[test] a: u32,
|
||||||
//~^ ERROR the attribute `test` is currently unknown to the compiler and may have
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
/// Bar
|
/// Bar
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
@ -36,7 +36,7 @@ pub fn foo(
|
||||||
/// Foo
|
/// Foo
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[test] a: u32,
|
#[test] a: u32,
|
||||||
//~^ ERROR the attribute `test` is currently unknown to the compiler and may have
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
/// Bar
|
/// Bar
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
@ -56,7 +56,7 @@ impl SelfStruct {
|
||||||
/// Bar
|
/// Bar
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[test] a: i32,
|
#[test] a: i32,
|
||||||
//~^ ERROR the attribute `test` is currently unknown to the compiler and may have
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
/// Baz
|
/// Baz
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
@ -77,7 +77,7 @@ impl RefStruct {
|
||||||
/// Bar
|
/// Bar
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[test] a: i32,
|
#[test] a: i32,
|
||||||
//~^ ERROR the attribute `test` is currently unknown to the compiler and may have
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
/// Baz
|
/// Baz
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
@ -96,7 +96,7 @@ trait RefTrait {
|
||||||
/// Bar
|
/// Bar
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[test] a: i32,
|
#[test] a: i32,
|
||||||
//~^ ERROR the attribute `test` is currently unknown to the compiler and may have
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
/// Baz
|
/// Baz
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
@ -115,7 +115,7 @@ impl RefTrait for RefStruct {
|
||||||
/// Bar
|
/// Bar
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[test] a: i32,
|
#[test] a: i32,
|
||||||
//~^ ERROR the attribute `test` is currently unknown to the compiler and may have
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
/// Baz
|
/// Baz
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
@ -132,7 +132,7 @@ fn main() {
|
||||||
/// Foo
|
/// Foo
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[test] a: u32,
|
#[test] a: u32,
|
||||||
//~^ ERROR the attribute `test` is currently unknown to the compiler and may have
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
/// Bar
|
/// Bar
|
||||||
//~^ ERROR documentation comments cannot be applied to function
|
//~^ ERROR documentation comments cannot be applied to function
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|
|
@ -1,3 +1,51 @@
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/param-attrs-builtin-attrs.rs:7:9
|
||||||
|
|
|
||||||
|
LL | #[test] a: i32,
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/param-attrs-builtin-attrs.rs:23:5
|
||||||
|
|
|
||||||
|
LL | #[test] a: u32,
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/param-attrs-builtin-attrs.rs:38:5
|
||||||
|
|
|
||||||
|
LL | #[test] a: u32,
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/param-attrs-builtin-attrs.rs:58:9
|
||||||
|
|
|
||||||
|
LL | #[test] a: i32,
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/param-attrs-builtin-attrs.rs:79:9
|
||||||
|
|
|
||||||
|
LL | #[test] a: i32,
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/param-attrs-builtin-attrs.rs:98:9
|
||||||
|
|
|
||||||
|
LL | #[test] a: i32,
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/param-attrs-builtin-attrs.rs:117:9
|
||||||
|
|
|
||||||
|
LL | #[test] a: i32,
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
|
error: expected an inert attribute, found an attribute macro
|
||||||
|
--> $DIR/param-attrs-builtin-attrs.rs:134:9
|
||||||
|
|
|
||||||
|
LL | #[test] a: u32,
|
||||||
|
| ^^^^^^^
|
||||||
|
|
||||||
error: documentation comments cannot be applied to function parameters
|
error: documentation comments cannot be applied to function parameters
|
||||||
--> $DIR/param-attrs-builtin-attrs.rs:5:9
|
--> $DIR/param-attrs-builtin-attrs.rs:5:9
|
||||||
|
|
|
|
||||||
|
@ -262,78 +310,5 @@ error: allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-i
|
||||||
LL | #[no_mangle] b: i32
|
LL | #[no_mangle] b: i32
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0658]: the attribute `test` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/param-attrs-builtin-attrs.rs:7:9
|
|
||||||
|
|
|
||||||
LL | #[test] a: i32,
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `test` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/param-attrs-builtin-attrs.rs:23:5
|
|
||||||
|
|
|
||||||
LL | #[test] a: u32,
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `test` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/param-attrs-builtin-attrs.rs:38:5
|
|
||||||
|
|
|
||||||
LL | #[test] a: u32,
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `test` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/param-attrs-builtin-attrs.rs:58:9
|
|
||||||
|
|
|
||||||
LL | #[test] a: i32,
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `test` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/param-attrs-builtin-attrs.rs:79:9
|
|
||||||
|
|
|
||||||
LL | #[test] a: i32,
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `test` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/param-attrs-builtin-attrs.rs:98:9
|
|
||||||
|
|
|
||||||
LL | #[test] a: i32,
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `test` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/param-attrs-builtin-attrs.rs:117:9
|
|
||||||
|
|
|
||||||
LL | #[test] a: i32,
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `test` is currently unknown to the compiler and may have meaning added to it in the future
|
|
||||||
--> $DIR/param-attrs-builtin-attrs.rs:134:9
|
|
||||||
|
|
|
||||||
LL | #[test] a: u32,
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error: aborting due to 52 previous errors
|
error: aborting due to 52 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
|
||||||
|
|
|
@ -9,52 +9,52 @@ use ident_mac::id;
|
||||||
struct W(u8);
|
struct W(u8);
|
||||||
|
|
||||||
extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
|
extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
|
|
||||||
unsafe extern "C" fn cvar(arg1: i32, #[id] mut args: ...) {}
|
unsafe extern "C" fn cvar(arg1: i32, #[id] mut args: ...) {}
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
|
|
||||||
type Alias = extern "C" fn(#[id] u8, #[id] ...);
|
type Alias = extern "C" fn(#[id] u8, #[id] ...);
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
|
|
||||||
fn free(#[id] arg1: u8) {
|
fn free(#[id] arg1: u8) {
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
let lam = |#[id] W(x), #[id] y| ();
|
let lam = |#[id] W(x), #[id] y| ();
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
}
|
}
|
||||||
|
|
||||||
impl W {
|
impl W {
|
||||||
fn inherent1(#[id] self, #[id] arg1: u8) {}
|
fn inherent1(#[id] self, #[id] arg1: u8) {}
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
fn inherent2(#[id] &self, #[id] arg1: u8) {}
|
fn inherent2(#[id] &self, #[id] arg1: u8) {}
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
|
fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
|
fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
}
|
}
|
||||||
|
|
||||||
trait A {
|
trait A {
|
||||||
fn trait1(#[id] self, #[id] arg1: u8);
|
fn trait1(#[id] self, #[id] arg1: u8);
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
fn trait2(#[id] &self, #[id] arg1: u8);
|
fn trait2(#[id] &self, #[id] arg1: u8);
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
|
fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
||||||
//~^ ERROR the attribute `id` is currently unknown to the compiler
|
//~^ ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
//~| ERROR the attribute `id` is currently unknown to the compiler
|
//~| ERROR expected an inert attribute, found an attribute macro
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,228 +1,152 @@
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:11:21
|
--> $DIR/proc-macro-cannot-be-used.rs:11:21
|
||||||
|
|
|
|
||||||
LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
|
LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:11:38
|
--> $DIR/proc-macro-cannot-be-used.rs:11:38
|
||||||
|
|
|
|
||||||
LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
|
LL | extern "C" { fn ffi(#[id] arg1: i32, #[id] ...); }
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:15:38
|
--> $DIR/proc-macro-cannot-be-used.rs:15:38
|
||||||
|
|
|
|
||||||
LL | unsafe extern "C" fn cvar(arg1: i32, #[id] mut args: ...) {}
|
LL | unsafe extern "C" fn cvar(arg1: i32, #[id] mut args: ...) {}
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:18:28
|
--> $DIR/proc-macro-cannot-be-used.rs:18:28
|
||||||
|
|
|
|
||||||
LL | type Alias = extern "C" fn(#[id] u8, #[id] ...);
|
LL | type Alias = extern "C" fn(#[id] u8, #[id] ...);
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:18:38
|
--> $DIR/proc-macro-cannot-be-used.rs:18:38
|
||||||
|
|
|
|
||||||
LL | type Alias = extern "C" fn(#[id] u8, #[id] ...);
|
LL | type Alias = extern "C" fn(#[id] u8, #[id] ...);
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:22:9
|
--> $DIR/proc-macro-cannot-be-used.rs:22:9
|
||||||
|
|
|
|
||||||
LL | fn free(#[id] arg1: u8) {
|
LL | fn free(#[id] arg1: u8) {
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:24:16
|
--> $DIR/proc-macro-cannot-be-used.rs:24:16
|
||||||
|
|
|
|
||||||
LL | let lam = |#[id] W(x), #[id] y| ();
|
LL | let lam = |#[id] W(x), #[id] y| ();
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:24:28
|
--> $DIR/proc-macro-cannot-be-used.rs:24:28
|
||||||
|
|
|
|
||||||
LL | let lam = |#[id] W(x), #[id] y| ();
|
LL | let lam = |#[id] W(x), #[id] y| ();
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:30:18
|
--> $DIR/proc-macro-cannot-be-used.rs:30:18
|
||||||
|
|
|
|
||||||
LL | fn inherent1(#[id] self, #[id] arg1: u8) {}
|
LL | fn inherent1(#[id] self, #[id] arg1: u8) {}
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:30:30
|
--> $DIR/proc-macro-cannot-be-used.rs:30:30
|
||||||
|
|
|
|
||||||
LL | fn inherent1(#[id] self, #[id] arg1: u8) {}
|
LL | fn inherent1(#[id] self, #[id] arg1: u8) {}
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:33:18
|
--> $DIR/proc-macro-cannot-be-used.rs:33:18
|
||||||
|
|
|
|
||||||
LL | fn inherent2(#[id] &self, #[id] arg1: u8) {}
|
LL | fn inherent2(#[id] &self, #[id] arg1: u8) {}
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:33:31
|
--> $DIR/proc-macro-cannot-be-used.rs:33:31
|
||||||
|
|
|
|
||||||
LL | fn inherent2(#[id] &self, #[id] arg1: u8) {}
|
LL | fn inherent2(#[id] &self, #[id] arg1: u8) {}
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:36:22
|
--> $DIR/proc-macro-cannot-be-used.rs:36:22
|
||||||
|
|
|
|
||||||
LL | fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
|
LL | fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:36:42
|
--> $DIR/proc-macro-cannot-be-used.rs:36:42
|
||||||
|
|
|
|
||||||
LL | fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
|
LL | fn inherent3<'a>(#[id] &'a mut self, #[id] arg1: u8) {}
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:39:22
|
--> $DIR/proc-macro-cannot-be-used.rs:39:22
|
||||||
|
|
|
|
||||||
LL | fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
|
LL | fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:39:45
|
--> $DIR/proc-macro-cannot-be-used.rs:39:45
|
||||||
|
|
|
|
||||||
LL | fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
|
LL | fn inherent4<'a>(#[id] self: Box<Self>, #[id] arg1: u8) {}
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:45:15
|
--> $DIR/proc-macro-cannot-be-used.rs:45:15
|
||||||
|
|
|
|
||||||
LL | fn trait1(#[id] self, #[id] arg1: u8);
|
LL | fn trait1(#[id] self, #[id] arg1: u8);
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:45:27
|
--> $DIR/proc-macro-cannot-be-used.rs:45:27
|
||||||
|
|
|
|
||||||
LL | fn trait1(#[id] self, #[id] arg1: u8);
|
LL | fn trait1(#[id] self, #[id] arg1: u8);
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:48:15
|
--> $DIR/proc-macro-cannot-be-used.rs:48:15
|
||||||
|
|
|
|
||||||
LL | fn trait2(#[id] &self, #[id] arg1: u8);
|
LL | fn trait2(#[id] &self, #[id] arg1: u8);
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:48:28
|
--> $DIR/proc-macro-cannot-be-used.rs:48:28
|
||||||
|
|
|
|
||||||
LL | fn trait2(#[id] &self, #[id] arg1: u8);
|
LL | fn trait2(#[id] &self, #[id] arg1: u8);
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:51:19
|
--> $DIR/proc-macro-cannot-be-used.rs:51:19
|
||||||
|
|
|
|
||||||
LL | fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
|
LL | fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:51:39
|
--> $DIR/proc-macro-cannot-be-used.rs:51:39
|
||||||
|
|
|
|
||||||
LL | fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
|
LL | fn trait3<'a>(#[id] &'a mut self, #[id] arg1: u8);
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:54:19
|
--> $DIR/proc-macro-cannot-be-used.rs:54:19
|
||||||
|
|
|
|
||||||
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:54:42
|
--> $DIR/proc-macro-cannot-be-used.rs:54:42
|
||||||
|
|
|
|
||||||
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: the attribute `id` is currently unknown to the compiler and may have meaning added to it in the future
|
error: expected an inert attribute, found an attribute macro
|
||||||
--> $DIR/proc-macro-cannot-be-used.rs:54:58
|
--> $DIR/proc-macro-cannot-be-used.rs:54:58
|
||||||
|
|
|
|
||||||
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
LL | fn trait4<'a>(#[id] self: Box<Self>, #[id] arg1: u8, #[id] Vec<u8>);
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
||||||
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
|
|
||||||
= help: add `#![feature(custom_attribute)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error: aborting due to 25 previous errors
|
error: aborting due to 25 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue