From 994d9d03272363d57a655ebacbf58f0069b3b177 Mon Sep 17 00:00:00 2001 From: Rich Kadel Date: Mon, 22 Jun 2020 15:54:28 -0700 Subject: [PATCH] Address remaining feedback items --- src/librustc_metadata/locator.rs | 2 +- src/librustc_middle/hir/map/mod.rs | 2 +- src/librustc_middle/query/mod.rs | 2 +- .../transform/instrument_coverage.rs | 27 ++----------------- 4 files changed, 5 insertions(+), 28 deletions(-) diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs index 662794f0aa1..1bdac1039b5 100644 --- a/src/librustc_metadata/locator.rs +++ b/src/librustc_metadata/locator.rs @@ -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 diff --git a/src/librustc_middle/hir/map/mod.rs b/src/librustc_middle/hir/map/mod.rs index e3e0856ffc5..d60d24aa9ae 100644 --- a/src/librustc_middle/hir/map/mod.rs +++ b/src/librustc_middle/hir/map/mod.rs @@ -56,7 +56,7 @@ fn fn_sig<'hir>(node: Node<'hir>) -> Option<&'hir FnSig<'hir>> { } } -fn associated_body<'hir>(node: Node<'hir>) -> Option { +pub fn associated_body<'hir>(node: Node<'hir>) -> Option { match node { Node::Item(Item { kind: ItemKind::Const(_, body) | ItemKind::Static(.., body) | ItemKind::Fn(.., body), diff --git a/src/librustc_middle/query/mod.rs b/src/librustc_middle/query/mod.rs index 1092e6c3064..993b48afb7a 100644 --- a/src/librustc_middle/query/mod.rs +++ b/src/librustc_middle/query/mod.rs @@ -215,7 +215,7 @@ fn describe_as_module(def_id: DefId, tcx: TyCtxt<'_>) -> String { } query coverage_data(key: DefId) -> Option { - 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() } } diff --git a/src/librustc_mir/transform/instrument_coverage.rs b/src/librustc_mir/transform/instrument_coverage.rs index a24d0acf421..94aa26b3081 100644 --- a/src/librustc_mir/transform/instrument_coverage.rs +++ b/src/librustc_mir/transform/instrument_coverage.rs @@ -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 { - 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, - } -} -- 2.44.0