From 6440785304a4cfff75d707f33bc2105ecfec0004 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Sun, 6 Jun 2021 15:41:58 +0300 Subject: [PATCH] Improve ICE message when data-layouts don't match LLVM target name does not necessarily match the Rust target name and it can be confusing when the ICE message is describing a target other than has been specified on the command line. --- compiler/rustc_codegen_llvm/src/context.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index f662887abf820..ac7190fa68653 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -149,11 +149,12 @@ pub unsafe fn create_module( if !custom_llvm_used && target_data_layout != llvm_data_layout { bug!( - "data-layout for builtin `{}` target, `{}`, \ - differs from LLVM default, `{}`", - sess.target.llvm_target, - target_data_layout, - llvm_data_layout + "data-layout for target `{rustc_target}`, `{rustc_layout}`, \ + differs from LLVM target's `{llvm_target}` default layout, `{llvm_layout}`", + rustc_target = sess.opts.target_triple, + rustc_layout = target_data_layout, + llvm_target = sess.target.llvm_target, + llvm_layout = llvm_data_layout ); } }