pretty: injected_crate_name -> has_injected_crate

This commit is contained in:
Mazdak Farrokhzad 2020-01-18 19:01:50 +01:00
parent eadff06823
commit a0838462cf
2 changed files with 5 additions and 6 deletions

View file

@ -1,10 +1,9 @@
use crate::pp::Breaks::{Consistent, Inconsistent};
use crate::pp::{self, Breaks};
use rustc_data_structures::sync::Once;
use rustc_span::edition::Edition;
use rustc_span::source_map::{dummy_spanned, SourceMap, Spanned};
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::symbol::{kw, sym};
use rustc_span::{BytePos, FileName, Span};
use syntax::ast::{self, BlockCheckMode, PatKind, RangeEnd, RangeSyntax};
use syntax::ast::{Attribute, GenericArg, MacArgs};
@ -103,7 +102,7 @@ pub fn print_crate<'a>(
ann: &'a dyn PpAnn,
is_expanded: bool,
edition: Edition,
injected_crate_name: &Once<Symbol>,
has_injected_crate: bool,
) -> String {
let mut s = State {
s: pp::mk_printer(),
@ -112,7 +111,7 @@ pub fn print_crate<'a>(
is_expanded,
};
if is_expanded && injected_crate_name.try_get().is_some() {
if is_expanded && has_injected_crate {
// We need to print `#![no_std]` (and its feature gate) so that
// compiling pretty-printed source won't inject libstd again.
// However, we don't want these attributes in the AST because

View file

@ -400,7 +400,7 @@ pub fn print_after_parsing(
annotation.pp_ann(),
false,
parse.edition,
&parse.injected_crate_name,
parse.injected_crate_name.try_get().is_some(),
)
})
} else {
@ -442,7 +442,7 @@ pub fn print_after_hir_lowering<'tcx>(
annotation.pp_ann(),
true,
parse.edition,
&parse.injected_crate_name,
parse.injected_crate_name.try_get().is_some(),
)
})
}