about summary refs log tree commit diff
path: root/src/librustc_driver
diff options
context:
space:
mode:
authorIgor Matuszewski <Xanewok@gmail.com>2019-01-07 11:46:44 +0100
committerIgor Matuszewski <Xanewok@gmail.com>2019-01-17 10:40:22 +0100
commit6f1d06d21989e7b606a0c980a9fa99ffdafb91a2 (patch)
treea659b6dd7158dd019d51151f5bd874e6acd27f31 /src/librustc_driver
parent6c8fdf971cb226a14491dba974ec50812a52e983 (diff)
downloadrust-6f1d06d21989e7b606a0c980a9fa99ffdafb91a2.tar.gz
rust-6f1d06d21989e7b606a0c980a9fa99ffdafb91a2.zip
Querify glob map usage (last use of CrateAnalysis)
Diffstat (limited to 'src/librustc_driver')
-rw-r--r--src/librustc_driver/driver.rs26
-rw-r--r--src/librustc_driver/lib.rs2
-rw-r--r--src/librustc_driver/pretty.rs16
3 files changed, 8 insertions, 36 deletions
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index 1ecb8ef112c..aa7cb0c695c 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -168,7 +168,6 @@ pub fn compile_input(
         let ExpansionResult {
             expanded_crate,
             defs,
-            analysis,
             resolutions,
             mut hir_forest,
         } = {
@@ -251,7 +250,6 @@ pub fn compile_input(
                     output,
                     &cstore,
                     &hir_map,
-                    &analysis,
                     &resolutions,
                     &expanded_crate,
                     &hir_map.krate(),
@@ -277,12 +275,11 @@ pub fn compile_input(
             sess,
             cstore,
             hir_map,
-            analysis,
             resolutions,
             &mut arenas,
             &crate_name,
             &outputs,
-            |tcx, analysis, rx, result| {
+            |tcx, rx, result| {
                 {
                     // Eventually, we will want to track plugins.
                     tcx.dep_graph.with_ignore(|| {
@@ -293,7 +290,6 @@ pub fn compile_input(
                             output,
                             opt_crate,
                             tcx.hir().krate(),
-                            &analysis,
                             tcx,
                             &crate_name,
                         );
@@ -527,7 +523,6 @@ pub struct CompileState<'a, 'tcx: 'a> {
     pub hir_crate: Option<&'a hir::Crate>,
     pub hir_map: Option<&'a hir_map::Map<'tcx>>,
     pub resolutions: Option<&'a Resolutions>,
-    pub analysis: Option<&'a ty::CrateAnalysis>,
     pub tcx: Option<TyCtxt<'a, 'tcx, 'tcx>>,
 }
 
@@ -547,7 +542,6 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> {
             hir_crate: None,
             hir_map: None,
             resolutions: None,
-            analysis: None,
             tcx: None,
         }
     }
@@ -595,7 +589,6 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> {
         out_file: &'a Option<PathBuf>,
         cstore: &'tcx CStore,
         hir_map: &'a hir_map::Map<'tcx>,
-        analysis: &'a ty::CrateAnalysis,
         resolutions: &'a Resolutions,
         krate: &'a ast::Crate,
         hir_crate: &'a hir::Crate,
@@ -606,7 +599,6 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> {
             crate_name: Some(crate_name),
             cstore: Some(cstore),
             hir_map: Some(hir_map),
-            analysis: Some(analysis),
             resolutions: Some(resolutions),
             expanded_crate: Some(krate),
             hir_crate: Some(hir_crate),
@@ -623,12 +615,10 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> {
         out_file: &'a Option<PathBuf>,
         krate: Option<&'a ast::Crate>,
         hir_crate: &'a hir::Crate,
-        analysis: &'a ty::CrateAnalysis,
         tcx: TyCtxt<'a, 'tcx, 'tcx>,
         crate_name: &'a str,
     ) -> Self {
         CompileState {
-            analysis: Some(analysis),
             tcx: Some(tcx),
             expanded_crate: krate,
             hir_crate: Some(hir_crate),
@@ -711,7 +701,6 @@ fn count_nodes(krate: &ast::Crate) -> usize {
 pub struct ExpansionResult {
     pub expanded_crate: ast::Crate,
     pub defs: hir_map::Definitions,
-    pub analysis: ty::CrateAnalysis,
     pub resolutions: Resolutions,
     pub hir_forest: hir_map::Forest,
 }
@@ -772,16 +761,13 @@ where
                 freevars: resolver.freevars,
                 export_map: resolver.export_map,
                 trait_map: resolver.trait_map,
+                glob_map: resolver.glob_map,
                 maybe_unused_trait_imports: resolver.maybe_unused_trait_imports,
                 maybe_unused_extern_crates: resolver.maybe_unused_extern_crates,
                 extern_prelude: resolver.extern_prelude.iter().map(|(ident, entry)| {
                     (ident.name, entry.introduced_by_item)
                 }).collect(),
             },
-
-            analysis: ty::CrateAnalysis {
-                glob_map: resolver.glob_map
-            },
         }),
         Err(x) => Err(x),
     }
@@ -1180,7 +1166,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(
     sess: &'tcx Session,
     cstore: &'tcx CStore,
     hir_map: hir_map::Map<'tcx>,
-    analysis: ty::CrateAnalysis,
     resolutions: Resolutions,
     arenas: &'tcx mut AllArenas<'tcx>,
     name: &str,
@@ -1190,7 +1175,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(
 where
     F: for<'a> FnOnce(
         TyCtxt<'a, 'tcx, 'tcx>,
-        ty::CrateAnalysis,
         mpsc::Receiver<Box<dyn Any + Send>>,
         CompileResult,
     ) -> R,
@@ -1254,7 +1238,7 @@ where
             match typeck::check_crate(tcx) {
                 Ok(x) => x,
                 Err(x) => {
-                    f(tcx, analysis, rx, Err(x));
+                    f(tcx, rx, Err(x));
                     return Err(x);
                 }
             }
@@ -1307,7 +1291,7 @@ where
             // lint warnings and so on -- kindck used to do this abort, but
             // kindck is gone now). -nmatsakis
             if sess.err_count() > 0 {
-                return Ok(f(tcx, analysis, rx, sess.compile_status()));
+                return Ok(f(tcx, rx, sess.compile_status()));
             }
 
             time(sess, "death checking", || middle::dead::check_crate(tcx));
@@ -1318,7 +1302,7 @@ where
 
             time(sess, "lint checking", || lint::check_crate(tcx));
 
-            return Ok(f(tcx, analysis, rx, tcx.sess.compile_status()));
+            return Ok(f(tcx, rx, tcx.sess.compile_status()));
         },
     )
 }
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 010ac28cdc9..c8a5bbe8315 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -879,7 +879,6 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
                     pretty::print_after_hir_lowering(state.session,
                                                      state.cstore.unwrap(),
                                                      state.hir_map.unwrap(),
-                                                     state.analysis.unwrap(),
                                                      state.resolutions.unwrap(),
                                                      state.input,
                                                      &state.expanded_crate.take().unwrap(),
@@ -940,7 +939,6 @@ pub fn enable_save_analysis(control: &mut CompileController) {
         time(state.session, "save analysis", || {
             save::process_crate(state.tcx.unwrap(),
                                 state.expanded_crate.unwrap(),
-                                state.analysis.unwrap(),
                                 state.crate_name.unwrap(),
                                 state.input,
                                 None,
diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs
index a9ec99358c1..d1108304d11 100644
--- a/src/librustc_driver/pretty.rs
+++ b/src/librustc_driver/pretty.rs
@@ -190,7 +190,6 @@ impl PpSourceMode {
         sess: &'tcx Session,
         cstore: &'tcx CStore,
         hir_map: &hir_map::Map<'tcx>,
-        analysis: &ty::CrateAnalysis,
         resolutions: &Resolutions,
         output_filenames: &OutputFilenames,
         id: &str,
@@ -223,12 +222,11 @@ impl PpSourceMode {
                                                                  sess,
                                                                  cstore,
                                                                  hir_map.clone(),
-                                                                 analysis.clone(),
                                                                  resolutions.clone(),
                                                                  &mut arenas,
                                                                  id,
                                                                  output_filenames,
-                                                                 |tcx, _, _, _| {
+                                                                 |tcx, _, _| {
                     let empty_tables = ty::TypeckTables::empty(None);
                     let annotation = TypedAnnotation {
                         tcx,
@@ -959,7 +957,6 @@ pub fn print_after_parsing(sess: &Session,
 pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
                                                 cstore: &'tcx CStore,
                                                 hir_map: &hir_map::Map<'tcx>,
-                                                analysis: &ty::CrateAnalysis,
                                                 resolutions: &Resolutions,
                                                 input: &Input,
                                                 krate: &ast::Crate,
@@ -972,7 +969,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
         print_with_analysis(sess,
                             cstore,
                             hir_map,
-                            analysis,
                             resolutions,
                             crate_name,
                             output_filenames,
@@ -1010,7 +1006,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
                 s.call_with_pp_support_hir(sess,
                                            cstore,
                                            hir_map,
-                                           analysis,
                                            resolutions,
                                            output_filenames,
                                            crate_name,
@@ -1033,7 +1028,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
                 s.call_with_pp_support_hir(sess,
                                            cstore,
                                            hir_map,
-                                           analysis,
                                            resolutions,
                                            output_filenames,
                                            crate_name,
@@ -1048,7 +1042,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
                 s.call_with_pp_support_hir(sess,
                                            cstore,
                                            hir_map,
-                                           analysis,
                                            resolutions,
                                            output_filenames,
                                            crate_name,
@@ -1081,7 +1074,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
                 s.call_with_pp_support_hir(sess,
                                            cstore,
                                            hir_map,
-                                           analysis,
                                            resolutions,
                                            output_filenames,
                                            crate_name,
@@ -1103,13 +1095,12 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
 }
 
 // In an ideal world, this would be a public function called by the driver after
-// analsysis is performed. However, we want to call `phase_3_run_analysis_passes`
+// analysis is performed. However, we want to call `phase_3_run_analysis_passes`
 // with a different callback than the standard driver, so that isn't easy.
 // Instead, we call that function ourselves.
 fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
                                        cstore: &'a CStore,
                                        hir_map: &hir_map::Map<'tcx>,
-                                       analysis: &ty::CrateAnalysis,
                                        resolutions: &Resolutions,
                                        crate_name: &str,
                                        output_filenames: &OutputFilenames,
@@ -1134,12 +1125,11 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
                                                      sess,
                                                      cstore,
                                                      hir_map.clone(),
-                                                     analysis.clone(),
                                                      resolutions.clone(),
                                                      &mut arenas,
                                                      crate_name,
                                                      output_filenames,
-                                                     |tcx, _, _, _| {
+                                                     |tcx, _, _| {
         match ppm {
             PpmMir | PpmMirCFG => {
                 if let Some(nodeid) = nodeid {