diff options
| author | Rich Kadel <richkadel@google.com> | 2020-06-05 09:14:45 -0700 |
|---|---|---|
| committer | Rich Kadel <richkadel@google.com> | 2020-06-15 16:50:10 -0700 |
| commit | d2cd59a0315809afa58df0196c34b33ee0a8c161 (patch) | |
| tree | 3983e85ba18ec57e3bf6472118f54f24c9eb95a8 /src/libcore | |
| parent | 2c5c2a6bc2f7023ee8ad252d2ee5a45fbfb2de22 (diff) | |
| download | rust-d2cd59a0315809afa58df0196c34b33ee0a8c161.tar.gz rust-d2cd59a0315809afa58df0196c34b33ee0a8c161.zip | |
Add case for count_code_region() extern lang_item
As suggested in PR feedback: https://github.com/rust-lang/rust/pull/73011#discussion_r435728923 This allows count_code_region() to be handled like a normal intrinsic so the InstanceDef::InjectedCode variant is no longer needed.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/intrinsics.rs | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 06a432a2696..7ce5814d39a 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1941,22 +1941,13 @@ extern "rust-intrinsic" { /// /// Perma-unstable: do not use. pub fn miri_start_panic(payload: *mut u8) -> !; -} -/// Defines the `count_code_region` intrinsic as a `LangItem`. `LangItem`s require a function body -/// to register its DefId with the LangItem entry. The function body is never actually called (and -/// is therefore implemented as an aborting stub) because it is replaced with the LLVM intrinsic -/// `llvm.instrprof.increment` by -/// `rustc_codegen_llvm::intrinsic::IntrinsicCallMethods::codegen_intrinsic_call()`. -#[cfg(not(bootstrap))] -#[cfg_attr(not(bootstrap), lang = "count_code_region")] -fn count_code_region(_index: u32) { - // remove `unsafe` (and safety comment) on bootstrap bump - #[cfg_attr(not(bootstrap), allow(unused_unsafe))] - // SAFETY: the `abort` intrinsic has no requirements to be called. - unsafe { - abort() - } + /// Internal placeholder for injecting code coverage counters when the "instrument-coverage" + /// option is enabled. The placeholder is replaced with `llvm.instrprof.increment` during code + /// generation. + #[cfg(not(bootstrap))] + #[cfg_attr(not(bootstrap), lang = "count_code_region")] + pub fn count_code_region(_index: u32); } // Some functions are defined here because they accidentally got made |
