diff options
| author | bors <bors@rust-lang.org> | 2022-01-14 03:17:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-01-14 03:17:11 +0000 |
| commit | f312a5e610d47601e9a3da828002f5e1ffeb272a (patch) | |
| tree | e0b0afdadcfa568cb67cdc17d31014c75b83971b /compiler/rustc_middle/src | |
| parent | 22e491ac7ed454d34669151a8b6464cb643c9b41 (diff) | |
| parent | 1a95aa9a8bb00fb22f15f2392f8d8e4bf9226d0f (diff) | |
| download | rust-f312a5e610d47601e9a3da828002f5e1ffeb272a.tar.gz rust-f312a5e610d47601e9a3da828002f5e1ffeb272a.zip | |
Auto merge of #92844 - matthiaskrgr:rollup-z5wb6yi, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #90001 (Make rlib metadata strip works with MIPSr6 architecture) - #91687 (rustdoc: do not emit tuple variant fields if none are documented) - #91938 (Add `std::error::Report` type) - #92006 (Welcome opaque types into the fold) - #92142 ([code coverage] Fix missing dead code in modules that are never called) - #92277 (rustc_metadata: Stop passing `CrateMetadataRef` by reference (step 1)) - #92334 (rustdoc: Preserve rendering of macro_rules matchers when possible) - #92807 (Update cargo) - #92832 (Update RELEASES for 1.58.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/mir/mono.rs | 22 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/query/mod.rs | 10 |
2 files changed, 21 insertions, 11 deletions
diff --git a/compiler/rustc_middle/src/mir/mono.rs b/compiler/rustc_middle/src/mir/mono.rs index 1422537cd50..3a6c091b331 100644 --- a/compiler/rustc_middle/src/mir/mono.rs +++ b/compiler/rustc_middle/src/mir/mono.rs @@ -247,6 +247,9 @@ pub struct CodegenUnit<'tcx> { items: FxHashMap<MonoItem<'tcx>, (Linkage, Visibility)>, size_estimate: Option<usize>, primary: bool, + /// True if this is CGU is used to hold code coverage information for dead code, + /// false otherwise. + is_code_coverage_dead_code_cgu: bool, } /// Specifies the linkage type for a `MonoItem`. @@ -277,7 +280,13 @@ pub enum Visibility { impl<'tcx> CodegenUnit<'tcx> { #[inline] pub fn new(name: Symbol) -> CodegenUnit<'tcx> { - CodegenUnit { name, items: Default::default(), size_estimate: None, primary: false } + CodegenUnit { + name, + items: Default::default(), + size_estimate: None, + primary: false, + is_code_coverage_dead_code_cgu: false, + } } pub fn name(&self) -> Symbol { @@ -304,6 +313,15 @@ impl<'tcx> CodegenUnit<'tcx> { &mut self.items } + pub fn is_code_coverage_dead_code_cgu(&self) -> bool { + self.is_code_coverage_dead_code_cgu + } + + /// Marks this CGU as the one used to contain code coverage information for dead code. + pub fn make_code_coverage_dead_code_cgu(&mut self) { + self.is_code_coverage_dead_code_cgu = true; + } + pub fn mangle_name(human_readable_name: &str) -> String { // We generate a 80 bit hash from the name. This should be enough to // avoid collisions and is still reasonably short for filenames. @@ -404,9 +422,11 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for CodegenUnit<'tcx> { // The size estimate is not relevant to the hash size_estimate: _, primary: _, + is_code_coverage_dead_code_cgu, } = *self; name.hash_stable(hcx, hasher); + is_code_coverage_dead_code_cgu.hash_stable(hcx, hasher); let mut items: Vec<(Fingerprint, _)> = items .iter() diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 6dd1ee893a4..3772f1c9fea 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -386,16 +386,6 @@ rustc_queries! { storage(ArenaCacheSelector<'tcx>) } - /// Returns the name of the file that contains the function body, if instrumented for coverage. - query covered_file_name(key: DefId) -> Option<Symbol> { - desc { - |tcx| "retrieving the covered file name, if instrumented, for `{}`", - tcx.def_path_str(key) - } - storage(ArenaCacheSelector<'tcx>) - cache_on_disk_if { key.is_local() } - } - /// Returns the `CodeRegions` for a function that has instrumented coverage, in case the /// function was optimized out before codegen, and before being added to the Coverage Map. query covered_code_regions(key: DefId) -> Vec<&'tcx mir::coverage::CodeRegion> { |
