diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2020-06-19 20:06:49 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2020-06-19 20:27:22 -0400 |
| commit | 95f8daa82b52e95081b66d58953c2329a9f0458e (patch) | |
| tree | 504a22bcab6531ff06508011c16d3865f0762500 | |
| parent | e8ff4bcbd02475cf487cd101bf32954dc63366d4 (diff) | |
| download | rust-95f8daa82b52e95081b66d58953c2329a9f0458e.tar.gz rust-95f8daa82b52e95081b66d58953c2329a9f0458e.zip | |
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 {}`.
| -rw-r--r-- | src/librustc_driver/lib.rs | 1 | ||||
| -rw-r--r-- | src/librustc_interface/interface.rs | 1 | ||||
| -rw-r--r-- | src/librustc_interface/passes.rs | 3 | ||||
| -rw-r--r-- | src/librustc_interface/queries.rs | 1 | ||||
| -rw-r--r-- | src/librustc_session/config.rs | 7 |
5 files changed, 11 insertions, 2 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index ccea041699e..b45ab0f80ff 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -307,6 +307,7 @@ pub fn run_compiler( compiler.output_file().as_ref().map(|p| &**p), ); } + trace!("finished pretty-printing"); return early_exit(); } diff --git a/src/librustc_interface/interface.rs b/src/librustc_interface/interface.rs index 5aad64f84ce..920cc6021e6 100644 --- a/src/librustc_interface/interface.rs +++ b/src/librustc_interface/interface.rs @@ -202,6 +202,7 @@ pub fn run_compiler_in_existing_thread_pool<R>( } pub fn run_compiler<R: Send>(mut config: Config, f: impl FnOnce(&Compiler) -> R + Send) -> R { + log::trace!("run_compiler"); let stderr = config.stderr.take(); util::spawn_thread_pool( config.opts.edition, diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 1ed9bc3f1f5..c0a67f20a1e 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -101,6 +101,7 @@ pub fn configure_and_expand( krate: ast::Crate, crate_name: &str, ) -> Result<(ast::Crate, BoxedResolver)> { + log::trace!("configure_and_expand"); // Currently, we ignore the name resolution data structures for the purposes of dependency // tracking. Instead we will run name resolution and include its output in the hash of each // 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>( resolver_arenas: &'a ResolverArenas<'a>, metadata_loader: &'a MetadataLoaderDyn, ) -> Result<(ast::Crate, Resolver<'a>)> { + log::trace!("configure_and_expand_inner"); pre_expansion_lint(sess, lint_store, &krate); let mut resolver = Resolver::new(sess, &krate, crate_name, metadata_loader, &resolver_arenas); @@ -357,6 +359,7 @@ fn configure_and_expand_inner<'a>( should_loop |= true; } if should_loop { + log::debug!("replacing bodies with loop {{}}"); util::ReplaceBodyWithLoop::new(&mut resolver).visit_crate(&mut krate); } diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs index 283be165c19..4a41c3e97ca 100644 --- a/src/librustc_interface/queries.rs +++ b/src/librustc_interface/queries.rs @@ -169,6 +169,7 @@ impl<'tcx> Queries<'tcx> { pub fn expansion( &self, ) -> Result<&Query<(ast::Crate, Steal<Rc<RefCell<BoxedResolver>>>, Lrc<LintStore>)>> { + log::trace!("expansion"); self.expansion.compute(|| { let crate_name = self.crate_name()?.peek().clone(); let (krate, lint_store) = self.register_plugins()?.take(); diff --git a/src/librustc_session/config.rs b/src/librustc_session/config.rs index 411a6eecbba..ff94a43c4f1 100644 --- a/src/librustc_session/config.rs +++ b/src/librustc_session/config.rs @@ -1826,6 +1826,7 @@ fn parse_pretty( } } }; + log::debug!("got unpretty option: {:?}", first); first } } @@ -1954,9 +1955,11 @@ impl PpMode { use PpMode::*; use PpSourceMode::*; match *self { - PpmSource(PpmNormal | PpmEveryBodyLoops | PpmIdentified) => false, + PpmSource(PpmNormal | PpmIdentified) => false, - PpmSource(PpmExpanded | PpmExpandedIdentified | PpmExpandedHygiene) + PpmSource( + PpmExpanded | PpmEveryBodyLoops | PpmExpandedIdentified | PpmExpandedHygiene, + ) | PpmHir(_) | PpmHirTree(_) | PpmMir |
