From cb74cd524f2798a098943425c271d9eada8d901e Mon Sep 17 00:00:00 2001 From: James Dietz Date: Sun, 30 Apr 2023 09:47:29 -0400 Subject: change expect() to unwrap_or_else() and update msg --- compiler/rustc_codegen_llvm/src/llvm_util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/rustc_codegen_llvm') diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 1baef931ff9..a5d4ca30fab 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -331,7 +331,7 @@ pub(crate) fn print(req: PrintRequest, sess: &Session) { match req { PrintRequest::TargetCPUs => { let cpu_cstring = CString::new(handle_native(sess.target.cpu.as_ref())) - .expect("failed to convert to cstring"); + .unwrap_or_else(|e| bug!("failed to convert to cstring: {}", e)); unsafe { llvm::LLVMRustPrintTargetCPUs(tm, cpu_cstring.as_ptr()) }; } PrintRequest::TargetFeatures => print_target_features(sess, tm), -- cgit 1.4.1-3-g733a5