Skip to content

Commit fd0bd25

Browse files
authoredJun 23, 2020
Rollup merge of rust-lang#73523 - jyn514:everybody_loops, r=ecstatic-morse
Fix -Z unpretty=everybody_loops It turns out that this has not been working for who knows how long. Previously: ``` pub fn h() { 1 + 2; } ``` After this change: ``` pub fn h() { loop { } } ``` This only affected the pass when run with the command line pretty-printing option, so rustdoc was still replacing bodies with `loop {}`.
2 parents 9d4b416 + 95f8daa commit fd0bd25

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed
 

‎src/librustc_driver/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ pub fn run_compiler(
307307
compiler.output_file().as_ref().map(|p| &**p),
308308
);
309309
}
310+
trace!("finished pretty-printing");
310311
return early_exit();
311312
}
312313

‎src/librustc_interface/interface.rs

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ pub fn run_compiler_in_existing_thread_pool<R>(
202202
}
203203

204204
pub fn run_compiler<R: Send>(mut config: Config, f: impl FnOnce(&Compiler) -> R + Send) -> R {
205+
log::trace!("run_compiler");
205206
let stderr = config.stderr.take();
206207
util::spawn_thread_pool(
207208
config.opts.edition,

‎src/librustc_interface/passes.rs

+3
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ pub fn configure_and_expand(
101101
krate: ast::Crate,
102102
crate_name: &str,
103103
) -> Result<(ast::Crate, BoxedResolver)> {
104+
log::trace!("configure_and_expand");
104105
// Currently, we ignore the name resolution data structures for the purposes of dependency
105106
// tracking. Instead we will run name resolution and include its output in the hash of each
106107
// item, much like we do for macro expansion. In other words, the hash reflects not just
@@ -230,6 +231,7 @@ fn configure_and_expand_inner<'a>(
230231
resolver_arenas: &'a ResolverArenas<'a>,
231232
metadata_loader: &'a MetadataLoaderDyn,
232233
) -> Result<(ast::Crate, Resolver<'a>)> {
234+
log::trace!("configure_and_expand_inner");
233235
pre_expansion_lint(sess, lint_store, &krate);
234236

235237
let mut resolver = Resolver::new(sess, &krate, crate_name, metadata_loader, &resolver_arenas);
@@ -357,6 +359,7 @@ fn configure_and_expand_inner<'a>(
357359
should_loop |= true;
358360
}
359361
if should_loop {
362+
log::debug!("replacing bodies with loop {{}}");
360363
util::ReplaceBodyWithLoop::new(&mut resolver).visit_crate(&mut krate);
361364
}
362365

‎src/librustc_interface/queries.rs

+1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ impl<'tcx> Queries<'tcx> {
169169
pub fn expansion(
170170
&self,
171171
) -> Result<&Query<(ast::Crate, Steal<Rc<RefCell<BoxedResolver>>>, Lrc<LintStore>)>> {
172+
log::trace!("expansion");
172173
self.expansion.compute(|| {
173174
let crate_name = self.crate_name()?.peek().clone();
174175
let (krate, lint_store) = self.register_plugins()?.take();

‎src/librustc_session/config.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1849,6 +1849,7 @@ fn parse_pretty(
18491849
}
18501850
}
18511851
};
1852+
log::debug!("got unpretty option: {:?}", first);
18521853
first
18531854
}
18541855
}
@@ -1977,9 +1978,11 @@ impl PpMode {
19771978
use PpMode::*;
19781979
use PpSourceMode::*;
19791980
match *self {
1980-
PpmSource(PpmNormal | PpmEveryBodyLoops | PpmIdentified) => false,
1981+
PpmSource(PpmNormal | PpmIdentified) => false,
19811982

1982-
PpmSource(PpmExpanded | PpmExpandedIdentified | PpmExpandedHygiene)
1983+
PpmSource(
1984+
PpmExpanded | PpmEveryBodyLoops | PpmExpandedIdentified | PpmExpandedHygiene,
1985+
)
19831986
| PpmHir(_)
19841987
| PpmHirTree(_)
19851988
| PpmMir

0 commit comments

Comments
 (0)
Please sign in to comment.