Address nits
This commit is contained in:
parent
7a8f83a6e5
commit
ce089e50a4
@ -1113,7 +1113,10 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
|
||||
ast::PatIdent(ast::BindByValue(_), _, ref sub) => {
|
||||
let pat_ty = tcx.node_id_to_type(p.id);
|
||||
//FIXME: (@jroesch) this code should be floated up as well
|
||||
let infcx = infer::new_infer_ctxt(cx.tcx, &cx.tcx.tables, Some(cx.param_env.clone()), false);
|
||||
let infcx = infer::new_infer_ctxt(cx.tcx,
|
||||
&cx.tcx.tables,
|
||||
Some(cx.param_env.clone()),
|
||||
false);
|
||||
if infcx.type_moves_by_default(pat_ty, pat.span) {
|
||||
check_move(p, sub.as_ref().map(|p| &**p));
|
||||
}
|
||||
@ -1143,7 +1146,11 @@ fn check_for_mutation_in_guard<'a, 'tcx>(cx: &'a MatchCheckCtxt<'a, 'tcx>,
|
||||
cx: cx,
|
||||
};
|
||||
|
||||
let infcx = infer::new_infer_ctxt(cx.tcx, &cx.tcx.tables, Some(checker.cx.param_env.clone()), false);
|
||||
let infcx = infer::new_infer_ctxt(cx.tcx,
|
||||
&cx.tcx.tables,
|
||||
Some(checker.cx.param_env.clone()),
|
||||
false);
|
||||
|
||||
let mut visitor = ExprUseVisitor::new(&mut checker, &infcx);
|
||||
visitor.walk_expr(guard);
|
||||
}
|
||||
|
@ -41,7 +41,10 @@ impl<'a, 'tcx, 'v> visit::Visitor<'v> for RvalueContext<'a, 'tcx> {
|
||||
{
|
||||
// FIXME (@jroesch) change this to be an inference context
|
||||
let param_env = ParameterEnvironment::for_item(self.tcx, fn_id);
|
||||
let infcx = infer::new_infer_ctxt(self.tcx, &self.tcx.tables, Some(param_env.clone()), false);
|
||||
let infcx = infer::new_infer_ctxt(self.tcx,
|
||||
&self.tcx.tables,
|
||||
Some(param_env.clone()),
|
||||
false);
|
||||
let mut delegate = RvalueContextDelegate { tcx: self.tcx, param_env: ¶m_env };
|
||||
let mut euv = euv::ExprUseVisitor::new(&mut delegate, &infcx);
|
||||
euv.walk_fn(fd, b);
|
||||
|
@ -1318,6 +1318,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
pub fn type_moves_by_default(&self, ty: Ty<'tcx>, span: Span) -> bool {
|
||||
let ty = self.resolve_type_vars_if_possible(&ty);
|
||||
!traits::type_known_to_meet_builtin_bound(self, ty, ty::BoundCopy, span)
|
||||
// FIXME(@jroesch): should be able to use:
|
||||
// ty.moves_by_default(&self.parameter_environment, span)
|
||||
}
|
||||
|
||||
pub fn node_method_ty(&self, method_call: ty::MethodCall)
|
||||
|
@ -436,7 +436,7 @@ pub fn fully_normalize<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
|
||||
debug!("normalize_param_env(value={:?})", value);
|
||||
|
||||
let mut selcx = &mut SelectionContext::new(infcx);
|
||||
// FIXME (@jroesch):
|
||||
// FIXME (@jroesch) ISSUE 26721
|
||||
// I'm not sure if this is a bug or not, needs further investigation.
|
||||
// It appears that by reusing the fulfillment_cx here we incur more
|
||||
// obligations and later trip an asssertion on regionck.rs line 337.
|
||||
@ -459,7 +459,7 @@ pub fn fully_normalize<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
|
||||
for obligation in obligations {
|
||||
fulfill_cx.register_predicate_obligation(selcx.infcx(), obligation);
|
||||
}
|
||||
|
||||
|
||||
try!(fulfill_cx.select_all_or_error(infcx));
|
||||
let resolved_value = infcx.resolve_type_vars_if_possible(&normalized_value);
|
||||
debug!("normalize_param_env: resolved_value={:?}", resolved_value);
|
||||
|
@ -4385,7 +4385,7 @@ impl<'tcx> TyS<'tcx> {
|
||||
is_impld
|
||||
}
|
||||
|
||||
// temp hack, probably should be private
|
||||
// FIXME (@jroesch): I made this public to use it, not sure if should be private
|
||||
pub fn moves_by_default<'a>(&'tcx self, param_env: &ParameterEnvironment<'a,'tcx>,
|
||||
span: Span) -> bool {
|
||||
if self.flags.get().intersects(TypeFlags::MOVENESS_CACHED) {
|
||||
|
@ -22,7 +22,6 @@ use middle::cfg;
|
||||
use middle::def;
|
||||
use middle::infer;
|
||||
use middle::lang_items::LangItem;
|
||||
use middle::region;
|
||||
use middle::subst::{self, Substs};
|
||||
use trans::base;
|
||||
use trans::build;
|
||||
|
@ -30,7 +30,7 @@ use rustc::ast_map;
|
||||
use trans::common::{NodeIdAndSpan, CrateContext, FunctionContext, Block};
|
||||
use trans;
|
||||
use trans::monomorphize;
|
||||
use middle::ty::Ty;
|
||||
use middle::ty::Ty;
|
||||
use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
|
||||
use util::nodemap::{DefIdMap, NodeMap, FnvHashMap, FnvHashSet};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user