use rustc::mir::*;
use rustc::mir::transform::MirSource;
use rustc::mir::visit::MutVisitor;
-use rustc::traits::Reveal;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::subst::Substs;
use rustc::util::nodemap::NodeMap;
};
let src = MirSource::from_node(tcx, id);
- tcx.infer_ctxt(body_id, Reveal::UserFacing).enter(|infcx| {
+ tcx.infer_ctxt(()).enter(|infcx| {
let cx = Cx::new(&infcx, src);
let mut mir = if cx.tables().tainted_by_errors {
build::construct_error(cx, body_id)
{
let span = tcx.hir.span(ctor_id);
if let hir::VariantData::Tuple(ref fields, ctor_id) = *v {
- let pe = tcx.param_env(tcx.hir.local_def_id(ctor_id));
- tcx.infer_ctxt(pe, Reveal::UserFacing).enter(|infcx| {
+ tcx.infer_ctxt(()).enter(|infcx| {
let (mut mir, src) =
shim::build_adt_ctor(&infcx, ctor_id, fields, span);
let upvar_decls: Vec<_> = tcx.with_freevars(fn_id, |freevars| {
freevars.iter().map(|fv| {
let var_id = tcx.hir.as_local_node_id(fv.def.def_id()).unwrap();
- let by_ref = hir.tables().upvar_capture(ty::UpvarId {
+ let capture = hir.tables().upvar_capture(ty::UpvarId {
var_id: var_id,
closure_expr_id: fn_id
- }).map_or(false, |capture| match capture {
+ });
+ let by_ref = match capture {
ty::UpvarCapture::ByValue => false,
ty::UpvarCapture::ByRef(..) => true
- });
+ };
let mut decl = UpvarDecl {
debug_name: keywords::Invalid.name(),
by_ref: by_ref
mir
}
-pub fn construct_const<'a, 'gcx, 'tcx>(hir: Cx<'a, 'gcx, 'tcx>,
- body_id: hir::BodyId)
- -> Mir<'tcx> {
+fn construct_const<'a, 'gcx, 'tcx>(hir: Cx<'a, 'gcx, 'tcx>,
+ body_id: hir::BodyId)
+ -> Mir<'tcx> {
let tcx = hir.tcx();
let ast_expr = &tcx.hir.body(body_id).value;
let ty = hir.tables().expr_ty_adjusted(ast_expr);
builder.finish(vec![], ty)
}
-pub fn construct_error<'a, 'gcx, 'tcx>(hir: Cx<'a, 'gcx, 'tcx>,
+fn construct_error<'a, 'gcx, 'tcx>(hir: Cx<'a, 'gcx, 'tcx>,
body_id: hir::BodyId)
-> Mir<'tcx> {
let span = hir.tcx().hir.span(hir.tcx().hir.body_owner(body_id));