Update to nightly 2018-05-22

Fixes #2788
This commit is contained in:
Mateusz Mikuła 2018-05-22 15:45:14 +02:00 committed by Mateusz Mikuła
parent 3c6503eb4b
commit a1c44e966e
10 changed files with 41 additions and 37 deletions

View file

@ -120,11 +120,11 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
(&ExprMethodCall(ref l_path, _, ref l_args), &ExprMethodCall(ref r_path, _, ref r_args)) => {
!self.ignore_fn && l_path == r_path && self.eq_exprs(l_args, r_args)
},
(&ExprRepeat(ref le, ll_id), &ExprRepeat(ref re, rl_id)) => {
let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(ll_id));
let ll = celcx.expr(&self.cx.tcx.hir.body(ll_id).value);
let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(rl_id));
let rl = celcx.expr(&self.cx.tcx.hir.body(rl_id).value);
(&ExprRepeat(ref le, ref ll_id), &ExprRepeat(ref re, ref rl_id)) => {
let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(ll_id.body));
let ll = celcx.expr(&self.cx.tcx.hir.body(ll_id.body).value);
let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(rl_id.body));
let rl = celcx.expr(&self.cx.tcx.hir.body(rl_id.body).value);
self.eq_expr(le, re) && ll == rl
},
@ -234,16 +234,16 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
fn eq_ty(&mut self, left: &Ty, right: &Ty) -> bool {
match (&left.node, &right.node) {
(&TySlice(ref l_vec), &TySlice(ref r_vec)) => self.eq_ty(l_vec, r_vec),
(&TyArray(ref lt, ll_id), &TyArray(ref rt, rl_id)) => {
(&TyArray(ref lt, ref ll_id), &TyArray(ref rt, ref rl_id)) => {
let full_table = self.tables;
let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(ll_id));
self.tables = self.cx.tcx.body_tables(ll_id);
let ll = celcx.expr(&self.cx.tcx.hir.body(ll_id).value);
let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(ll_id.body));
self.tables = self.cx.tcx.body_tables(ll_id.body);
let ll = celcx.expr(&self.cx.tcx.hir.body(ll_id.body).value);
let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(rl_id));
self.tables = self.cx.tcx.body_tables(rl_id);
let rl = celcx.expr(&self.cx.tcx.hir.body(rl_id).value);
let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(rl_id.body));
self.tables = self.cx.tcx.body_tables(rl_id.body);
let rl = celcx.expr(&self.cx.tcx.hir.body(rl_id.body).value);
let eq_ty = self.eq_ty(lt, rt);
self.tables = full_table;
@ -474,13 +474,13 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
self.hash_name(&path.name);
self.hash_exprs(args);
},
ExprRepeat(ref e, l_id) => {
ExprRepeat(ref e, ref l_id) => {
let c: fn(_, _) -> _ = ExprRepeat;
c.hash(&mut self.s);
self.hash_expr(e);
let full_table = self.tables;
self.tables = self.cx.tcx.body_tables(l_id);
self.hash_expr(&self.cx.tcx.hir.body(l_id).value);
self.tables = self.cx.tcx.body_tables(l_id.body);
self.hash_expr(&self.cx.tcx.hir.body(l_id.body).value);
self.tables = full_table;
},
ExprRet(ref e) => {

View file

@ -330,12 +330,12 @@ fn print_expr(cx: &LateContext, expr: &hir::Expr, indent: usize) {
print_expr(cx, base, indent + 1);
}
},
hir::ExprRepeat(ref val, body_id) => {
hir::ExprRepeat(ref val, ref anon_const) => {
println!("{}Repeat", ind);
println!("{}value:", ind);
print_expr(cx, val, indent + 1);
println!("{}repeat count:", ind);
print_expr(cx, &cx.tcx.hir.body(body_id).value, indent + 1);
print_expr(cx, &cx.tcx.hir.body(anon_const.body).value, indent + 1);
},
}
}

View file

@ -8,7 +8,7 @@ use rustc::hir::map::Node;
use rustc::lint::{LateContext, Level, Lint, LintContext};
use rustc::session::Session;
use rustc::traits;
use rustc::ty::{self, Ty, TyCtxt, layout::{self, IntegerExt}};
use rustc::ty::{self, Ty, TyCtxt, layout::{self, IntegerExt}, subst::Kind};
use rustc_errors::{Applicability, CodeSuggestion, Substitution, SubstitutionPart};
use std::borrow::Cow;
use std::env;
@ -295,7 +295,7 @@ pub fn implements_trait<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
ty: Ty<'tcx>,
trait_id: DefId,
ty_params: &[Ty<'tcx>],
ty_params: &[Kind<'tcx>],
) -> bool {
let ty = cx.tcx.erase_regions(&ty);
let obligation =