mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Fix formatting
This commit is contained in:
parent
8aa2553b50
commit
15f8ffe371
@ -260,8 +260,13 @@ pub fn print_crate<'a>(
|
|||||||
// root, so this is not needed, and actually breaks things.
|
// root, so this is not needed, and actually breaks things.
|
||||||
if edition.is_rust_2015() {
|
if edition.is_rust_2015() {
|
||||||
// `#![no_std]`
|
// `#![no_std]`
|
||||||
let fake_attr =
|
let fake_attr = attr::mk_attr_word(
|
||||||
attr::mk_attr_word(g, ast::AttrStyle::Inner, Safety::Default, sym::no_std, DUMMY_SP);
|
g,
|
||||||
|
ast::AttrStyle::Inner,
|
||||||
|
Safety::Default,
|
||||||
|
sym::no_std,
|
||||||
|
DUMMY_SP,
|
||||||
|
);
|
||||||
s.print_attribute(&fake_attr);
|
s.print_attribute(&fake_attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ use crate::cfg_eval::cfg_eval;
|
|||||||
use crate::errors;
|
use crate::errors;
|
||||||
|
|
||||||
use rustc_ast as ast;
|
use rustc_ast as ast;
|
||||||
use rustc_ast::{GenericParamKind, ItemKind, MetaItemKind, NestedMetaItem, StmtKind, Safety};
|
use rustc_ast::{GenericParamKind, ItemKind, MetaItemKind, NestedMetaItem, Safety, StmtKind};
|
||||||
use rustc_expand::base::{
|
use rustc_expand::base::{
|
||||||
Annotatable, DeriveResolution, ExpandResult, ExtCtxt, Indeterminate, MultiItemModifier,
|
Annotatable, DeriveResolution, ExpandResult, ExtCtxt, Indeterminate, MultiItemModifier,
|
||||||
};
|
};
|
||||||
|
@ -674,12 +674,26 @@ impl<'a> ExtCtxt<'a> {
|
|||||||
// Note: `span` is used for both the identifier and the value.
|
// Note: `span` is used for both the identifier and the value.
|
||||||
pub fn attr_name_value_str(&self, name: Symbol, val: Symbol, span: Span) -> ast::Attribute {
|
pub fn attr_name_value_str(&self, name: Symbol, val: Symbol, span: Span) -> ast::Attribute {
|
||||||
let g = &self.sess.psess.attr_id_generator;
|
let g = &self.sess.psess.attr_id_generator;
|
||||||
attr::mk_attr_name_value_str(g, ast::AttrStyle::Outer, ast::Safety::Default, name, val, span)
|
attr::mk_attr_name_value_str(
|
||||||
|
g,
|
||||||
|
ast::AttrStyle::Outer,
|
||||||
|
ast::Safety::Default,
|
||||||
|
name,
|
||||||
|
val,
|
||||||
|
span,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builds `#[outer(inner)]`.
|
// Builds `#[outer(inner)]`.
|
||||||
pub fn attr_nested_word(&self, outer: Symbol, inner: Symbol, span: Span) -> ast::Attribute {
|
pub fn attr_nested_word(&self, outer: Symbol, inner: Symbol, span: Span) -> ast::Attribute {
|
||||||
let g = &self.sess.psess.attr_id_generator;
|
let g = &self.sess.psess.attr_id_generator;
|
||||||
attr::mk_attr_nested_word(g, ast::AttrStyle::Outer, ast::Safety::Default, outer, inner, span)
|
attr::mk_attr_nested_word(
|
||||||
|
g,
|
||||||
|
ast::AttrStyle::Outer,
|
||||||
|
ast::Safety::Default,
|
||||||
|
outer,
|
||||||
|
inner,
|
||||||
|
span,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Checks if `unsafe()` is applied to an invalid attribute.
|
/// Checks if `unsafe()` is applied to an invalid attribute.
|
||||||
fn check_unsafe_attr(&self, attr: &Attribute) {
|
fn check_unsafe_attr(&self, attr: &Attribute) {
|
||||||
if !attr.is_doc_comment() {
|
if !attr.is_doc_comment() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use rustc_ast::{MetaItemLit, Path, StrStyle, Safety};
|
use rustc_ast::{MetaItemLit, Path, Safety, StrStyle};
|
||||||
use rustc_span::create_default_session_globals_then;
|
use rustc_span::create_default_session_globals_then;
|
||||||
use rustc_span::symbol::{kw, Ident};
|
use rustc_span::symbol::{kw, Ident};
|
||||||
use rustc_span::DUMMY_SP;
|
use rustc_span::DUMMY_SP;
|
||||||
|
Loading…
Reference in New Issue
Block a user