diff options
| author | bors <bors@rust-lang.org> | 2022-12-01 07:13:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-01 07:13:45 +0000 |
| commit | d6c4de0fb22fe8f3cc5a27e94b6b6d88fb504a91 (patch) | |
| tree | daeb506f5cabec0a0b7f16f5a4a5e65fd723b7f4 /compiler/rustc_ast_pretty/src/pprust/state.rs | |
| parent | 744a97b98c3f2722e1a43486c05203b04e499e21 (diff) | |
| parent | ba1751a201190930a16ef20e6f7021c785d3891d (diff) | |
| download | rust-d6c4de0fb22fe8f3cc5a27e94b6b6d88fb504a91.tar.gz rust-d6c4de0fb22fe8f3cc5a27e94b6b6d88fb504a91.zip | |
Auto merge of #104861 - nnethercote:attr-cleanups, r=petrochenkov
Attribute cleanups Best reviewed one commit at a time. r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_ast_pretty/src/pprust/state.rs')
| -rw-r--r-- | compiler/rustc_ast_pretty/src/pprust/state.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 374e0a97063..ebe55a4b771 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -19,7 +19,7 @@ use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_span::edition::Edition; use rustc_span::source_map::{SourceMap, Spanned}; use rustc_span::symbol::{kw, sym, Ident, IdentPrinter, Symbol}; -use rustc_span::{BytePos, FileName, Span}; +use rustc_span::{BytePos, FileName, Span, DUMMY_SP}; use rustc_ast::attr::AttrIdGenerator; use std::borrow::Cow; @@ -120,17 +120,20 @@ pub fn print_crate<'a>( // of the feature gate, so we fake them up here. // `#![feature(prelude_import)]` - let pi_nested = attr::mk_nested_word_item(Ident::with_dummy_span(sym::prelude_import)); - let list = attr::mk_list_item(Ident::with_dummy_span(sym::feature), vec![pi_nested]); - let fake_attr = attr::mk_attr_inner(g, list); + let fake_attr = attr::mk_attr_nested_word( + g, + ast::AttrStyle::Inner, + sym::feature, + sym::prelude_import, + DUMMY_SP, + ); s.print_attribute(&fake_attr); // Currently, in Rust 2018 we don't have `extern crate std;` at the crate // root, so this is not needed, and actually breaks things. if edition == Edition::Edition2015 { // `#![no_std]` - let no_std_meta = attr::mk_word_item(Ident::with_dummy_span(sym::no_std)); - let fake_attr = attr::mk_attr_inner(g, no_std_meta); + let fake_attr = attr::mk_attr_word(g, ast::AttrStyle::Inner, sym::no_std, DUMMY_SP); s.print_attribute(&fake_attr); } } @@ -1713,9 +1716,9 @@ impl<'a> State<'a> { where_clause: ast::WhereClause { has_where_token: false, predicates: Vec::new(), - span: rustc_span::DUMMY_SP, + span: DUMMY_SP, }, - span: rustc_span::DUMMY_SP, + span: DUMMY_SP, }; let header = ast::FnHeader { unsafety, ext, ..ast::FnHeader::default() }; self.print_fn(decl, header, name, &generics); |
