rustc_const_eval: remove ref patterns (+some pattern matching imps)
This commit is contained in:
@@ -36,16 +36,16 @@ impl<'tcx> Into<InterpErrorInfo<'tcx>> for ConstEvalErrKind {
|
||||
impl fmt::Display for ConstEvalErrKind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use self::ConstEvalErrKind::*;
|
||||
match *self {
|
||||
match self {
|
||||
ConstAccessesStatic => write!(f, "constant accesses static"),
|
||||
ModifiedGlobal => {
|
||||
write!(f, "modifying a static's initial value from another static's initializer")
|
||||
}
|
||||
AssertFailure(ref msg) => write!(f, "{:?}", msg),
|
||||
AssertFailure(msg) => write!(f, "{:?}", msg),
|
||||
Panic { msg, line, col, file } => {
|
||||
write!(f, "the evaluated program panicked at '{}', {}:{}:{}", msg, file, line, col)
|
||||
}
|
||||
Abort(ref msg) => write!(f, "{}", msg),
|
||||
Abort(msg) => write!(f, "{}", msg),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ pub(super) fn op_to_const<'tcx>(
|
||||
}
|
||||
};
|
||||
match immediate {
|
||||
Left(ref mplace) => to_const_value(mplace),
|
||||
Left(mplace) => to_const_value(&mplace),
|
||||
// see comment on `let try_as_immediate` above
|
||||
Right(imm) => match *imm {
|
||||
_ if imm.layout.is_zst() => ConstValue::ZeroSized,
|
||||
|
||||
@@ -533,7 +533,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
||||
let eval_to_int =
|
||||
|op| ecx.read_immediate(&ecx.eval_operand(op, None)?).map(|x| x.to_const_int());
|
||||
let err = match msg {
|
||||
BoundsCheck { ref len, ref index } => {
|
||||
BoundsCheck { len, index } => {
|
||||
let len = eval_to_int(len)?;
|
||||
let index = eval_to_int(index)?;
|
||||
BoundsCheck { len, index }
|
||||
|
||||
Reference in New Issue
Block a user