Skip to content

Commit d274294

Browse files
committed
Rustup to *1.10.0-nightly (22ac88f 2016-05-11)*
1 parent fe6ad91 commit d274294

File tree

6 files changed

+29
-28
lines changed

6 files changed

+29
-28
lines changed

src/cyclomatic_complexity.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl CyclomaticComplexity {
5858
divergence: 0,
5959
short_circuits: 0,
6060
returns: 0,
61-
tcx: cx.tcx,
61+
tcx: &cx.tcx,
6262
};
6363
helper.visit_block(block);
6464
let CCHelper { match_arms, divergence, short_circuits, returns, .. } = helper;
@@ -117,15 +117,15 @@ impl LateLintPass for CyclomaticComplexity {
117117
}
118118
}
119119

120-
struct CCHelper<'a, 'tcx: 'a> {
120+
struct CCHelper<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
121121
match_arms: u64,
122122
divergence: u64,
123123
returns: u64,
124124
short_circuits: u64, // && and ||
125-
tcx: &'a ty::TyCtxt<'tcx>,
125+
tcx: &'a ty::TyCtxt<'a, 'gcx, 'tcx>,
126126
}
127127

128-
impl<'a, 'b, 'tcx> Visitor<'a> for CCHelper<'b, 'tcx> {
128+
impl<'a, 'b, 'tcx, 'gcx> Visitor<'a> for CCHelper<'b, 'gcx, 'tcx> {
129129
fn visit_expr(&mut self, e: &'a Expr) {
130130
match e.node {
131131
ExprMatch(_, ref arms, _) => {

src/derive.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ impl LateLintPass for Derive {
8686
}
8787

8888
/// Implementation of the `DERIVE_HASH_XOR_EQ` lint.
89-
fn check_hash_peq<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, span: Span, trait_ref: &TraitRef, ty: ty::Ty<'tcx>, hash_is_automatically_derived: bool) {
89+
fn check_hash_peq<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, span: Span, trait_ref: &TraitRef, ty: ty::Ty<'tcx>, hash_is_automatically_derived: bool) {
9090
if_let_chain! {[
9191
match_path(&trait_ref.path, &paths::HASH),
9292
let Some(peq_trait_def_id) = cx.tcx.lang_items.eq_trait()
9393
], {
9494
let peq_trait_def = cx.tcx.lookup_trait_def(peq_trait_def_id);
9595

9696
// Look for the PartialEq implementations for `ty`
97-
peq_trait_def.for_each_relevant_impl(&cx.tcx, ty, |impl_id| {
97+
peq_trait_def.for_each_relevant_impl(cx.tcx, ty, |impl_id| {
9898
let peq_is_automatically_derived = cx.tcx.get_attrs(impl_id).iter().any(is_automatically_derived);
9999

100100
if peq_is_automatically_derived == hash_is_automatically_derived {
@@ -133,7 +133,7 @@ fn check_copy_clone<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, item: &Item, trait_ref
133133
let parameter_environment = ty::ParameterEnvironment::for_item(cx.tcx, item.id);
134134
let subst_ty = ty.subst(cx.tcx, &parameter_environment.free_substs);
135135

136-
if subst_ty.moves_by_default(&parameter_environment, item.span) {
136+
if subst_ty.moves_by_default(cx.tcx.global_tcx(), &parameter_environment, item.span) {
137137
return; // ty is not Copy
138138
}
139139

src/escape.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,16 @@ impl LintPass for EscapePass {
5555
impl LateLintPass for EscapePass {
5656
fn check_fn(&mut self, cx: &LateContext, _: visit::FnKind, decl: &FnDecl, body: &Block, _: Span, id: NodeId) {
5757
let param_env = ty::ParameterEnvironment::for_item(cx.tcx, id);
58-
let infcx = infer::new_infer_ctxt(cx.tcx, &cx.tcx.tables, Some(param_env), ProjectionMode::Any);
5958
let mut v = EscapeDelegate {
6059
cx: cx,
6160
set: NodeSet(),
6261
};
63-
{
62+
63+
cx.tcx.infer_ctxt(None, Some(param_env), ProjectionMode::Any).enter(|infcx| {
6464
let mut vis = ExprUseVisitor::new(&mut v, &infcx);
6565
vis.walk_fn(decl, body);
66-
}
66+
});
67+
6768
for node in v.set {
6869
span_lint(cx,
6970
BOXED_LOCAL,

src/methods.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ fn lint_clone_on_copy(cx: &LateContext, expr: &Expr) {
560560
let parent = cx.tcx.map.get_parent(expr.id);
561561
let parameter_environment = ty::ParameterEnvironment::for_item(cx.tcx, parent);
562562

563-
if !ty.moves_by_default(&parameter_environment, expr.span) {
563+
if !ty.moves_by_default(cx.tcx.global_tcx(), &parameter_environment, expr.span) {
564564
span_lint(cx, CLONE_ON_COPY, expr.span, "using `clone` on a `Copy` type");
565565
}
566566
}
@@ -1044,5 +1044,5 @@ fn is_bool(ty: &Ty) -> bool {
10441044

10451045
fn is_copy<'a, 'ctx>(cx: &LateContext<'a, 'ctx>, ty: ty::Ty<'ctx>, item: &Item) -> bool {
10461046
let env = ty::ParameterEnvironment::for_item(cx.tcx, item.id);
1047-
!ty.subst(cx.tcx, &env.free_substs).moves_by_default(&env, item.span)
1047+
!ty.subst(cx.tcx, &env.free_substs).moves_by_default(cx.tcx.global_tcx(), &env, item.span)
10481048
}

src/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ declare_lint! {
105105
fn check_let_unit(cx: &LateContext, decl: &Decl) {
106106
if let DeclLocal(ref local) = decl.node {
107107
let bindtype = &cx.tcx.pat_ty(&local.pat).sty;
108-
if *bindtype == ty::TyTuple(vec![]) {
108+
if *bindtype == ty::TyTuple(&[]) {
109109
if in_external_macro(cx, decl.span) || in_macro(cx, local.pat.span) {
110110
return;
111111
}
@@ -162,7 +162,7 @@ impl LateLintPass for UnitCmp {
162162
if let ExprBinary(ref cmp, ref left, _) = expr.node {
163163
let op = cmp.node;
164164
let sty = &cx.tcx.expr_ty(left).sty;
165-
if *sty == ty::TyTuple(vec![]) && op.is_comparison() {
165+
if *sty == ty::TyTuple(&[]) && op.is_comparison() {
166166
let result = match op {
167167
BiEq | BiLe | BiGe => "true",
168168
_ => "false",

src/utils/mod.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use reexport::*;
22
use rustc::hir::*;
33
use rustc::hir::def_id::DefId;
44
use rustc::hir::map::Node;
5-
use rustc::infer;
65
use rustc::lint::{LintContext, LateContext, Level, Lint};
76
use rustc::middle::cstore;
87
use rustc::session::Session;
@@ -274,15 +273,15 @@ pub fn implements_trait<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: ty::Ty<'tcx>,
274273
cx.tcx.populate_implementations_for_trait_if_necessary(trait_id);
275274

276275
let ty = cx.tcx.erase_regions(&ty);
277-
let infcx = infer::new_infer_ctxt(cx.tcx, &cx.tcx.tables, None, ProjectionMode::Any);
278-
let obligation = traits::predicate_for_trait_def(cx.tcx,
279-
traits::ObligationCause::dummy(),
280-
trait_id,
281-
0,
282-
ty,
283-
ty_params);
284-
285-
traits::SelectionContext::new(&infcx).evaluate_obligation_conservatively(&obligation)
276+
cx.tcx.infer_ctxt(None, None, ProjectionMode::Any).enter(|infcx| {
277+
let obligation = cx.tcx.predicate_for_trait_def(traits::ObligationCause::dummy(),
278+
trait_id,
279+
0,
280+
ty,
281+
ty_params);
282+
283+
traits::SelectionContext::new(&infcx).evaluate_obligation_conservatively(&obligation)
284+
})
286285
}
287286

288287
/// Match an `Expr` against a chain of methods, and return the matched `Expr`s.
@@ -809,10 +808,11 @@ pub fn return_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, fn_item: NodeId) -> Optio
809808
// not for type parameters.
810809
pub fn same_tys<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, a: ty::Ty<'tcx>, b: ty::Ty<'tcx>, parameter_item: NodeId) -> bool {
811810
let parameter_env = ty::ParameterEnvironment::for_item(cx.tcx, parameter_item);
812-
let infcx = infer::new_infer_ctxt(cx.tcx, &cx.tcx.tables, Some(parameter_env), ProjectionMode::Any);
813-
let new_a = a.subst(infcx.tcx, &infcx.parameter_environment.free_substs);
814-
let new_b = b.subst(infcx.tcx, &infcx.parameter_environment.free_substs);
815-
infcx.can_equate(&new_a, &new_b).is_ok()
811+
cx.tcx.infer_ctxt(None, Some(parameter_env), ProjectionMode::Any).enter(|infcx| {
812+
let new_a = a.subst(infcx.tcx, &infcx.parameter_environment.free_substs);
813+
let new_b = b.subst(infcx.tcx, &infcx.parameter_environment.free_substs);
814+
infcx.can_equate(&new_a, &new_b).is_ok()
815+
})
816816
}
817817

818818
/// Recover the essential nodes of a desugared for loop:

0 commit comments

Comments
 (0)