Skip to content

Commit d2bc991

Browse files
committed
Deny internal lints on librustc_lint
1 parent 818d300 commit d2bc991

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/librustc_lint/builtin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
10361036

10371037
let msg = "mutating transmuted &mut T from &T may cause undefined behavior, \
10381038
consider instead using an UnsafeCell";
1039-
match get_transmute_from_to(cx, expr) {
1039+
match get_transmute_from_to(cx, expr).map(|(ty1, ty2)| (&ty1.sty, &ty2.sty)) {
10401040
Some((&ty::Ref(_, _, from_mt), &ty::Ref(_, _, to_mt))) => {
10411041
if to_mt == hir::Mutability::MutMutable &&
10421042
from_mt == hir::Mutability::MutImmutable {
@@ -1049,7 +1049,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
10491049
fn get_transmute_from_to<'a, 'tcx>
10501050
(cx: &LateContext<'a, 'tcx>,
10511051
expr: &hir::Expr)
1052-
-> Option<(&'tcx ty::TyKind<'tcx>, &'tcx ty::TyKind<'tcx>)> {
1052+
-> Option<(Ty<'tcx>, Ty<'tcx>)> {
10531053
let def = if let hir::ExprKind::Path(ref qpath) = expr.node {
10541054
cx.tables.qpath_def(qpath, expr.hir_id)
10551055
} else {
@@ -1062,7 +1062,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
10621062
let sig = cx.tables.node_type(expr.hir_id).fn_sig(cx.tcx);
10631063
let from = sig.inputs().skip_binder()[0];
10641064
let to = *sig.output().skip_binder();
1065-
return Some((&from.sty, &to.sty));
1065+
return Some((from, to));
10661066
}
10671067
None
10681068
}

src/librustc_lint/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#![recursion_limit="256"]
2121

2222
#![deny(rust_2018_idioms)]
23+
#![cfg_attr(not(stage0), deny(internal))]
2324

2425
#[macro_use]
2526
extern crate rustc;

src/librustc_lint/types.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
321321
//
322322
// No suggestion for: `isize`, `usize`.
323323
fn get_type_suggestion<'a>(
324-
t: &ty::TyKind<'_>,
324+
t: Ty<'_>,
325325
val: u128,
326326
negative: bool,
327327
) -> Option<String> {
@@ -347,14 +347,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
347347
}
348348
}
349349
}
350-
match t {
351-
&ty::Int(i) => find_fit!(i, val, negative,
350+
match t.sty {
351+
ty::Int(i) => find_fit!(i, val, negative,
352352
I8 => [U8] => [I16, I32, I64, I128],
353353
I16 => [U16] => [I32, I64, I128],
354354
I32 => [U32] => [I64, I128],
355355
I64 => [U64] => [I128],
356356
I128 => [U128] => []),
357-
&ty::Uint(u) => find_fit!(u, val, negative,
357+
ty::Uint(u) => find_fit!(u, val, negative,
358358
U8 => [U8, U16, U32, U64, U128] => [],
359359
U16 => [U16, U32, U64, U128] => [],
360360
U32 => [U32, U64, U128] => [],
@@ -364,6 +364,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
364364
}
365365
}
366366

367+
#[cfg_attr(not(stage0), allow(usage_of_ty_tykind))]
367368
fn report_bin_hex_error(
368369
cx: &LateContext<'_, '_>,
369370
expr: &hir::Expr,
@@ -398,7 +399,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
398399
repr_str, val, t, actually, t
399400
));
400401
if let Some(sugg_ty) =
401-
get_type_suggestion(&cx.tables.node_type(expr.hir_id).sty, val, negative)
402+
get_type_suggestion(&cx.tables.node_type(expr.hir_id), val, negative)
402403
{
403404
if let Some(pos) = repr_str.chars().position(|c| c == 'i' || c == 'u') {
404405
let (sans_suffix, _) = repr_str.split_at(pos);

0 commit comments

Comments
 (0)