Skip to content

Commit e9c3d3d

Browse files
authored
Merge pull request #3072 from matthiaskrgr/rustup
rustup, fix breakage introduced by rust-lang/rust#53581 and rust-lang/rust#53459
2 parents f05a103 + 8ab16b6 commit e9c3d3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+166
-169
lines changed

clippy_lints/src/bytecount.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
6565
_ => { return; }
6666
}
6767
};
68-
if ty::TyUint(UintTy::U8) != walk_ptrs_ty(cx.tables.expr_ty(needle)).sty {
68+
if ty::Uint(UintTy::U8) != walk_ptrs_ty(cx.tables.expr_ty(needle)).sty {
6969
return;
7070
}
7171
let haystack = if let ExprKind::MethodCall(ref path, _, ref args) =

clippy_lints/src/consts.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ impl Hash for Constant {
123123
}
124124

125125
impl Constant {
126-
pub fn partial_cmp(tcx: TyCtxt<'_, '_, '_>, cmp_type: &ty::TypeVariants<'_>, left: &Self, right: &Self) -> Option<Ordering> {
126+
pub fn partial_cmp(tcx: TyCtxt<'_, '_, '_>, cmp_type: &ty::TyKind<'_>, left: &Self, right: &Self) -> Option<Ordering> {
127127
match (left, right) {
128128
(&Constant::Str(ref ls), &Constant::Str(ref rs)) => Some(ls.cmp(rs)),
129129
(&Constant::Char(ref l), &Constant::Char(ref r)) => Some(l.cmp(r)),
130130
(&Constant::Int(l), &Constant::Int(r)) => {
131-
if let ty::TyInt(int_ty) = *cmp_type {
131+
if let ty::Int(int_ty) = *cmp_type {
132132
Some(sext(tcx, l, int_ty).cmp(&sext(tcx, r, int_ty)))
133133
} else {
134134
Some(l.cmp(&r))
@@ -166,8 +166,8 @@ pub fn lit_to_constant<'tcx>(lit: &LitKind, ty: Ty<'tcx>) -> Constant {
166166
LitKind::Int(n, _) => Constant::Int(n),
167167
LitKind::Float(ref is, _) |
168168
LitKind::FloatUnsuffixed(ref is) => match ty.sty {
169-
ty::TyFloat(FloatTy::F32) => Constant::F32(is.as_str().parse().unwrap()),
170-
ty::TyFloat(FloatTy::F64) => Constant::F64(is.as_str().parse().unwrap()),
169+
ty::Float(FloatTy::F32) => Constant::F32(is.as_str().parse().unwrap()),
170+
ty::Float(FloatTy::F64) => Constant::F64(is.as_str().parse().unwrap()),
171171
_ => bug!(),
172172
},
173173
LitKind::Bool(b) => Constant::Bool(b),
@@ -220,7 +220,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
220220
ExprKind::Tup(ref tup) => self.multi(tup).map(Constant::Tuple),
221221
ExprKind::Repeat(ref value, _) => {
222222
let n = match self.tables.expr_ty(e).sty {
223-
ty::TyArray(_, n) => n.assert_usize(self.tcx).expect("array length"),
223+
ty::Array(_, n) => n.assert_usize(self.tcx).expect("array length"),
224224
_ => span_bug!(e.span, "typeck error"),
225225
};
226226
self.expr(value).map(|v| Constant::Repeat(Box::new(v), n as u64))
@@ -243,8 +243,8 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
243243
Int(value) => {
244244
let value = !value;
245245
match ty.sty {
246-
ty::TyInt(ity) => Some(Int(unsext(self.tcx, value as i128, ity))),
247-
ty::TyUint(ity) => Some(Int(clip(self.tcx, value, ity))),
246+
ty::Int(ity) => Some(Int(unsext(self.tcx, value as i128, ity))),
247+
ty::Uint(ity) => Some(Int(clip(self.tcx, value, ity))),
248248
_ => None,
249249
}
250250
},
@@ -257,7 +257,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
257257
match *o {
258258
Int(value) => {
259259
let ity = match ty.sty {
260-
ty::TyInt(ity) => ity,
260+
ty::Int(ity) => ity,
261261
_ => return None,
262262
};
263263
// sign extend
@@ -336,7 +336,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
336336
match (l, r) {
337337
(Constant::Int(l), Some(Constant::Int(r))) => {
338338
match self.tables.expr_ty(left).sty {
339-
ty::TyInt(ity) => {
339+
ty::Int(ity) => {
340340
let l = sext(self.tcx, l, ity);
341341
let r = sext(self.tcx, r, ity);
342342
let zext = |n: i128| Constant::Int(unsext(self.tcx, n, ity));
@@ -360,7 +360,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
360360
_ => None,
361361
}
362362
}
363-
ty::TyUint(_) => {
363+
ty::Uint(_) => {
364364
match op.node {
365365
BinOpKind::Add => l.checked_add(r).map(Constant::Int),
366366
BinOpKind::Sub => l.checked_sub(r).map(Constant::Int),
@@ -429,18 +429,18 @@ pub fn miri_to_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, result: &ty::Const<'
429429
use rustc::mir::interpret::{Scalar, ScalarMaybeUndef, ConstValue};
430430
match result.val {
431431
ConstValue::Scalar(Scalar::Bits{ bits: b, ..}) => match result.ty.sty {
432-
ty::TyBool => Some(Constant::Bool(b == 1)),
433-
ty::TyUint(_) | ty::TyInt(_) => Some(Constant::Int(b)),
434-
ty::TyFloat(FloatTy::F32) => Some(Constant::F32(f32::from_bits(b as u32))),
435-
ty::TyFloat(FloatTy::F64) => Some(Constant::F64(f64::from_bits(b as u64))),
432+
ty::Bool => Some(Constant::Bool(b == 1)),
433+
ty::Uint(_) | ty::Int(_) => Some(Constant::Int(b)),
434+
ty::Float(FloatTy::F32) => Some(Constant::F32(f32::from_bits(b as u32))),
435+
ty::Float(FloatTy::F64) => Some(Constant::F64(f64::from_bits(b as u64))),
436436
// FIXME: implement other conversion
437437
_ => None,
438438
},
439439
ConstValue::ScalarPair(Scalar::Ptr(ptr),
440440
ScalarMaybeUndef::Scalar(
441441
Scalar::Bits { bits: n, .. })) => match result.ty.sty {
442-
ty::TyRef(_, tam, _) => match tam.sty {
443-
ty::TyStr => {
442+
ty::Ref(_, tam, _) => match tam.sty {
443+
ty::Str => {
444444
let alloc = tcx
445445
.alloc_map
446446
.lock()

clippy_lints/src/cyclomatic_complexity.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ impl<'a, 'tcx> Visitor<'tcx> for CCHelper<'a, 'tcx> {
159159
walk_expr(self, e);
160160
let ty = self.cx.tables.node_id_to_type(callee.hir_id);
161161
match ty.sty {
162-
ty::TyFnDef(..) | ty::TyFnPtr(_) => {
162+
ty::FnDef(..) | ty::FnPtr(_) => {
163163
let sig = ty.fn_sig(self.cx.tcx);
164-
if sig.skip_binder().output().sty == ty::TyNever {
164+
if sig.skip_binder().output().sty == ty::Never {
165165
self.divergence += 1;
166166
}
167167
},

clippy_lints/src/default_trait_access.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rustc::hir::*;
22
use rustc::lint::*;
33
use rustc::{declare_lint, lint_array};
44
use if_chain::if_chain;
5-
use rustc::ty::TypeVariants;
5+
use rustc::ty::TyKind;
66

77
use crate::utils::{any_parent_is_automatically_derived, match_def_path, opt_def_id, paths, span_lint_and_sugg};
88

@@ -51,7 +51,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DefaultTraitAccess {
5151
// TODO: Work out a way to put "whatever the imported way of referencing
5252
// this type in this file" rather than a fully-qualified type.
5353
let expr_ty = cx.tables.expr_ty(expr);
54-
if let TypeVariants::TyAdt(..) = expr_ty.sty {
54+
if let TyKind::Adt(..) = expr_ty.sty {
5555
let replacement = format!("{}::default()", expr_ty);
5656
span_lint_and_sugg(
5757
cx,

clippy_lints/src/derive.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,18 @@ fn check_copy_clone<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, item: &Item, trait_ref
141141
}
142142

143143
match ty.sty {
144-
ty::TyAdt(def, _) if def.is_union() => return,
144+
ty::Adt(def, _) if def.is_union() => return,
145145

146146
// Some types are not Clone by default but could be cloned “by hand” if necessary
147-
ty::TyAdt(def, substs) => for variant in &def.variants {
147+
ty::Adt(def, substs) => for variant in &def.variants {
148148
for field in &variant.fields {
149-
if let ty::TyFnDef(..) = field.ty(cx.tcx, substs).sty {
149+
if let ty::FnDef(..) = field.ty(cx.tcx, substs).sty {
150150
return;
151151
}
152152
}
153153
for subst in substs {
154154
if let ty::subst::UnpackedKind::Type(subst) = subst.unpack() {
155-
if let ty::TyParam(_) = subst.sty {
155+
if let ty::Param(_) = subst.sty {
156156
return;
157157
}
158158
}

clippy_lints/src/drop_forget_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
128128
let arg = &args[0];
129129
let arg_ty = cx.tables.expr_ty(arg);
130130

131-
if let ty::TyRef(..) = arg_ty.sty {
131+
if let ty::Ref(..) = arg_ty.sty {
132132
if match_def_path(cx.tcx, def_id, &paths::DROP) {
133133
lint = DROP_REF;
134134
msg = DROP_REF_SUMMARY.to_string();

clippy_lints/src/enum_clike.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,19 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
6363
let constant = cx.tcx.const_eval(param_env.and(cid)).ok();
6464
if let Some(Constant::Int(val)) = constant.and_then(|c| miri_to_const(cx.tcx, c)) {
6565
let mut ty = cx.tcx.type_of(did);
66-
if let ty::TyAdt(adt, _) = ty.sty {
66+
if let ty::Adt(adt, _) = ty.sty {
6767
if adt.is_enum() {
6868
ty = adt.repr.discr_type().to_ty(cx.tcx);
6969
}
7070
}
7171
match ty.sty {
72-
ty::TyInt(IntTy::Isize) => {
72+
ty::Int(IntTy::Isize) => {
7373
let val = ((val as i128) << 64) >> 64;
7474
if val <= i128::from(i32::max_value()) && val >= i128::from(i32::min_value()) {
7575
continue;
7676
}
7777
}
78-
ty::TyUint(UintTy::Usize) if val > u128::from(u32::max_value()) => {},
78+
ty::Uint(UintTy::Usize) if val > u128::from(u32::max_value()) => {},
7979
_ => continue,
8080
}
8181
span_lint(

clippy_lints/src/eta_reduction.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ fn check_closure(cx: &LateContext<'_, '_>, expr: &Expr) {
6767
let fn_ty = cx.tables.expr_ty(caller);
6868
match fn_ty.sty {
6969
// Is it an unsafe function? They don't implement the closure traits
70-
ty::TyFnDef(..) | ty::TyFnPtr(_) => {
70+
ty::FnDef(..) | ty::FnPtr(_) => {
7171
let sig = fn_ty.fn_sig(cx.tcx);
72-
if sig.skip_binder().unsafety == Unsafety::Unsafe || sig.skip_binder().output().sty == ty::TyNever {
72+
if sig.skip_binder().unsafety == Unsafety::Unsafe || sig.skip_binder().output().sty == ty::Never {
7373
return;
7474
}
7575
},

clippy_lints/src/eval_order_dependence.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ impl<'a, 'tcx> Visitor<'tcx> for DivergenceVisitor<'a, 'tcx> {
130130
ExprKind::Call(ref func, _) => {
131131
let typ = self.cx.tables.expr_ty(func);
132132
match typ.sty {
133-
ty::TyFnDef(..) | ty::TyFnPtr(_) => {
133+
ty::FnDef(..) | ty::FnPtr(_) => {
134134
let sig = typ.fn_sig(self.cx.tcx);
135-
if let ty::TyNever = self.cx.tcx.erase_late_bound_regions(&sig).output().sty {
135+
if let ty::Never = self.cx.tcx.erase_late_bound_regions(&sig).output().sty {
136136
self.report_diverging_sub_expr(e);
137137
}
138138
},

clippy_lints/src/excessive_precision.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rustc::hir;
22
use rustc::lint::*;
33
use rustc::{declare_lint, lint_array};
44
use if_chain::if_chain;
5-
use rustc::ty::TypeVariants;
5+
use rustc::ty::TyKind;
66
use std::f32;
77
use std::f64;
88
use std::fmt;
@@ -46,7 +46,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExcessivePrecision {
4646
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
4747
if_chain! {
4848
let ty = cx.tables.expr_ty(expr);
49-
if let TypeVariants::TyFloat(fty) = ty.sty;
49+
if let TyKind::Float(fty) = ty.sty;
5050
if let hir::ExprKind::Lit(ref lit) = expr.node;
5151
if let LitKind::Float(sym, _) | LitKind::FloatUnsuffixed(sym) = lit.node;
5252
if let Some(sugg) = self.check(sym, fty);

clippy_lints/src/fallible_impl_from.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_it
130130

131131
fn match_type(tcx: ty::TyCtxt<'_, '_, '_>, ty: ty::Ty<'_>, path: &[&str]) -> bool {
132132
match ty.sty {
133-
ty::TyAdt(adt, _) => match_def_path(tcx, adt.did, path),
133+
ty::Adt(adt, _) => match_def_path(tcx, adt.did, path),
134134
_ => false,
135135
}
136136
}

clippy_lints/src/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn get_single_string_arg(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<Span>
122122
if match_def_path(cx.tcx, fun_def_id, &paths::DISPLAY_FMT_METHOD);
123123
then {
124124
let ty = walk_ptrs_ty(cx.tables.pat_ty(&pat[0]));
125-
if ty.sty == ty::TyStr || match_type(cx, ty, &paths::STRING) {
125+
if ty.sty == ty::Str || match_type(cx, ty, &paths::STRING) {
126126
if let ExprKind::Tup(ref values) = match_expr.node {
127127
return Some(values[0].span);
128128
}

clippy_lints/src/identity_op.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityOp {
6363
fn check(cx: &LateContext<'_, '_>, e: &Expr, m: i8, span: Span, arg: Span) {
6464
if let Some(Constant::Int(v)) = constant_simple(cx, cx.tables, e) {
6565
let check = match cx.tables.expr_ty(e).sty {
66-
ty::TyInt(ity) => unsext(cx.tcx, -1_i128, ity),
67-
ty::TyUint(uty) => clip(cx.tcx, !0, uty),
66+
ty::Int(ity) => unsext(cx.tcx, -1_i128, ity),
67+
ty::Uint(uty) => clip(cx.tcx, !0, uty),
6868
_ => return,
6969
};
7070
if match m {

clippy_lints/src/indexing_slicing.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IndexingSlicing {
9999
let ty = cx.tables.expr_ty(array);
100100
if let Some(range) = higher::range(cx, index) {
101101
// Ranged indexes, i.e. &x[n..m], &x[n..], &x[..n] and &x[..]
102-
if let ty::TyArray(_, s) = ty.sty {
102+
if let ty::Array(_, s) = ty.sty {
103103
let size: u128 = s.assert_usize(cx.tcx).unwrap().into();
104104
// Index is a constant range.
105105
if let Some((start, end)) = to_const_range(cx, range, size) {
@@ -131,7 +131,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IndexingSlicing {
131131
);
132132
} else {
133133
// Catchall non-range index, i.e. [n] or [n << m]
134-
if let ty::TyArray(..) = ty.sty {
134+
if let ty::Array(..) = ty.sty {
135135
// Index is a constant uint.
136136
if let Some(..) = constant(cx, cx.tables, index) {
137137
// Let rustc's `const_err` lint handle constant `usize` indexing on arrays.

clippy_lints/src/invalid_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidRef {
4040
if let ExprKind::Call(ref path, ref args) = expr.node;
4141
if let ExprKind::Path(ref qpath) = path.node;
4242
if args.len() == 0;
43-
if let ty::TyRef(..) = cx.tables.expr_ty(expr).sty;
43+
if let ty::Ref(..) = cx.tables.expr_ty(expr).sty;
4444
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(qpath, path.hir_id));
4545
then {
4646
let msg = if match_def_path(cx.tcx, def_id, &paths::MEM_ZEROED) |

clippy_lints/src/len_zero.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,12 @@ fn has_is_empty(cx: &LateContext<'_, '_>, expr: &Expr) -> bool {
265265

266266
let ty = &walk_ptrs_ty(cx.tables.expr_ty(expr));
267267
match ty.sty {
268-
ty::TyDynamic(ref tt, ..) => cx.tcx
268+
ty::Dynamic(ref tt, ..) => cx.tcx
269269
.associated_items(tt.principal().expect("trait impl not found").def_id())
270270
.any(|item| is_is_empty(cx, &item)),
271-
ty::TyProjection(ref proj) => has_is_empty_impl(cx, proj.item_def_id),
272-
ty::TyAdt(id, _) => has_is_empty_impl(cx, id.did),
273-
ty::TyArray(..) | ty::TySlice(..) | ty::TyStr => true,
271+
ty::Projection(ref proj) => has_is_empty_impl(cx, proj.item_def_id),
272+
ty::Adt(id, _) => has_is_empty_impl(cx, id.did),
273+
ty::Array(..) | ty::Slice(..) | ty::Str => true,
274274
_ => false,
275275
}
276276
}

clippy_lints/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
#![feature(slice_patterns)]
66
#![feature(stmt_expr_attributes)]
77
#![feature(range_contains)]
8-
#![feature(macro_vis_matcher)]
98
#![allow(unknown_lints, shadow_reuse, missing_docs_in_private_items)]
109
#![recursion_limit = "256"]
11-
#![allow(stable_features)]
1210
#![feature(iterator_find_map)]
1311
#![feature(macro_at_most_once_rep)]
14-
#![feature(tool_attributes)]
1512
#![warn(rust_2018_idioms)]
1613

1714
use toml;

0 commit comments

Comments
 (0)