about summary refs log tree commit diff
path: root/src/librustc_codegen_utils
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-01-14 20:31:56 +0100
committerGitHub <noreply@github.com>2019-01-14 20:31:56 +0100
commit2e1094429d3b122fa6805760180dbd45ad5d1500 (patch)
treec9c39d6e8d3bb203843b7a3317443f5c2ba92797 /src/librustc_codegen_utils
parent2f7a226c4dfd8fe71a7451063b6724166b705cf2 (diff)
parent707a9a08bf3f048ca3c3b0dd752c2b1022242333 (diff)
downloadrust-2e1094429d3b122fa6805760180dbd45ad5d1500.tar.gz
rust-2e1094429d3b122fa6805760180dbd45ad5d1500.zip
Rollup merge of #57570 - Xanewok:querify-some, r=Zoxc
Querify local `plugin_registrar_fn` and `proc_macro_decls_static`

Instead of calculating them as part of the `Session`, we do that in the query system.
It's also nice that these queries are already defined for external crates - here, we provide the queries for the local crate.

r? @nikomatsakis
Diffstat (limited to 'src/librustc_codegen_utils')
-rw-r--r--src/librustc_codegen_utils/symbol_names.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs
index 5a5d1b20b21..9267f14f242 100644
--- a/src/librustc_codegen_utils/symbol_names.rs
+++ b/src/librustc_codegen_utils/symbol_names.rs
@@ -242,12 +242,12 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance
 
     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) {
+    if def_id.is_local() {
+        if tcx.plugin_registrar_fn(LOCAL_CRATE) == Some(def_id) {
             let disambiguator = tcx.sess.local_crate_disambiguator();
             return tcx.sess.generate_plugin_registrar_symbol(disambiguator);
         }
-        if *tcx.sess.proc_macro_decls_static.get() == Some(id) {
+        if tcx.proc_macro_decls_static(LOCAL_CRATE) == Some(def_id) {
             let disambiguator = tcx.sess.local_crate_disambiguator();
             return tcx.sess.generate_proc_macro_decls_symbol(disambiguator);
         }