]> git.lizzy.rs Git - rust.git/commitdiff
Address remaining feedback items
authorRich Kadel <richkadel@google.com>
Mon, 22 Jun 2020 22:54:28 +0000 (15:54 -0700)
committerRich Kadel <richkadel@google.com>
Mon, 22 Jun 2020 22:54:28 +0000 (15:54 -0700)
src/librustc_metadata/locator.rs
src/librustc_middle/hir/map/mod.rs
src/librustc_middle/query/mod.rs
src/librustc_mir/transform/instrument_coverage.rs

index 662794f0aa11f15ce8a6a711ffe6585e6ac6ab2f..1bdac1039b55a48e07bb179599993968857b0fdf 100644 (file)
@@ -489,7 +489,7 @@ impl<'a> CrateLocator<'a> {
             {
                 err.note(&format!("the `{}` target may not be installed", self.triple));
             } else if self.crate_name == sym::profiler_builtins {
-                err.note(&"the compiler may have been built without `profiler = true`");
+                err.note(&"the compiler may have been built without the profiler runtime");
             }
             err.span_label(self.span, "can't find crate");
             err
index e3e0856ffc52ea5ac4f72ac536e43528cc0d2399..d60d24aa9aed5473ca70f86df966c29528ad9e2c 100644 (file)
@@ -56,7 +56,7 @@ fn fn_sig<'hir>(node: Node<'hir>) -> Option<&'hir FnSig<'hir>> {
     }
 }
 
-fn associated_body<'hir>(node: Node<'hir>) -> Option<BodyId> {
+pub fn associated_body<'hir>(node: Node<'hir>) -> Option<BodyId> {
     match node {
         Node::Item(Item {
             kind: ItemKind::Const(_, body) | ItemKind::Static(.., body) | ItemKind::Fn(.., body),
index 1092e6c306411c43ed9332f7a9f90d406c6a7ea4..993b48afb7a9a88cd4c3a2e37e3cc003f3a9593a 100644 (file)
@@ -215,7 +215,7 @@ fn describe_as_module(def_id: DefId, tcx: TyCtxt<'_>) -> String {
         }
 
         query coverage_data(key: DefId) -> Option<mir::CoverageData> {
-            desc { |tcx| "retrieving coverage data, if computed from MIR for `{}`", tcx.def_path_str(key) }
+            desc { |tcx| "retrieving coverage data from MIR for `{}`", tcx.def_path_str(key) }
             storage(ArenaCacheSelector<'tcx>)
             cache_on_disk_if { key.is_local() }
         }
index a24d0acf4212cff3062b72f03f2b8697fe0e4f9a..94aa26b3081e52b44571a012c56296cd3a644651 100644 (file)
@@ -3,7 +3,7 @@
 use rustc_data_structures::fingerprint::Fingerprint;
 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
 use rustc_hir::lang_items;
-use rustc_hir::*;
+use rustc_middle::hir;
 use rustc_middle::ich::StableHashingContext;
 use rustc_middle::mir::interpret::Scalar;
 use rustc_middle::mir::{
@@ -140,7 +140,7 @@ fn placeholder_block(span: Span) -> BasicBlockData<'tcx> {
 
 fn hash_mir_source<'tcx>(tcx: TyCtxt<'tcx>, src: &MirSource<'tcx>) -> u64 {
     let fn_body_id = match tcx.hir().get_if_local(src.def_id()) {
-        Some(node) => match associated_body(node) {
+        Some(node) => match hir::map::associated_body(node) {
             Some(body_id) => body_id,
             _ => bug!("instrumented MirSource does not include a function body: {:?}", node),
         },
@@ -159,26 +159,3 @@ fn hash(
     node.hash_stable(hcx, &mut stable_hasher);
     stable_hasher.finish()
 }
-
-fn associated_body<'hir>(node: Node<'hir>) -> Option<BodyId> {
-    match node {
-        Node::Item(Item {
-            kind: ItemKind::Const(_, body) | ItemKind::Static(.., body) | ItemKind::Fn(.., body),
-            ..
-        })
-        | Node::TraitItem(TraitItem {
-            kind:
-                TraitItemKind::Const(_, Some(body)) | TraitItemKind::Fn(_, TraitFn::Provided(body)),
-            ..
-        })
-        | Node::ImplItem(ImplItem {
-            kind: ImplItemKind::Const(_, body) | ImplItemKind::Fn(_, body),
-            ..
-        })
-        | Node::Expr(Expr { kind: ExprKind::Closure(.., body, _, _), .. }) => Some(*body),
-
-        Node::AnonConst(constant) => Some(constant.body),
-
-        _ => None,
-    }
-}