diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-02-27 02:34:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-27 02:34:21 +0100 |
| commit | cabe97272d782294e0d642135f3d8b13579b2929 (patch) | |
| tree | 2af31ef1bee69e720a118099e88dbe0d33137255 /compiler/rustc_codegen_llvm/src/debuginfo | |
| parent | db8ac16d000e9cd454f8ab99fb04c4410243fa88 (diff) | |
| parent | 38e4233a3291b0b8e3148e7ea47da66c9d8b307f (diff) | |
| download | rust-cabe97272d782294e0d642135f3d8b13579b2929.tar.gz rust-cabe97272d782294e0d642135f3d8b13579b2929.zip | |
Rollup merge of #82057 - upsuper-forks:cstr, r=davidtwco,wesleywiser
Replace const_cstr with cstr crate This PR replaces the `const_cstr` macro inside `rustc_data_structures` with `cstr` macro from [cstr](https://crates.io/crates/cstr) crate. The two macros basically serve the same purpose, which is to generate `&'static CStr` from a string literal. `cstr` is better because it validates the literal at compile time, while the existing `const_cstr` does it at runtime when `debug_assertions` is enabled. In addition, the value `cstr` generates can be used in constant context (which is seemingly not needed anywhere currently, though).
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/debuginfo')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index 1464784ae28..85d1b702399 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -18,8 +18,8 @@ use crate::llvm::debuginfo::{ }; use crate::value::Value; +use cstr::cstr; use rustc_codegen_ssa::traits::*; -use rustc_data_structures::const_cstr; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; @@ -1075,7 +1075,7 @@ pub fn compile_unit_metadata( gcov_cu_info.len() as c_uint, ); - let llvm_gcov_ident = const_cstr!("llvm.gcov"); + let llvm_gcov_ident = cstr!("llvm.gcov"); llvm::LLVMAddNamedMetadataOperand( debug_context.llmod, llvm_gcov_ident.as_ptr(), @@ -1093,7 +1093,7 @@ pub fn compile_unit_metadata( ); llvm::LLVMAddNamedMetadataOperand( debug_context.llmod, - const_cstr!("llvm.ident").as_ptr(), + cstr!("llvm.ident").as_ptr(), llvm::LLVMMDNodeInContext(debug_context.llcontext, &name_metadata, 1), ); } |
