about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-01-29 09:17:38 +0900
committerGitHub <noreply@github.com>2021-01-29 09:17:38 +0900
commit046a414c19cdbec02cf6809f4d25e53057a3a1c9 (patch)
treee34acc2848b27a35487254abc7eeb82ced800f15 /compiler/rustc_codegen_cranelift/src
parent94e093ab9775946983cec2ac7547f61db3064a40 (diff)
parent48f9dbfd59356f865f81ce674eefdbab2d7c3cbb (diff)
downloadrust-046a414c19cdbec02cf6809f4d25e53057a3a1c9.tar.gz
rust-046a414c19cdbec02cf6809f4d25e53057a3a1c9.zip
Rollup merge of #81333 - RalfJung:const-err-simplify, r=oli-obk
clean up some const error reporting around promoteds

These are some error reporting simplifications enabled by https://github.com/rust-lang/rust/pull/80579.

Further simplifications are possible but could be blocked on making `const_err` a hard error.

r? ``````@oli-obk``````
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src')
-rw-r--r--compiler/rustc_codegen_cranelift/src/constant.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs
index beff84fb2e2..5702832bcb6 100644
--- a/compiler/rustc_codegen_cranelift/src/constant.rs
+++ b/compiler/rustc_codegen_cranelift/src/constant.rs
@@ -134,11 +134,9 @@ pub(crate) fn codegen_constant<'tcx>(
             {
                 Ok(const_val) => const_val,
                 Err(_) => {
-                    if promoted.is_none() {
-                        fx.tcx
-                            .sess
-                            .span_err(constant.span, "erroneous constant encountered");
-                    }
+                    fx.tcx
+                        .sess
+                        .span_err(constant.span, "erroneous constant encountered");
                     return crate::trap::trap_unreachable_ret_value(
                         fx,
                         fx.layout_of(const_.ty),