diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-12-04 13:45:36 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-12-06 17:24:36 +0100 |
| commit | a70babed03d58d042024e41f0a46f7e33e34d0d1 (patch) | |
| tree | 78f557eea7a424eba2c1fa75da9a6845c2607bd8 /src/librustc_codegen_utils | |
| parent | 367e783e6f66a4dba32decdc68a262953d2f3f1b (diff) | |
| download | rust-a70babed03d58d042024e41f0a46f7e33e34d0d1.tar.gz rust-a70babed03d58d042024e41f0a46f7e33e34d0d1.zip | |
Use a function to access the Hir map to be able to turn it into a query later
Diffstat (limited to 'src/librustc_codegen_utils')
| -rw-r--r-- | src/librustc_codegen_utils/lib.rs | 2 | ||||
| -rw-r--r-- | src/librustc_codegen_utils/symbol_names.rs | 4 | ||||
| -rw-r--r-- | src/librustc_codegen_utils/symbol_names_test.rs | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs index ea8259d79a1..cbef3ff5b92 100644 --- a/src/librustc_codegen_utils/lib.rs +++ b/src/librustc_codegen_utils/lib.rs @@ -53,7 +53,7 @@ pub mod symbol_names_test; /// reporting an error. pub fn check_for_rustc_errors_attr(tcx: TyCtxt) { if let Some((id, span, _)) = *tcx.sess.entry_fn.borrow() { - let main_def_id = tcx.hir.local_def_id(id); + let main_def_id = tcx.hir().local_def_id(id); if tcx.has_attr(main_def_id, "rustc_error") { tcx.sess.span_fatal(span, "compilation successful"); diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index 611d7b137c6..305c718ff06 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -250,7 +250,7 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance debug!("symbol_name(def_id={:?}, substs={:?})", def_id, substs); - let node_id = tcx.hir.as_local_node_id(def_id); + let node_id = tcx.hir().as_local_node_id(def_id); if let Some(id) = node_id { if *tcx.sess.plugin_registrar_fn.get() == Some(id) { @@ -265,7 +265,7 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance // FIXME(eddyb) Precompute a custom symbol name based on attributes. let is_foreign = if let Some(id) = node_id { - match tcx.hir.get(id) { + match tcx.hir().get(id) { Node::ForeignItem(_) => true, _ => false, } diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index 6eaf0c1c08d..c4ad31ab021 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -33,7 +33,7 @@ pub fn report_symbol_names<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { let mut visitor = SymbolNamesTest { tcx }; - tcx.hir.krate().visit_all_item_likes(&mut visitor); + tcx.hir().krate().visit_all_item_likes(&mut visitor); }) } @@ -45,7 +45,7 @@ impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> { fn process_attrs(&mut self, node_id: ast::NodeId) { let tcx = self.tcx; - let def_id = tcx.hir.local_def_id(node_id); + let def_id = tcx.hir().local_def_id(node_id); for attr in tcx.get_attrs(def_id).iter() { if attr.check_name(SYMBOL_NAME) { // for now, can only use on monomorphic names |
