rustup to rustc 1.16.0-nightly (c07a6ae77 2017-01-17)

This commit is contained in:
Mrmaxmeier 2017-01-18 21:35:38 +01:00
parent 713da45906
commit 84c57ad221
4 changed files with 19 additions and 8 deletions

View file

@ -326,7 +326,8 @@ fn has_where_lifetimes<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, where_clause: &
}, },
WherePredicate::EqPredicate(ref pred) => { WherePredicate::EqPredicate(ref pred) => {
let mut visitor = RefVisitor::new(cx); let mut visitor = RefVisitor::new(cx);
walk_ty(&mut visitor, &pred.ty); walk_ty(&mut visitor, &pred.lhs_ty);
walk_ty(&mut visitor, &pred.rhs_ty);
if !visitor.lts.is_empty() { if !visitor.lts.is_empty() {
return true; return true;
} }

View file

@ -335,7 +335,6 @@ fn check_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, bindings:
fn check_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty, bindings: &mut Vec<(Name, Span)>) { fn check_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty, bindings: &mut Vec<(Name, Span)>) {
match ty.node { match ty.node {
TyObjectSum(ref sty, _) |
TySlice(ref sty) => check_ty(cx, sty, bindings), TySlice(ref sty) => check_ty(cx, sty, bindings),
TyArray(ref fty, body_id) => { TyArray(ref fty, body_id) => {
check_ty(cx, fty, bindings); check_ty(cx, fty, bindings);

View file

@ -699,12 +699,23 @@ impl<'a, 'tcx: 'a> Visitor<'tcx> for TypeComplexityVisitor<'a, 'tcx> {
// the "normal" components of a type: named types, arrays/tuples // the "normal" components of a type: named types, arrays/tuples
TyPath(..) | TySlice(..) | TyTup(..) | TyArray(..) => (10 * self.nest, 1), TyPath(..) | TySlice(..) | TyTup(..) | TyArray(..) => (10 * self.nest, 1),
// "Sum" of trait bounds // function types bring a lot of overhead
TyObjectSum(..) => (20 * self.nest, 0), TyBareFn(..) => (50 * self.nest, 1),
// function types and "for<...>" bring a lot of overhead TyTraitObject(ref bounds) => {
TyBareFn(..) | let has_lifetimes = bounds.iter()
TyPolyTraitRef(..) => (50 * self.nest, 1), .any(|bound| match *bound {
TraitTyParamBound(ref poly_trait, ..) => !poly_trait.bound_lifetimes.is_empty(),
RegionTyParamBound(..) => true,
});
if has_lifetimes {
// complex trait bounds like A<'a, 'b>
(50 * self.nest, 1)
} else {
// simple trait bounds like A + B
(20 * self.nest, 0)
}
},
_ => (0, 0), _ => (0, 0),
}; };

View file

@ -116,7 +116,7 @@ impl<'a> Sugg<'a> {
ast::ExprKind::Try(..) | ast::ExprKind::Try(..) |
ast::ExprKind::Tup(..) | ast::ExprKind::Tup(..) |
ast::ExprKind::TupField(..) | ast::ExprKind::TupField(..) |
ast::ExprKind::Vec(..) | ast::ExprKind::Array(..) |
ast::ExprKind::While(..) | ast::ExprKind::While(..) |
ast::ExprKind::WhileLet(..) => Sugg::NonParen(snippet), ast::ExprKind::WhileLet(..) => Sugg::NonParen(snippet),
ast::ExprKind::Range(.., RangeLimits::HalfOpen) => Sugg::BinOp(AssocOp::DotDot, snippet), ast::ExprKind::Range(.., RangeLimits::HalfOpen) => Sugg::BinOp(AssocOp::DotDot, snippet),