Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5f45e62

Browse files
committedJul 15, 2024
Auto merge of #127762 - matthiaskrgr:rollup-965c2du, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #124921 (offset_from: always allow pointers to point to the same address) - #127407 (Make parse error suggestions verbose and fix spans) - #127675 (Remove invalid help diagnostics for const pointer) - #127684 (consolidate miri-unleashed tests for mutable refs into one file) - #127758 (coverage: Restrict `ExpressionUsed` simplification to `Code` mappings) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d3dd34a + 78c6622 commit 5f45e62

File tree

184 files changed

+3591
-1303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+3591
-1303
lines changed
 

‎compiler/rustc_mir_transform/src/coverage/mod.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rustc_span::source_map::SourceMap;
2525
use rustc_span::{BytePos, Pos, RelativeBytePos, Span, Symbol};
2626

2727
use crate::coverage::counters::{CounterIncrementSite, CoverageCounters};
28-
use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph};
28+
use crate::coverage::graph::CoverageGraph;
2929
use crate::coverage::mappings::ExtractedMappings;
3030
use crate::MirPass;
3131

@@ -88,8 +88,7 @@ fn instrument_function_for_coverage<'tcx>(tcx: TyCtxt<'tcx>, mir_body: &mut mir:
8888
// every coverage span has a `Counter` or `Expression` assigned to its `BasicCoverageBlock`
8989
// and all `Expression` dependencies (operands) are also generated, for any other
9090
// `BasicCoverageBlock`s not already associated with a coverage span.
91-
let bcbs_with_counter_mappings =
92-
extracted_mappings.all_bcbs_with_counter_mappings(&basic_coverage_blocks);
91+
let bcbs_with_counter_mappings = extracted_mappings.all_bcbs_with_counter_mappings();
9392
if bcbs_with_counter_mappings.is_empty() {
9493
// No relevant spans were found in MIR, so skip instrumenting this function.
9594
return;
@@ -109,7 +108,7 @@ fn instrument_function_for_coverage<'tcx>(tcx: TyCtxt<'tcx>, mir_body: &mut mir:
109108
inject_coverage_statements(
110109
mir_body,
111110
&basic_coverage_blocks,
112-
bcb_has_counter_mappings,
111+
&extracted_mappings,
113112
&coverage_counters,
114113
);
115114

@@ -163,6 +162,7 @@ fn create_mappings<'tcx>(
163162

164163
// Fully destructure the mappings struct to make sure we don't miss any kinds.
165164
let ExtractedMappings {
165+
num_bcbs: _,
166166
code_mappings,
167167
branch_pairs,
168168
mcdc_bitmap_bytes: _,
@@ -219,7 +219,7 @@ fn create_mappings<'tcx>(
219219
fn inject_coverage_statements<'tcx>(
220220
mir_body: &mut mir::Body<'tcx>,
221221
basic_coverage_blocks: &CoverageGraph,
222-
bcb_has_coverage_spans: impl Fn(BasicCoverageBlock) -> bool,
222+
extracted_mappings: &ExtractedMappings,
223223
coverage_counters: &CoverageCounters,
224224
) {
225225
// Inject counter-increment statements into MIR.
@@ -252,11 +252,16 @@ fn inject_coverage_statements<'tcx>(
252252
// can check whether the injected statement survived MIR optimization.
253253
// (BCB edges can't have spans, so we only need to process BCB nodes here.)
254254
//
255+
// We only do this for ordinary `Code` mappings, because branch and MC/DC
256+
// mappings might have expressions that don't correspond to any single
257+
// point in the control-flow graph.
258+
//
255259
// See the code in `rustc_codegen_llvm::coverageinfo::map_data` that deals
256260
// with "expressions seen" and "zero terms".
261+
let eligible_bcbs = extracted_mappings.bcbs_with_ordinary_code_mappings();
257262
for (bcb, expression_id) in coverage_counters
258263
.bcb_nodes_with_coverage_expressions()
259-
.filter(|&(bcb, _)| bcb_has_coverage_spans(bcb))
264+
.filter(|&(bcb, _)| eligible_bcbs.contains(bcb))
260265
{
261266
inject_statement(
262267
mir_body,

‎compiler/rustc_parse/messages.ftl

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parse_add_paren = try adding parentheses
22
33
parse_ambiguous_range_pattern = the range pattern here has ambiguous interpretation
4-
.suggestion = add parentheses to clarify the precedence
4+
parse_ambiguous_range_pattern_suggestion = add parentheses to clarify the precedence
55
66
parse_array_brackets_instead_of_braces = this is a block expression, not an array
77
.suggestion = to make an array, use square brackets instead of curly braces
@@ -323,10 +323,10 @@ parse_incorrect_semicolon =
323323
.suggestion = remove this semicolon
324324
.help = {$name} declarations are not followed by a semicolon
325325
326-
parse_incorrect_use_of_await =
327-
incorrect use of `await`
326+
parse_incorrect_use_of_await = incorrect use of `await`
328327
.parentheses_suggestion = `await` is not a method call, remove the parentheses
329-
.postfix_suggestion = `await` is a postfix operation
328+
329+
parse_incorrect_use_of_await_postfix_suggestion = `await` is a postfix operation
330330
331331
parse_incorrect_visibility_restriction = incorrect visibility restriction
332332
.help = some possible visibility restrictions are:
@@ -644,7 +644,7 @@ parse_parentheses_with_struct_fields = invalid `struct` delimiters or `fn` call
644644
.suggestion_no_fields_for_fn = if `{$type}` is a function, use the arguments directly
645645
646646
parse_parenthesized_lifetime = parenthesized lifetime bounds are not supported
647-
.suggestion = remove the parentheses
647+
parse_parenthesized_lifetime_suggestion = remove the parentheses
648648
649649
parse_path_single_colon = path separator must be a double colon
650650
.suggestion = use a double colon instead
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.