Address nits
This commit is contained in:
parent
7a8f83a6e5
commit
ce089e50a4
7 changed files with 19 additions and 8 deletions
|
@ -1113,7 +1113,10 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
|
||||||
ast::PatIdent(ast::BindByValue(_), _, ref sub) => {
|
ast::PatIdent(ast::BindByValue(_), _, ref sub) => {
|
||||||
let pat_ty = tcx.node_id_to_type(p.id);
|
let pat_ty = tcx.node_id_to_type(p.id);
|
||||||
//FIXME: (@jroesch) this code should be floated up as well
|
//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) {
|
if infcx.type_moves_by_default(pat_ty, pat.span) {
|
||||||
check_move(p, sub.as_ref().map(|p| &**p));
|
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,
|
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);
|
let mut visitor = ExprUseVisitor::new(&mut checker, &infcx);
|
||||||
visitor.walk_expr(guard);
|
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
|
// FIXME (@jroesch) change this to be an inference context
|
||||||
let param_env = ParameterEnvironment::for_item(self.tcx, fn_id);
|
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 delegate = RvalueContextDelegate { tcx: self.tcx, param_env: ¶m_env };
|
||||||
let mut euv = euv::ExprUseVisitor::new(&mut delegate, &infcx);
|
let mut euv = euv::ExprUseVisitor::new(&mut delegate, &infcx);
|
||||||
euv.walk_fn(fd, b);
|
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 {
|
pub fn type_moves_by_default(&self, ty: Ty<'tcx>, span: Span) -> bool {
|
||||||
let ty = self.resolve_type_vars_if_possible(&ty);
|
let ty = self.resolve_type_vars_if_possible(&ty);
|
||||||
!traits::type_known_to_meet_builtin_bound(self, ty, ty::BoundCopy, span)
|
!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)
|
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);
|
debug!("normalize_param_env(value={:?})", value);
|
||||||
|
|
||||||
let mut selcx = &mut SelectionContext::new(infcx);
|
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.
|
// 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
|
// It appears that by reusing the fulfillment_cx here we incur more
|
||||||
// obligations and later trip an asssertion on regionck.rs line 337.
|
// 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 {
|
for obligation in obligations {
|
||||||
fulfill_cx.register_predicate_obligation(selcx.infcx(), obligation);
|
fulfill_cx.register_predicate_obligation(selcx.infcx(), obligation);
|
||||||
}
|
}
|
||||||
|
|
||||||
try!(fulfill_cx.select_all_or_error(infcx));
|
try!(fulfill_cx.select_all_or_error(infcx));
|
||||||
let resolved_value = infcx.resolve_type_vars_if_possible(&normalized_value);
|
let resolved_value = infcx.resolve_type_vars_if_possible(&normalized_value);
|
||||||
debug!("normalize_param_env: resolved_value={:?}", resolved_value);
|
debug!("normalize_param_env: resolved_value={:?}", resolved_value);
|
||||||
|
|
|
@ -4385,7 +4385,7 @@ impl<'tcx> TyS<'tcx> {
|
||||||
is_impld
|
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>,
|
pub fn moves_by_default<'a>(&'tcx self, param_env: &ParameterEnvironment<'a,'tcx>,
|
||||||
span: Span) -> bool {
|
span: Span) -> bool {
|
||||||
if self.flags.get().intersects(TypeFlags::MOVENESS_CACHED) {
|
if self.flags.get().intersects(TypeFlags::MOVENESS_CACHED) {
|
||||||
|
|
|
@ -22,7 +22,6 @@ use middle::cfg;
|
||||||
use middle::def;
|
use middle::def;
|
||||||
use middle::infer;
|
use middle::infer;
|
||||||
use middle::lang_items::LangItem;
|
use middle::lang_items::LangItem;
|
||||||
use middle::region;
|
|
||||||
use middle::subst::{self, Substs};
|
use middle::subst::{self, Substs};
|
||||||
use trans::base;
|
use trans::base;
|
||||||
use trans::build;
|
use trans::build;
|
||||||
|
|
|
@ -30,7 +30,7 @@ use rustc::ast_map;
|
||||||
use trans::common::{NodeIdAndSpan, CrateContext, FunctionContext, Block};
|
use trans::common::{NodeIdAndSpan, CrateContext, FunctionContext, Block};
|
||||||
use trans;
|
use trans;
|
||||||
use trans::monomorphize;
|
use trans::monomorphize;
|
||||||
use middle::ty::Ty;
|
use middle::ty::Ty;
|
||||||
use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
|
use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
|
||||||
use util::nodemap::{DefIdMap, NodeMap, FnvHashMap, FnvHashSet};
|
use util::nodemap::{DefIdMap, NodeMap, FnvHashMap, FnvHashSet};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue