Skip to content

Commit dd7483c

Browse files
committed
Remove TyKind arg from report_bin_hex_error function
1 parent 4d2a3bb commit dd7483c

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/librustc_lint/types.rs

+6-11
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
104104
report_bin_hex_error(
105105
cx,
106106
e,
107-
ty::Int(t),
107+
attr::IntType::SignedInt(t),
108108
repr_str,
109109
v,
110110
negative,
@@ -159,7 +159,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
159159
report_bin_hex_error(
160160
cx,
161161
e,
162-
ty::Uint(t),
162+
attr::IntType::UnsignedInt(t),
163163
repr_str,
164164
lit_val,
165165
false,
@@ -364,29 +364,24 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
364364
}
365365
}
366366

367-
#[cfg_attr(not(stage0), allow(usage_of_ty_tykind))]
368367
fn report_bin_hex_error(
369368
cx: &LateContext<'_, '_>,
370369
expr: &hir::Expr,
371-
ty: ty::TyKind<'_>,
370+
ty: attr::IntType,
372371
repr_str: String,
373372
val: u128,
374373
negative: bool,
375374
) {
375+
let size = layout::Integer::from_attr(&cx.tcx, ty).size();
376376
let (t, actually) = match ty {
377-
ty::Int(t) => {
378-
let ity = attr::IntType::SignedInt(t);
379-
let size = layout::Integer::from_attr(&cx.tcx, ity).size();
377+
attr::IntType::SignedInt(t) => {
380378
let actually = sign_extend(val, size) as i128;
381379
(format!("{:?}", t), actually.to_string())
382380
}
383-
ty::Uint(t) => {
384-
let ity = attr::IntType::UnsignedInt(t);
385-
let size = layout::Integer::from_attr(&cx.tcx, ity).size();
381+
attr::IntType::UnsignedInt(t) => {
386382
let actually = truncate(val, size);
387383
(format!("{:?}", t), actually.to_string())
388384
}
389-
_ => bug!(),
390385
};
391386
let mut err = cx.struct_span_lint(
392387
OVERFLOWING_LITERALS,

0 commit comments

Comments
 (0)