1
1
use clippy_utils:: diagnostics:: span_lint_hir;
2
- use rustc_hir:: { self , intravisit, AssocItemKind , Body , FnDecl , HirId , HirIdSet , Impl , ItemKind , Node , Pat , PatKind } ;
2
+ use rustc_hir:: { intravisit, AssocItemKind , Body , FnDecl , HirId , HirIdSet , Impl , ItemKind , Node , Pat , PatKind } ;
3
3
use rustc_hir_typeck:: expr_use_visitor:: { Delegate , ExprUseVisitor , PlaceBase , PlaceWithHirId } ;
4
4
use rustc_infer:: infer:: TyCtxtInferExt ;
5
5
use rustc_lint:: { LateContext , LateLintPass } ;
6
6
use rustc_middle:: mir:: FakeReadCause ;
7
7
use rustc_middle:: ty:: layout:: LayoutOf ;
8
- use rustc_middle:: ty:: { self , TraitRef , Ty } ;
8
+ use rustc_middle:: ty:: { self , TraitRef , Ty , TyCtxt } ;
9
9
use rustc_session:: impl_lint_pass;
10
10
use rustc_span:: def_id:: LocalDefId ;
11
11
use rustc_span:: symbol:: kw;
@@ -76,7 +76,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
76
76
. hir ( )
77
77
. get_parent_item ( cx. tcx . local_def_id_to_hir_id ( fn_def_id) )
78
78
. def_id ;
79
- let parent_node = cx. tcx . hir ( ) . find_by_def_id ( parent_id) ;
79
+ let parent_node = cx. tcx . opt_hir_node_by_def_id ( parent_id) ;
80
80
81
81
let mut trait_self_ty = None ;
82
82
if let Some ( Node :: Item ( item) ) = parent_node {
@@ -122,16 +122,16 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
122
122
}
123
123
124
124
// TODO: Replace with Map::is_argument(..) when it's fixed
125
- fn is_argument ( map : rustc_middle :: hir :: map :: Map < ' _ > , id : HirId ) -> bool {
126
- match map . find ( id) {
125
+ fn is_argument ( tcx : TyCtxt < ' _ > , id : HirId ) -> bool {
126
+ match tcx . opt_hir_node ( id) {
127
127
Some ( Node :: Pat ( Pat {
128
128
kind : PatKind :: Binding ( ..) ,
129
129
..
130
130
} ) ) => ( ) ,
131
131
_ => return false ,
132
132
}
133
133
134
- matches ! ( map . find_parent( id) , Some ( Node :: Param ( _) ) )
134
+ matches ! ( tcx . hir ( ) . find_parent( id) , Some ( Node :: Param ( _) ) )
135
135
}
136
136
137
137
impl < ' a , ' tcx > Delegate < ' tcx > for EscapeDelegate < ' a , ' tcx > {
@@ -154,7 +154,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
154
154
fn mutate ( & mut self , cmt : & PlaceWithHirId < ' tcx > , _: HirId ) {
155
155
if cmt. place . projections . is_empty ( ) {
156
156
let map = & self . cx . tcx . hir ( ) ;
157
- if is_argument ( * map , cmt. hir_id ) {
157
+ if is_argument ( self . cx . tcx , cmt. hir_id ) {
158
158
// Skip closure arguments
159
159
let parent_id = map. parent_id ( cmt. hir_id ) ;
160
160
if let Some ( Node :: Expr ( ..) ) = map. find_parent ( parent_id) {
0 commit comments