From 1d6b455fb476115712cf7246c5f4cecb7c66915b Mon Sep 17 00:00:00 2001 From: Rich Kadel Date: Tue, 15 Dec 2020 23:33:47 -0800 Subject: Fixed conflict with drop elaboration and coverage See https://github.com/rust-lang/rust/issues/80045#issuecomment-745733339 Coverage statements are moved to the beginning of the BCB. This does also affect what's counted before a panic, changing some results, but I think these results may even be preferred? In any case, there are no guarantees about what's counted when a panic occurs (by design). --- compiler/rustc_mir/src/transform/coverage/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_mir/src/transform/coverage/mod.rs') diff --git a/compiler/rustc_mir/src/transform/coverage/mod.rs b/compiler/rustc_mir/src/transform/coverage/mod.rs index 53f7c28ee35..4590d37c182 100644 --- a/compiler/rustc_mir/src/transform/coverage/mod.rs +++ b/compiler/rustc_mir/src/transform/coverage/mod.rs @@ -310,7 +310,7 @@ impl<'a, 'tcx> Instrumentor<'a, 'tcx> { inject_statement( self.mir_body, counter_kind, - self.bcb_last_bb(bcb), + self.bcb_leader_bb(bcb), Some(make_code_region(file_name, &self.source_file, span, body_span)), ); } @@ -470,7 +470,7 @@ fn inject_statement( code_region: some_code_region, }), }; - data.statements.push(statement); + data.statements.insert(0, statement); } // Non-code expressions are injected into the coverage map, without generating executable code. -- cgit 1.4.1-3-g733a5