Tidy fix
This commit is contained in:
parent
8500c2fab2
commit
3c663d0607
@ -536,7 +536,8 @@ fn process_predicate<'a, 'gcx, 'tcx>(
|
||||
} else {
|
||||
Err(CodeSelectionError(ConstEvalFailure(ConstEvalErr {
|
||||
span: obligation.cause.span,
|
||||
kind: ErrKind::UnimplementedConstVal("could not resolve").into(),
|
||||
kind: ErrKind::UnimplementedConstVal("could not resolve")
|
||||
.into(),
|
||||
})))
|
||||
}
|
||||
},
|
||||
|
@ -42,6 +42,7 @@ pub enum PatternError {
|
||||
StaticInPattern(Span),
|
||||
FloatBug,
|
||||
NonConstPath(Span),
|
||||
AssociatedConstInPattern(Span),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
|
@ -457,7 +457,7 @@ pub fn const_eval_provider<'a, 'tcx>(
|
||||
},
|
||||
};
|
||||
let ty = tcx.type_of(def_id);
|
||||
let layout = (tcx, key.param_env).layout_of(ty).unwrap();
|
||||
let layout = tcx.layout_of(key.param_env.and(ty)).unwrap();
|
||||
let ptr = MemoryPointer::new(id, 0);
|
||||
return Ok(tcx.mk_const(ty::Const {
|
||||
val: ConstVal::Value(Value::ByRef(ptr.into(), layout.align)),
|
||||
|
@ -17,7 +17,6 @@ use rustc::mir::{Constant, Literal, Location, Place, Mir, Operand, Rvalue, Local
|
||||
use rustc::mir::{NullOp, StatementKind, Statement, BasicBlock, LocalKind};
|
||||
use rustc::mir::{TerminatorKind, ClearCrossCrate, SourceInfo, BinOp};
|
||||
use rustc::mir::visit::{Visitor, PlaceContext};
|
||||
use rustc::ty::layout::LayoutOf;
|
||||
use rustc::middle::const_val::ConstVal;
|
||||
use rustc::ty::{TyCtxt, self, Instance};
|
||||
use rustc::mir::interpret::{Value, PrimVal, GlobalId};
|
||||
@ -237,7 +236,7 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> {
|
||||
let r = ecx.value_to_primval(ValTy { value: right.0, ty: right.1 }).ok()?;
|
||||
if op == BinOp::Shr || op == BinOp::Shl {
|
||||
let param_env = self.tcx.param_env(self.source.def_id);
|
||||
let bits = (self.tcx, param_env).layout_of(place_ty).unwrap().size.bits();
|
||||
let bits = self.tcx.layout_of(param_env.and(place_ty)).unwrap().size.bits();
|
||||
if r.to_bytes().ok().map_or(false, |b| b >= bits as u128) {
|
||||
let scope_info = match self.mir.visibility_scope_info {
|
||||
ClearCrossCrate::Set(ref data) => data,
|
||||
@ -286,8 +285,7 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> {
|
||||
fn type_size_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
ty: ty::Ty<'tcx>) -> Option<u64> {
|
||||
use rustc::ty::layout::LayoutOf;
|
||||
(tcx, param_env).layout_of(ty).ok().map(|layout| layout.size.bytes())
|
||||
tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes())
|
||||
}
|
||||
|
||||
struct CanConstProp {
|
||||
|
@ -101,7 +101,6 @@ use rustc::ty::adjustment::{Adjust, Adjustment, AutoBorrow, AutoBorrowMutability
|
||||
use rustc::ty::fold::TypeFoldable;
|
||||
use rustc::ty::maps::Providers;
|
||||
use rustc::ty::util::{Representability, IntTypeExt, Discr};
|
||||
use rustc::ty::layout::LayoutOf;
|
||||
use errors::{DiagnosticBuilder, DiagnosticId};
|
||||
|
||||
use require_c_abi_if_variadic;
|
||||
|
Loading…
x
Reference in New Issue
Block a user