Fix rustup fallout

This commit is contained in:
flip1995 2020-10-01 16:40:59 +02:00
parent 730ca457f5
commit d28211ddb6
No known key found for this signature in database
GPG Key ID: 2CEFCDB27ED0BE79

View File

@ -826,7 +826,7 @@ struct FixedOffsetVar<'hir> {
} }
fn is_slice_like<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'_>) -> bool { fn is_slice_like<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'_>) -> bool {
let is_slice = match ty.kind() { let is_slice = match ty.kind {
ty::Ref(_, subty, _) => is_slice_like(cx, subty), ty::Ref(_, subty, _) => is_slice_like(cx, subty),
ty::Slice(..) | ty::Array(..) => true, ty::Slice(..) | ty::Array(..) => true,
_ => false, _ => false,
@ -1403,7 +1403,7 @@ fn is_end_eq_array_len<'tcx>(
if_chain! { if_chain! {
if let ExprKind::Lit(ref lit) = end.kind; if let ExprKind::Lit(ref lit) = end.kind;
if let ast::LitKind::Int(end_int, _) = lit.node; if let ast::LitKind::Int(end_int, _) = lit.node;
if let ty::Array(_, arr_len_const) = indexed_ty.kind(); if let ty::Array(_, arr_len_const) = indexed_ty.kind;
if let Some(arr_len) = arr_len_const.try_eval_usize(cx.tcx, cx.param_env); if let Some(arr_len) = arr_len_const.try_eval_usize(cx.tcx, cx.param_env);
then { then {
return match limits { return match limits {
@ -1640,7 +1640,7 @@ fn check_for_loop_over_map_kv<'tcx>(
if let PatKind::Tuple(ref pat, _) = pat.kind { if let PatKind::Tuple(ref pat, _) = pat.kind {
if pat.len() == 2 { if pat.len() == 2 {
let arg_span = arg.span; let arg_span = arg.span;
let (new_pat_span, kind, ty, mutbl) = match *cx.typeck_results().expr_ty(arg).kind() { let (new_pat_span, kind, ty, mutbl) = match cx.typeck_results().expr_ty(arg).kind {
ty::Ref(_, ty, mutbl) => match (&pat[0].kind, &pat[1].kind) { ty::Ref(_, ty, mutbl) => match (&pat[0].kind, &pat[1].kind) {
(key, _) if pat_is_wild(key, body) => (pat[1].span, "value", ty, mutbl), (key, _) if pat_is_wild(key, body) => (pat[1].span, "value", ty, mutbl),
(_, value) if pat_is_wild(value, body) => (pat[0].span, "key", ty, Mutability::Not), (_, value) if pat_is_wild(value, body) => (pat[0].span, "key", ty, Mutability::Not),
@ -1968,7 +1968,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
for expr in args { for expr in args {
let ty = self.cx.typeck_results().expr_ty_adjusted(expr); let ty = self.cx.typeck_results().expr_ty_adjusted(expr);
self.prefer_mutable = false; self.prefer_mutable = false;
if let ty::Ref(_, _, mutbl) = *ty.kind() { if let ty::Ref(_, _, mutbl) = ty.kind {
if mutbl == Mutability::Mut { if mutbl == Mutability::Mut {
self.prefer_mutable = true; self.prefer_mutable = true;
} }
@ -1980,7 +1980,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
let def_id = self.cx.typeck_results().type_dependent_def_id(expr.hir_id).unwrap(); let def_id = self.cx.typeck_results().type_dependent_def_id(expr.hir_id).unwrap();
for (ty, expr) in self.cx.tcx.fn_sig(def_id).inputs().skip_binder().iter().zip(args) { for (ty, expr) in self.cx.tcx.fn_sig(def_id).inputs().skip_binder().iter().zip(args) {
self.prefer_mutable = false; self.prefer_mutable = false;
if let ty::Ref(_, _, mutbl) = *ty.kind() { if let ty::Ref(_, _, mutbl) = ty.kind {
if mutbl == Mutability::Mut { if mutbl == Mutability::Mut {
self.prefer_mutable = true; self.prefer_mutable = true;
} }
@ -2078,7 +2078,7 @@ fn is_ref_iterable_type(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
fn is_iterable_array<'tcx>(ty: Ty<'tcx>, cx: &LateContext<'tcx>) -> bool { fn is_iterable_array<'tcx>(ty: Ty<'tcx>, cx: &LateContext<'tcx>) -> bool {
// IntoIterator is currently only implemented for array sizes <= 32 in rustc // IntoIterator is currently only implemented for array sizes <= 32 in rustc
match ty.kind() { match ty.kind {
ty::Array(_, n) => n ty::Array(_, n) => n
.try_eval_usize(cx.tcx, cx.param_env) .try_eval_usize(cx.tcx, cx.param_env)
.map_or(false, |val| (0..=32).contains(&val)), .map_or(false, |val| (0..=32).contains(&val)),