coverage: Avoid a query stability hazard in function_coverage_map
When #118865 started enforcing the `rustc::potential_query_instability` lint in `rustc_codegen_llvm`, it added an exemption for this site, arguing that the entries are only used to create a list of filenames that is later sorted. However, the list of entries also gets traversed when creating the function coverage records in LLVM IR, which may be sensitive to hash-based ordering. This patch therefore changes `function_coverage_map` to use `FxIndexMap`, which should avoid hash-based instability by iterating in insertion order.
This commit is contained in:
@@ -58,11 +58,6 @@ pub fn finalize(cx: &CodegenCx<'_, '_>) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The entries of the map are only used to get a list of all files with
|
||||
// coverage info. In the end the list of files is passed into
|
||||
// `GlobalFileTable::new()` which internally do `.sort_unstable_by()`, so
|
||||
// the iteration order here does not matter.
|
||||
#[allow(rustc::potential_query_instability)]
|
||||
let function_coverage_entries = function_coverage_map
|
||||
.into_iter()
|
||||
.map(|(instance, function_coverage)| (instance, function_coverage.into_finished()))
|
||||
|
||||
Reference in New Issue
Block a user