@@ -144,7 +144,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers {
144
144
}
145
145
146
146
fn check_expr ( & mut self , cx : & LateContext < ' _ , ' _ > , e : & hir:: Expr < ' _ > ) {
147
- let ty = cx. tables . node_type ( e. hir_id ) ;
147
+ let ty = cx. tables ( ) . node_type ( e. hir_id ) ;
148
148
self . check_heap_type ( cx, e. span , ty) ;
149
149
}
150
150
}
@@ -161,11 +161,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
161
161
fn check_pat ( & mut self , cx : & LateContext < ' _ , ' _ > , pat : & hir:: Pat < ' _ > ) {
162
162
if let PatKind :: Struct ( ref qpath, field_pats, _) = pat. kind {
163
163
let variant = cx
164
- . tables
164
+ . tables ( )
165
165
. pat_ty ( pat)
166
166
. ty_adt_def ( )
167
167
. expect ( "struct pattern type is not an ADT" )
168
- . variant_of_res ( cx. tables . qpath_res ( qpath, pat. hir_id ) ) ;
168
+ . variant_of_res ( cx. tables ( ) . qpath_res ( qpath, pat. hir_id ) ) ;
169
169
for fieldpat in field_pats {
170
170
if fieldpat. is_shorthand {
171
171
continue ;
@@ -178,7 +178,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
178
178
}
179
179
if let PatKind :: Binding ( binding_annot, _, ident, None ) = fieldpat. pat . kind {
180
180
if cx. tcx . find_field_index ( ident, & variant)
181
- == Some ( cx. tcx . field_index ( fieldpat. hir_id , cx. tables ) )
181
+ == Some ( cx. tcx . field_index ( fieldpat. hir_id , cx. tables ( ) ) )
182
182
{
183
183
cx. struct_span_lint ( NON_SHORTHAND_FIELD_PATTERNS , fieldpat. span , |lint| {
184
184
let mut err = lint
@@ -901,15 +901,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
901
901
expr : & hir:: Expr < ' _ > ,
902
902
) -> Option < ( Ty < ' tcx > , Ty < ' tcx > ) > {
903
903
let def = if let hir:: ExprKind :: Path ( ref qpath) = expr. kind {
904
- cx. tables . qpath_res ( qpath, expr. hir_id )
904
+ cx. tables ( ) . qpath_res ( qpath, expr. hir_id )
905
905
} else {
906
906
return None ;
907
907
} ;
908
908
if let Res :: Def ( DefKind :: Fn , did) = def {
909
909
if !def_id_is_transmute ( cx, did) {
910
910
return None ;
911
911
}
912
- let sig = cx. tables . node_type ( expr. hir_id ) . fn_sig ( cx. tcx ) ;
912
+ let sig = cx. tables ( ) . node_type ( expr. hir_id ) . fn_sig ( cx. tcx ) ;
913
913
let from = sig. inputs ( ) . skip_binder ( ) [ 0 ] ;
914
914
let to = * sig. output ( ) . skip_binder ( ) ;
915
915
return Some ( ( from, to) ) ;
@@ -1891,7 +1891,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue {
1891
1891
if let hir:: ExprKind :: Call ( ref path_expr, ref args) = expr. kind {
1892
1892
// Find calls to `mem::{uninitialized,zeroed}` methods.
1893
1893
if let hir:: ExprKind :: Path ( ref qpath) = path_expr. kind {
1894
- let def_id = cx. tables . qpath_res ( qpath, path_expr. hir_id ) . opt_def_id ( ) ?;
1894
+ let def_id = cx. tables ( ) . qpath_res ( qpath, path_expr. hir_id ) . opt_def_id ( ) ?;
1895
1895
1896
1896
if cx. tcx . is_diagnostic_item ( sym:: mem_zeroed, def_id) {
1897
1897
return Some ( InitKind :: Zeroed ) ;
@@ -1905,14 +1905,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue {
1905
1905
}
1906
1906
} else if let hir:: ExprKind :: MethodCall ( _, _, ref args, _) = expr. kind {
1907
1907
// Find problematic calls to `MaybeUninit::assume_init`.
1908
- let def_id = cx. tables . type_dependent_def_id ( expr. hir_id ) ?;
1908
+ let def_id = cx. tables ( ) . type_dependent_def_id ( expr. hir_id ) ?;
1909
1909
if cx. tcx . is_diagnostic_item ( sym:: assume_init, def_id) {
1910
1910
// This is a call to *some* method named `assume_init`.
1911
1911
// See if the `self` parameter is one of the dangerous constructors.
1912
1912
if let hir:: ExprKind :: Call ( ref path_expr, _) = args[ 0 ] . kind {
1913
1913
if let hir:: ExprKind :: Path ( ref qpath) = path_expr. kind {
1914
1914
let def_id =
1915
- cx. tables . qpath_res ( qpath, path_expr. hir_id ) . opt_def_id ( ) ?;
1915
+ cx. tables ( ) . qpath_res ( qpath, path_expr. hir_id ) . opt_def_id ( ) ?;
1916
1916
1917
1917
if cx. tcx . is_diagnostic_item ( sym:: maybe_uninit_zeroed, def_id) {
1918
1918
return Some ( InitKind :: Zeroed ) ;
@@ -2025,7 +2025,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue {
2025
2025
// This conjures an instance of a type out of nothing,
2026
2026
// using zeroed or uninitialized memory.
2027
2027
// We are extremely conservative with what we warn about.
2028
- let conjured_ty = cx. tables . expr_ty ( expr) ;
2028
+ let conjured_ty = cx. tables ( ) . expr_ty ( expr) ;
2029
2029
if let Some ( ( msg, span) ) = ty_find_init_error ( cx. tcx , conjured_ty, init) {
2030
2030
cx. struct_span_lint ( INVALID_VALUE , expr. span , |lint| {
2031
2031
let mut err = lint. build ( & format ! (
0 commit comments