Skip to content

Commit adf8036

Browse files
BennoLossinRalfJung
andcommitted
rustc_const_eval: explain TooGeneric error
Co-authored-by: Ralf Jung <post@ralfj.de>
1 parent fe5608a commit adf8036

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_middle::mir::interpret::{CTFE_ALLOC_SALT, read_target_uint, write_targ
1010
use rustc_middle::mir::{self, BinOp, ConstValue, NonDivergingIntrinsic, NullOp};
1111
use rustc_middle::ty::layout::TyAndLayout;
1212
use rustc_middle::ty::{Ty, TyCtxt};
13-
use rustc_middle::{bug, err_inval, span_bug, ty};
13+
use rustc_middle::{bug, span_bug, ty};
1414
use rustc_span::{Symbol, sym};
1515
use tracing::trace;
1616

@@ -670,7 +670,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
670670
self.write_immediate(*offset, dest)
671671
}
672672
ty::Alias(..) | ty::Param(..) | ty::Placeholder(..) | ty::Infer(..) => {
673-
Err(err_inval!(TooGeneric)).into()
673+
// This can happen in code which is generic over the field type.
674+
throw_inval!(TooGeneric)
674675
}
675676
_ => span_bug!(self.cur_span(), "expected field representing type, found {ty}"),
676677
}

0 commit comments

Comments
 (0)