@@ -1092,9 +1092,10 @@ declare_lint_pass!(InvalidNoMangleItems => [NO_MANGLE_CONST_ITEMS, NO_MANGLE_GEN
10921092
10931093impl < ' tcx > LateLintPass < ' tcx > for InvalidNoMangleItems {
10941094 fn check_item ( & mut self , cx : & LateContext < ' _ > , it : & hir:: Item < ' _ > ) {
1095+ let attrs = cx. tcx . hir ( ) . attrs ( it. hir_id ( ) ) ;
10951096 match it. kind {
10961097 hir:: ItemKind :: Fn ( .., ref generics, _) => {
1097- if let Some ( no_mangle_attr) = cx. sess ( ) . find_by_name ( & it . attrs , sym:: no_mangle) {
1098+ if let Some ( no_mangle_attr) = cx. sess ( ) . find_by_name ( attrs, sym:: no_mangle) {
10981099 for param in generics. params {
10991100 match param. kind {
11001101 GenericParamKind :: Lifetime { .. } => { }
@@ -1120,7 +1121,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems {
11201121 }
11211122 }
11221123 hir:: ItemKind :: Const ( ..) => {
1123- if cx. sess ( ) . contains_name ( & it . attrs , sym:: no_mangle) {
1124+ if cx. sess ( ) . contains_name ( attrs, sym:: no_mangle) {
11241125 // Const items do not refer to a particular location in memory, and therefore
11251126 // don't have anything to attach a symbol to
11261127 cx. struct_span_lint ( NO_MANGLE_CONST_ITEMS , it. span , |lint| {
@@ -1800,7 +1801,8 @@ impl<'tcx> LateLintPass<'tcx> for UnnameableTestItems {
18001801 return ;
18011802 }
18021803
1803- if let Some ( attr) = cx. sess ( ) . find_by_name ( & it. attrs , sym:: rustc_test_marker) {
1804+ let attrs = cx. tcx . hir ( ) . attrs ( it. hir_id ( ) ) ;
1805+ if let Some ( attr) = cx. sess ( ) . find_by_name ( attrs, sym:: rustc_test_marker) {
18041806 cx. struct_span_lint ( UNNAMEABLE_TEST_ITEMS , attr. span , |lint| {
18051807 lint. build ( "cannot test inner items" ) . emit ( )
18061808 } ) ;
0 commit comments