Rollup merge of #111121 - Zalathar:ra-false-positive, r=jackh726

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: (https://github.com/rust-lang/rust-analyzer/issues/11847).

In these particular cases, changing `&0` to `&0i32` seems to be enough to avoid the bug.
This commit is contained in:
Matthias Krüger 2023-05-24 21:36:56 +02:00 committed by GitHub
commit 09489b9137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -639,7 +639,7 @@ pub(super) fn dump_coverage_spanview<'tcx>(
let def_id = mir_source.def_id(); let def_id = mir_source.def_id();
let span_viewables = span_viewables(tcx, mir_body, basic_coverage_blocks, &coverage_spans); 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"); .expect("Unexpected error creating MIR spanview HTML file");
let crate_name = tcx.crate_name(def_id.krate); let crate_name = tcx.crate_name(def_id.krate);
let item_name = tcx.def_path(def_id).to_filename_friendly_no_crate(); let item_name = tcx.def_path(def_id).to_filename_friendly_no_crate();
@ -740,7 +740,7 @@ pub(super) fn dump_coverage_graphviz<'tcx>(
.join("\n ") .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"); .expect("Unexpected error creating BasicCoverageBlock graphviz DOT file");
graphviz_writer graphviz_writer
.write_graphviz(tcx, &mut file) .write_graphviz(tcx, &mut file)