@@ -64,9 +64,9 @@ use itertools::izip;
6464use rustc_abi:: { FieldIdx , VariantIdx } ;
6565use rustc_data_structures:: fx:: FxHashSet ;
6666use rustc_errors:: pluralize;
67- use rustc_hir as hir ;
67+ use rustc_hir:: attrs :: AttributeKind ;
6868use rustc_hir:: lang_items:: LangItem ;
69- use rustc_hir:: { CoroutineDesugaring , CoroutineKind } ;
69+ use rustc_hir:: { self as hir , CoroutineDesugaring , CoroutineKind , find_attr } ;
7070use rustc_index:: bit_set:: { BitMatrix , DenseBitSet , GrowableBitSet } ;
7171use rustc_index:: { Idx , IndexVec , indexvec} ;
7272use rustc_middle:: mir:: visit:: { MutVisitor , MutatingUseContext , PlaceContext , Visitor } ;
@@ -85,7 +85,6 @@ use rustc_mir_dataflow::{
8585} ;
8686use rustc_span:: def_id:: { DefId , LocalDefId } ;
8787use rustc_span:: source_map:: dummy_spanned;
88- use rustc_span:: symbol:: sym;
8988use rustc_span:: { DUMMY_SP , Span } ;
9089use rustc_trait_selection:: error_reporting:: InferCtxtErrorExt ;
9190use rustc_trait_selection:: infer:: TyCtxtInferExt as _;
@@ -1989,11 +1988,11 @@ fn check_must_not_suspend_def(
19891988 hir_id : hir:: HirId ,
19901989 data : SuspendCheckData < ' _ > ,
19911990) -> bool {
1992- if let Some ( attr ) = tcx . get_attr ( def_id , sym :: must_not_suspend ) {
1993- let reason = attr . value_str ( ) . map ( |s| errors :: MustNotSuspendReason {
1994- span : data . source_span ,
1995- reason : s . as_str ( ) . to_string ( ) ,
1996- } ) ;
1991+ if let Some ( reason_str ) =
1992+ find_attr ! ( tcx . get_all_attrs ( def_id ) , AttributeKind :: MustNotSupend { reason } => reason )
1993+ {
1994+ let reason =
1995+ reason_str . map ( |s| errors :: MustNotSuspendReason { span : data . source_span , reason : s } ) ;
19971996 tcx. emit_node_span_lint (
19981997 rustc_session:: lint:: builtin:: MUST_NOT_SUSPEND ,
19991998 hir_id,
0 commit comments