make it compile again
This commit is contained in:
parent
24a6284fcd
commit
121abd0599
@ -308,7 +308,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
|
||||
|
||||
fn check_used(&self, item: &hir::Item, target: Target) {
|
||||
for attr in &item.attrs {
|
||||
if attr.name().map(|name| name == "used").unwrap_or(false) && target != Target::Static {
|
||||
if attr.name() == "used" && target != Target::Static {
|
||||
self.tcx.sess
|
||||
.span_err(attr.span, "attribute must be applied to a `static` variable");
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ast::Path {
|
||||
hasher: &mut StableHasher<W>) {
|
||||
self.segments.len().hash_stable(hcx, hasher);
|
||||
for segment in &self.segments {
|
||||
segment.identifier.name.hash_stable(hcx, hasher);
|
||||
segment.ident.name.hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ impl<'a> LintLevelsBuilder<'a> {
|
||||
continue
|
||||
}
|
||||
};
|
||||
let name = word.ident.name;
|
||||
let name = word.name();
|
||||
match store.check_lint_name(&name.as_str()) {
|
||||
CheckLintNameResult::Ok(ids) => {
|
||||
let src = LintSource::Node(name, li.span);
|
||||
@ -260,7 +260,7 @@ impl<'a> LintLevelsBuilder<'a> {
|
||||
Some(li.span.into()),
|
||||
&msg);
|
||||
if name.as_str().chars().any(|c| c.is_uppercase()) {
|
||||
let name_lower = name.as_str().to_lowercase();
|
||||
let name_lower = name.as_str().to_lowercase().to_string();
|
||||
if let CheckLintNameResult::NoLint =
|
||||
store.check_lint_name(&name_lower) {
|
||||
db.emit();
|
||||
|
@ -1683,7 +1683,7 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> ast::CrateConfig {
|
||||
early_error(ErrorOutputType::default(), &msg)
|
||||
}
|
||||
|
||||
(meta_item.ident.name, meta_item.value_str())
|
||||
(meta_item.name(), meta_item.value_str())
|
||||
})
|
||||
.collect::<ast::CrateConfig>()
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedDirective {
|
||||
for command in self.subcommands.iter().chain(Some(self)).rev() {
|
||||
if let Some(ref condition) = command.condition {
|
||||
if !attr::eval_condition(condition, &tcx.sess.parse_sess, &mut |c| {
|
||||
options.contains(&(c.ident.name.as_str().to_string(),
|
||||
options.contains(&(c.name().as_str().to_string(),
|
||||
match c.value_str().map(|s| s.as_str().to_string()) {
|
||||
Some(s) => Some(s),
|
||||
None => None
|
||||
|
@ -1060,7 +1060,7 @@ impl RustcDefaultCalls {
|
||||
let mut cfgs = Vec::new();
|
||||
for &(name, ref value) in sess.parse_sess.config.iter() {
|
||||
let gated_cfg = GatedCfg::gate(&ast::MetaItem {
|
||||
name: ast::Path::from_ident(DUMMY_SP, name.to_ident()),
|
||||
ident: ast::Path::from_ident(name.to_ident()),
|
||||
node: ast::MetaItemKind::Word,
|
||||
span: DUMMY_SP,
|
||||
});
|
||||
|
@ -110,7 +110,7 @@ impl<'a, 'tcx> IfThisChanged<'a, 'tcx> {
|
||||
for list_item in attr.meta_item_list().unwrap_or_default() {
|
||||
match list_item.word() {
|
||||
Some(word) if value.is_none() =>
|
||||
value = Some(word.ident.name),
|
||||
value = Some(word.name()),
|
||||
_ =>
|
||||
// FIXME better-encapsulate meta_item (don't directly access `node`)
|
||||
span_bug!(list_item.span(), "unexpected meta-item {:?}", list_item.node),
|
||||
|
@ -702,7 +702,7 @@ impl<'a> Resolver<'a> {
|
||||
match attr.meta_item_list() {
|
||||
Some(names) => for attr in names {
|
||||
if let Some(word) = attr.word() {
|
||||
imports.imports.push((word.ident.name, attr.span()));
|
||||
imports.imports.push((word.name(), attr.span()));
|
||||
} else {
|
||||
span_err!(self.session, attr.span(), E0466, "bad macro import");
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ mod test {
|
||||
|
||||
fn dummy_meta_item_word(name: &str) -> MetaItem {
|
||||
MetaItem {
|
||||
name: Path::from_ident(DUMMY_SP, Ident::from_str(name)),
|
||||
ident: Path::from_ident(Ident::from_str(name)),
|
||||
node: MetaItemKind::Word,
|
||||
span: DUMMY_SP,
|
||||
}
|
||||
@ -447,7 +447,7 @@ mod test {
|
||||
macro_rules! dummy_meta_item_list {
|
||||
($name:ident, [$($list:ident),* $(,)*]) => {
|
||||
MetaItem {
|
||||
name: Path::from_ident(DUMMY_SP, Ident::from_str(stringify!($name))),
|
||||
ident: Path::from_ident(Ident::from_str(stringify!($name))),
|
||||
node: MetaItemKind::List(vec![
|
||||
$(
|
||||
dummy_spanned(NestedMetaItemKind::MetaItem(
|
||||
@ -461,7 +461,7 @@ mod test {
|
||||
|
||||
($name:ident, [$($list:expr),* $(,)*]) => {
|
||||
MetaItem {
|
||||
name: Path::from_ident(DUMMY_SP, Ident::from_str(stringify!($name))),
|
||||
ident: Path::from_ident(Ident::from_str(stringify!($name))),
|
||||
node: MetaItemKind::List(vec![
|
||||
$(
|
||||
dummy_spanned(NestedMetaItemKind::MetaItem($list)),
|
||||
@ -601,7 +601,7 @@ mod test {
|
||||
assert_eq!(Cfg::parse(&mi), Ok(word_cfg("all")));
|
||||
|
||||
let mi = MetaItem {
|
||||
name: Path::from_ident(DUMMY_SP, Ident::from_str("all")),
|
||||
ident: Path::from_ident(Ident::from_str("all")),
|
||||
node: MetaItemKind::NameValue(dummy_spanned(LitKind::Str(
|
||||
Symbol::intern("done"),
|
||||
StrStyle::Cooked,
|
||||
@ -636,7 +636,7 @@ mod test {
|
||||
fn test_parse_err() {
|
||||
with_globals(|| {
|
||||
let mi = MetaItem {
|
||||
name: Path::from_ident(DUMMY_SP, Ident::from_str("foo")),
|
||||
ident: Path::from_ident(Ident::from_str("foo")),
|
||||
node: MetaItemKind::NameValue(dummy_spanned(LitKind::Bool(false))),
|
||||
span: DUMMY_SP,
|
||||
};
|
||||
|
@ -3284,7 +3284,7 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||
}
|
||||
|
||||
fn render_attribute(attr: &ast::MetaItem) -> Option<String> {
|
||||
let name = attr.ident.name;
|
||||
let name = attr.name();
|
||||
|
||||
if attr.is_word() {
|
||||
Some(format!("{}", name))
|
||||
|
@ -477,7 +477,7 @@ pub enum NestedMetaItemKind {
|
||||
/// E.g. `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||
pub struct MetaItem {
|
||||
pub name: Path,
|
||||
pub ident: Path,
|
||||
pub node: MetaItemKind,
|
||||
pub span: Span,
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ use ast;
|
||||
use ast::{AttrId, Attribute, Name, Ident};
|
||||
use ast::{MetaItem, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
|
||||
use ast::{Lit, LitKind, Expr, ExprKind, Item, Local, Stmt, StmtKind};
|
||||
use codemap::{Spanned, respan, dummy_spanned};
|
||||
use codemap::{BytePos, Spanned, respan, dummy_spanned};
|
||||
use syntax_pos::Span;
|
||||
use errors::Handler;
|
||||
use feature_gate::{Features, GatedCfg};
|
||||
@ -111,7 +111,7 @@ const RUST_KNOWN_TOOL: &[&str] = &["clippy", "rustfmt"];
|
||||
|
||||
pub fn is_known_tool(attr: &Attribute) -> bool {
|
||||
let tool_name =
|
||||
attr.path.segments.iter().next().expect("empty path in attribute").identifier.name;
|
||||
attr.path.segments.iter().next().expect("empty path in attribute").ident.name;
|
||||
RUST_KNOWN_TOOL.contains(&tool_name.as_str().as_ref())
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ impl NestedMetaItem {
|
||||
}
|
||||
|
||||
fn name_from_path(path: &ast::Path) -> Name {
|
||||
path.segments.last().expect("empty path in attribute").identifier.name
|
||||
path.segments.last().expect("empty path in attribute").ident.name
|
||||
}
|
||||
|
||||
impl Attribute {
|
||||
@ -266,7 +266,7 @@ impl Attribute {
|
||||
|
||||
impl MetaItem {
|
||||
pub fn name(&self) -> Name {
|
||||
name_from_path(&self.name)
|
||||
name_from_path(&self.ident)
|
||||
}
|
||||
|
||||
pub fn value_str(&self) -> Option<Symbol> {
|
||||
@ -315,7 +315,7 @@ impl Attribute {
|
||||
pub fn meta(&self) -> Option<MetaItem> {
|
||||
let mut tokens = self.tokens.trees().peekable();
|
||||
Some(MetaItem {
|
||||
name: self.path.clone(),
|
||||
ident: self.path.clone(),
|
||||
node: if let Some(node) = MetaItemKind::from_tokens(&mut tokens) {
|
||||
if tokens.peek().is_some() {
|
||||
return None;
|
||||
@ -361,7 +361,7 @@ impl Attribute {
|
||||
|
||||
pub fn parse_meta<'a>(&self, sess: &'a ParseSess) -> PResult<'a, MetaItem> {
|
||||
Ok(MetaItem {
|
||||
name: self.path.clone(),
|
||||
ident: self.path.clone(),
|
||||
node: self.parse(sess, |parser| parser.parse_meta_item_kind())?,
|
||||
span: self.span,
|
||||
})
|
||||
@ -399,41 +399,19 @@ pub fn mk_name_value_item_str(ident: Ident, value: Spanned<Symbol>) -> MetaItem
|
||||
}
|
||||
|
||||
pub fn mk_name_value_item(span: Span, ident: Ident, value: ast::Lit) -> MetaItem {
|
||||
MetaItem { ident, span, node: MetaItemKind::NameValue(value) }
|
||||
MetaItem { ident: ast::Path::from_ident(ident), span, node: MetaItemKind::NameValue(value) }
|
||||
}
|
||||
|
||||
pub fn mk_list_item(span: Span, ident: Ident, items: Vec<NestedMetaItem>) -> MetaItem {
|
||||
MetaItem { ident, span, node: MetaItemKind::List(items) }
|
||||
MetaItem { ident: ast::Path::from_ident(ident), span, node: MetaItemKind::List(items) }
|
||||
}
|
||||
|
||||
pub fn mk_word_item(ident: Ident) -> MetaItem {
|
||||
MetaItem { ident, span: ident.span, node: MetaItemKind::Word }
|
||||
MetaItem { ident: ast::Path::from_ident(ident), span: ident.span, node: MetaItemKind::Word }
|
||||
}
|
||||
|
||||
pub fn mk_word_item(name: Name) -> MetaItem {
|
||||
mk_spanned_word_item(DUMMY_SP, name)
|
||||
}
|
||||
|
||||
macro_rules! mk_spanned_meta_item {
|
||||
($sp:ident, $name:ident, $node:expr) => {
|
||||
MetaItem {
|
||||
span: $sp,
|
||||
name: ast::Path::from_ident($sp, ast::Ident::with_empty_ctxt($name)),
|
||||
node: $node,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mk_spanned_name_value_item(sp: Span, name: Name, value: ast::Lit) -> MetaItem {
|
||||
mk_spanned_meta_item!(sp, name, MetaItemKind::NameValue(value))
|
||||
}
|
||||
|
||||
pub fn mk_spanned_list_item(sp: Span, name: Name, items: Vec<NestedMetaItem>) -> MetaItem {
|
||||
mk_spanned_meta_item!(sp, name, MetaItemKind::List(items))
|
||||
}
|
||||
|
||||
pub fn mk_spanned_word_item(sp: Span, name: Name) -> MetaItem {
|
||||
mk_spanned_meta_item!(sp, name, MetaItemKind::Word)
|
||||
pub fn mk_nested_word_item(ident: Ident) -> NestedMetaItem {
|
||||
respan(ident.span, NestedMetaItemKind::MetaItem(mk_word_item(ident)))
|
||||
}
|
||||
|
||||
pub fn mk_attr_id() -> AttrId {
|
||||
@ -457,7 +435,7 @@ pub fn mk_spanned_attr_inner(sp: Span, id: AttrId, item: MetaItem) -> Attribute
|
||||
Attribute {
|
||||
id,
|
||||
style: ast::AttrStyle::Inner,
|
||||
path: item.name,
|
||||
path: item.ident,
|
||||
tokens: item.node.tokens(item.span),
|
||||
is_sugared_doc: false,
|
||||
span: sp,
|
||||
@ -475,7 +453,7 @@ pub fn mk_spanned_attr_outer(sp: Span, id: AttrId, item: MetaItem) -> Attribute
|
||||
Attribute {
|
||||
id,
|
||||
style: ast::AttrStyle::Outer,
|
||||
path: item.name,
|
||||
path: item.ident,
|
||||
tokens: item.node.tokens(item.span),
|
||||
is_sugared_doc: false,
|
||||
span: sp,
|
||||
@ -1082,7 +1060,7 @@ pub fn find_repr_attrs(diagnostic: &Handler, attr: &Attribute) -> Vec<ReprAttr>
|
||||
}
|
||||
} else {
|
||||
if let Some(meta_item) = item.meta_item() {
|
||||
if meta_item.ident.name == "align" {
|
||||
if meta_item.name() == "align" {
|
||||
if let MetaItemKind::NameValue(ref value) = meta_item.node {
|
||||
recognised = true;
|
||||
let mut err = struct_span_err!(diagnostic, item.span, E0693,
|
||||
@ -1165,14 +1143,17 @@ impl MetaItem {
|
||||
let mut idents = vec![];
|
||||
let mut last_pos = BytePos(0 as u32);
|
||||
// FIXME: Share code with `parse_path`.
|
||||
for (i, segment) in self.name.segments.iter().enumerate() {
|
||||
for (i, segment) in self.ident.segments.iter().enumerate() {
|
||||
let is_first = i == 0;
|
||||
if !is_first {
|
||||
let mod_sep_span = Span::new(last_pos, segment.span.lo(), segment.span.ctxt());
|
||||
let mod_sep_span = Span::new(last_pos,
|
||||
segment.ident.span.lo(),
|
||||
segment.ident.span.ctxt());
|
||||
idents.push(TokenTree::Token(mod_sep_span, Token::ModSep).into());
|
||||
}
|
||||
idents.push(TokenTree::Token(segment.span, Token::Ident(segment.identifier)).into());
|
||||
last_pos = segment.span.hi();
|
||||
idents.push(TokenTree::Token(segment.ident.span,
|
||||
Token::from_ast_ident(segment.ident)).into());
|
||||
last_pos = segment.ident.span.hi();
|
||||
}
|
||||
idents.push(self.node.tokens(self.span));
|
||||
TokenStream::concat(idents)
|
||||
@ -1181,14 +1162,14 @@ impl MetaItem {
|
||||
fn from_tokens<I>(tokens: &mut iter::Peekable<I>) -> Option<MetaItem>
|
||||
where I: Iterator<Item = TokenTree>,
|
||||
{
|
||||
let name = match tokens.next() {
|
||||
Some(TokenTree::Token(span, Token::Ident(ident))) => {
|
||||
let ident = match tokens.next() {
|
||||
Some(TokenTree::Token(span, Token::Ident(ident, _))) => {
|
||||
if let Some(TokenTree::Token(_, Token::ModSep)) = tokens.peek() {
|
||||
tokens.next();
|
||||
let mut segments = vec![];
|
||||
loop {
|
||||
if let Some(TokenTree::Token(span, Token::Ident(ident))) = tokens.next() {
|
||||
segments.push(ast::PathSegment::from_ident(ident, span));
|
||||
if let Some(TokenTree::Token(_, Token::Ident(ident, _))) = tokens.next() {
|
||||
segments.push(ast::PathSegment::from_ident(ident));
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
@ -1200,12 +1181,12 @@ impl MetaItem {
|
||||
}
|
||||
ast::Path { span, segments }
|
||||
} else {
|
||||
ast::Path::from_ident(span, ident)
|
||||
ast::Path::from_ident(ident)
|
||||
}
|
||||
}
|
||||
Some(TokenTree::Token(_, Token::Interpolated(ref nt))) => match nt.0 {
|
||||
token::Nonterminal::NtIdent(ident) => {
|
||||
ast::Path::from_ident(ident.span, ident.node)
|
||||
token::Nonterminal::NtIdent(ident, _) => {
|
||||
ast::Path::from_ident(ident)
|
||||
}
|
||||
token::Nonterminal::NtMeta(ref meta) => return Some(meta.clone()),
|
||||
token::Nonterminal::NtPath(ref path) => path.clone(),
|
||||
@ -1217,11 +1198,11 @@ impl MetaItem {
|
||||
let node = MetaItemKind::from_tokens(tokens)?;
|
||||
let hi = match node {
|
||||
MetaItemKind::NameValue(ref lit) => lit.span.hi(),
|
||||
MetaItemKind::List(..) => list_closing_paren_pos.unwrap_or(name.span.hi()),
|
||||
_ => name.span.hi(),
|
||||
MetaItemKind::List(..) => list_closing_paren_pos.unwrap_or(ident.span.hi()),
|
||||
_ => ident.span.hi(),
|
||||
};
|
||||
let span = name.span.with_hi(hi);
|
||||
Some(MetaItem { name, node, span })
|
||||
let span = ident.span.with_hi(hi);
|
||||
Some(MetaItem { ident, node, span })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -810,7 +810,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||
invoc.expansion_data.mark.set_expn_info(expn_info);
|
||||
let span = span.with_ctxt(self.cx.backtrace());
|
||||
let dummy = ast::MetaItem { // FIXME(jseyfried) avoid this
|
||||
name: Path::from_ident(DUMMY_SP, keywords::Invalid.ident()),
|
||||
ident: Path::from_ident(keywords::Invalid.ident()),
|
||||
span: DUMMY_SP,
|
||||
node: ast::MetaItemKind::Word,
|
||||
};
|
||||
|
@ -462,7 +462,7 @@ declare_features! (
|
||||
(active, extern_prelude, "1.27.0", Some(44660), Some(Edition::Edition2018)),
|
||||
|
||||
// Scoped attributes
|
||||
(active, tool_attributes, "1.25.0", Some(44690)),
|
||||
(active, tool_attributes, "1.25.0", Some(44690), None),
|
||||
);
|
||||
|
||||
declare_features! (
|
||||
@ -1175,12 +1175,28 @@ impl<'a> Context<'a> {
|
||||
// before the plugin attributes are registered
|
||||
// so we skip this then
|
||||
if !is_macro {
|
||||
gate_feature!(self, custom_attribute, attr.span,
|
||||
&format!("The attribute `{}` is currently \
|
||||
unknown to the compiler and \
|
||||
may have meaning \
|
||||
added to it in the future",
|
||||
attr.path));
|
||||
if attr.is_scoped() {
|
||||
gate_feature!(self, tool_attributes, attr.span,
|
||||
&format!("scoped attribute `{}` is experimental", attr.path));
|
||||
if attr::is_known_tool(attr) {
|
||||
attr::mark_used(attr);
|
||||
} else {
|
||||
span_err!(
|
||||
self.parse_sess.span_diagnostic,
|
||||
attr.span,
|
||||
E0694,
|
||||
"an unknown tool name found in scoped attribute: `{}`.",
|
||||
attr.path
|
||||
);
|
||||
}
|
||||
} else {
|
||||
gate_feature!(self, custom_attribute, attr.span,
|
||||
&format!("the attribute `{}` is currently \
|
||||
unknown to the compiler and \
|
||||
may have meaning \
|
||||
added to it in the future",
|
||||
attr.path));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1846,7 +1862,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
|
||||
for mi in list {
|
||||
|
||||
let name = if let Some(word) = mi.word() {
|
||||
word.ident.name
|
||||
word.name()
|
||||
} else {
|
||||
span_err!(span_handler, mi.span, E0556,
|
||||
"malformed feature, expected just one word");
|
||||
|
@ -149,7 +149,7 @@ impl<'a> Parser<'a> {
|
||||
};
|
||||
Ok(if let Some(meta) = meta {
|
||||
self.bump();
|
||||
(meta.name, meta.node.tokens(meta.span))
|
||||
(meta.ident, meta.node.tokens(meta.span))
|
||||
} else {
|
||||
(self.parse_path(PathStyle::Mod)?, self.parse_tokens())
|
||||
})
|
||||
@ -225,10 +225,10 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
|
||||
let lo = self.span;
|
||||
let name = self.parse_path(PathStyle::Mod)?;
|
||||
let ident = self.parse_path(PathStyle::Mod)?;
|
||||
let node = self.parse_meta_item_kind()?;
|
||||
let span = lo.to(self.prev_span);
|
||||
Ok(ast::MetaItem { name, node, span })
|
||||
Ok(ast::MetaItem { ident, node, span })
|
||||
}
|
||||
|
||||
pub fn parse_meta_item_kind(&mut self) -> PResult<'a, ast::MetaItemKind> {
|
||||
|
@ -1955,17 +1955,17 @@ impl<'a> Parser<'a> {
|
||||
/// Like `parse_path`, but also supports parsing `Word` meta items into paths for back-compat.
|
||||
/// This is used when parsing derive macro paths in `#[derive]` attributes.
|
||||
pub fn parse_path_allowing_meta(&mut self, style: PathStyle) -> PResult<'a, ast::Path> {
|
||||
let meta_name = match self.token {
|
||||
let meta_ident = match self.token {
|
||||
token::Interpolated(ref nt) => match nt.0 {
|
||||
token::NtMeta(ref meta) => match meta.node {
|
||||
ast::MetaItemKind::Word => Some(meta.name.clone()),
|
||||
ast::MetaItemKind::Word => Some(meta.ident.clone()),
|
||||
_ => None,
|
||||
},
|
||||
_ => None,
|
||||
},
|
||||
_ => None,
|
||||
};
|
||||
if let Some(path) = meta_name {
|
||||
if let Some(path) = meta_ident {
|
||||
self.bump();
|
||||
return Ok(path);
|
||||
}
|
||||
|
@ -719,12 +719,12 @@ pub trait PrintState<'a> {
|
||||
if i > 0 {
|
||||
self.writer().word("::")?
|
||||
}
|
||||
if segment.identifier.name != keywords::CrateRoot.name() &&
|
||||
segment.identifier.name != keywords::DollarCrate.name()
|
||||
if segment.ident.name != keywords::CrateRoot.name() &&
|
||||
segment.ident.name != keywords::DollarCrate.name()
|
||||
{
|
||||
self.writer().word(&segment.identifier.name.as_str())?;
|
||||
} else if segment.identifier.name == keywords::DollarCrate.name() {
|
||||
self.print_dollar_crate(segment.identifier.ctxt)?;
|
||||
self.writer().word(&segment.ident.name.as_str())?;
|
||||
} else if segment.ident.name == keywords::DollarCrate.name() {
|
||||
self.print_dollar_crate(segment.ident.span.ctxt())?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@ -773,15 +773,15 @@ pub trait PrintState<'a> {
|
||||
fn print_meta_item(&mut self, item: &ast::MetaItem) -> io::Result<()> {
|
||||
self.ibox(INDENT_UNIT)?;
|
||||
match item.node {
|
||||
ast::MetaItemKind::Word => self.print_attribute_path(&item.name)?,
|
||||
ast::MetaItemKind::Word => self.print_attribute_path(&item.ident)?,
|
||||
ast::MetaItemKind::NameValue(ref value) => {
|
||||
self.print_attribute_path(&item.name)?;
|
||||
self.print_attribute_path(&item.ident)?;
|
||||
self.writer().space()?;
|
||||
self.word_space("=")?;
|
||||
self.print_literal(value)?;
|
||||
}
|
||||
ast::MetaItemKind::List(ref items) => {
|
||||
self.print_attribute_path(&item.name)?;
|
||||
self.print_attribute_path(&item.ident)?;
|
||||
self.popen()?;
|
||||
self.commasep(Consistent,
|
||||
&items[..],
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#![feature(tool_attributes)]
|
||||
|
||||
#![foo::bar] //~ ERROR An unknown tool name found in scoped attributes: `foo::bar`. [E0693]
|
||||
#![foo::bar] //~ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694]
|
||||
|
||||
#[foo::bar] //~ ERROR An unknown tool name found in scoped attributes: `foo::bar`. [E0693]
|
||||
#[foo::bar] //~ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694]
|
||||
fn main() {}
|
||||
|
@ -14,5 +14,5 @@
|
||||
|
||||
#[foo::bar]
|
||||
//~^ ERROR scoped attribute `foo::bar` is experimental (see issue #44690) [E0658]
|
||||
//~^^ ERROR An unknown tool name found in scoped attributes: `foo::bar`. [E0693]
|
||||
//~^^ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694]
|
||||
fn main() {}
|
||||
|
@ -1,10 +1,11 @@
|
||||
error[E0658]: scoped attribute `rustfmt::skip` is experimental (see issue #44690)
|
||||
--> $DIR/feature-gate-tool_attributes.rs:12:5
|
||||
|
|
||||
12 | #[rustfmt::skip] //~ ERROR scoped attribute `rustfmt::skip` is experimental
|
||||
LL | #[rustfmt::skip] //~ ERROR scoped attribute `rustfmt::skip` is experimental
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(tool_attributes)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user