Skip to content

Commit

Permalink
Rollup merge of #81333 - RalfJung:const-err-simplify, r=oli-obk
Browse files Browse the repository at this point in the history
clean up some const error reporting around promoteds

These are some error reporting simplifications enabled by rust-lang/rust#80579.

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

r? ``````@oli-obk``````
  • Loading branch information
JohnTitor authored Jan 29, 2021
2 parents c3d7dc9 + d6eb4f5 commit e67b72d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit e67b72d

Please sign in to comment.