Skip to content

Commit

Permalink
Rollup merge of #111121 - Zalathar:ra-false-positive, r=jackh726
Browse files Browse the repository at this point in the history
Work around `rust-analyzer` false-positive type errors

rust-analyzer incorrectly reports two type errors in `debug.rs`:

> expected &dyn Display, found &i32
> expected &dyn Display, found &i32

This is due to a known bug in r-a: (rust-lang/rust-analyzer#11847).

In these particular cases, changing `&0` to `&0i32` seems to be enough to avoid the bug.
  • Loading branch information
matthiaskrgr authored May 24, 2023
2 parents 97d3280 + 5494eec commit 09489b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_mir_transform/src/coverage/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ pub(super) fn dump_coverage_spanview<'tcx>(
let def_id = mir_source.def_id();

let span_viewables = span_viewables(tcx, mir_body, basic_coverage_blocks, &coverage_spans);
let mut file = create_dump_file(tcx, "html", false, pass_name, &0, mir_body)
let mut file = create_dump_file(tcx, "html", false, pass_name, &0i32, mir_body)
.expect("Unexpected error creating MIR spanview HTML file");
let crate_name = tcx.crate_name(def_id.krate);
let item_name = tcx.def_path(def_id).to_filename_friendly_no_crate();
Expand Down Expand Up @@ -740,7 +740,7 @@ pub(super) fn dump_coverage_graphviz<'tcx>(
.join("\n ")
));
}
let mut file = create_dump_file(tcx, "dot", false, pass_name, &0, mir_body)
let mut file = create_dump_file(tcx, "dot", false, pass_name, &0i32, mir_body)
.expect("Unexpected error creating BasicCoverageBlock graphviz DOT file");
graphviz_writer
.write_graphviz(tcx, &mut file)
Expand Down

0 comments on commit 09489b9

Please sign in to comment.