Skip to content

Commit a083846

Browse files
committed
pretty: injected_crate_name -> has_injected_crate
1 parent eadff06 commit a083846

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Diff for: src/librustc_ast_pretty/pprust.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
use crate::pp::Breaks::{Consistent, Inconsistent};
22
use crate::pp::{self, Breaks};
33

4-
use rustc_data_structures::sync::Once;
54
use rustc_span::edition::Edition;
65
use rustc_span::source_map::{dummy_spanned, SourceMap, Spanned};
7-
use rustc_span::symbol::{kw, sym, Symbol};
6+
use rustc_span::symbol::{kw, sym};
87
use rustc_span::{BytePos, FileName, Span};
98
use syntax::ast::{self, BlockCheckMode, PatKind, RangeEnd, RangeSyntax};
109
use syntax::ast::{Attribute, GenericArg, MacArgs};
@@ -103,7 +102,7 @@ pub fn print_crate<'a>(
103102
ann: &'a dyn PpAnn,
104103
is_expanded: bool,
105104
edition: Edition,
106-
injected_crate_name: &Once<Symbol>,
105+
has_injected_crate: bool,
107106
) -> String {
108107
let mut s = State {
109108
s: pp::mk_printer(),
@@ -112,7 +111,7 @@ pub fn print_crate<'a>(
112111
is_expanded,
113112
};
114113

115-
if is_expanded && injected_crate_name.try_get().is_some() {
114+
if is_expanded && has_injected_crate {
116115
// We need to print `#![no_std]` (and its feature gate) so that
117116
// compiling pretty-printed source won't inject libstd again.
118117
// However, we don't want these attributes in the AST because

Diff for: src/librustc_driver/pretty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ pub fn print_after_parsing(
400400
annotation.pp_ann(),
401401
false,
402402
parse.edition,
403-
&parse.injected_crate_name,
403+
parse.injected_crate_name.try_get().is_some(),
404404
)
405405
})
406406
} else {
@@ -442,7 +442,7 @@ pub fn print_after_hir_lowering<'tcx>(
442442
annotation.pp_ann(),
443443
true,
444444
parse.edition,
445-
&parse.injected_crate_name,
445+
parse.injected_crate_name.try_get().is_some(),
446446
)
447447
})
448448
}

0 commit comments

Comments
 (0)