@@ -7,11 +7,12 @@ use either::{Left, Right};
77use rustc_abi:: { self as abi, ExternAbi , FieldIdx , Integer , VariantIdx } ;
88use rustc_data_structures:: assert_matches;
99use rustc_errors:: inline_fluent;
10+ use rustc_hir:: attrs:: AttributeKind ;
1011use rustc_hir:: def_id:: DefId ;
12+ use rustc_hir:: find_attr;
1113use rustc_middle:: ty:: layout:: { IntegerExt , TyAndLayout } ;
1214use rustc_middle:: ty:: { self , AdtDef , Instance , Ty , VariantDef } ;
1315use rustc_middle:: { bug, mir, span_bug} ;
14- use rustc_span:: sym;
1516use rustc_target:: callconv:: { ArgAbi , FnAbi , PassMode } ;
1617use tracing:: field:: Empty ;
1718use tracing:: { info, instrument, trace} ;
@@ -142,7 +143,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
142143 // Check if the inner type is one of the NPO-guaranteed ones.
143144 // For that we first unpeel transparent *structs* (but not unions).
144145 let is_npo = |def : AdtDef < ' tcx > | {
145- self . tcx . has_attr ( def. did ( ) , sym:: rustc_nonnull_optimization_guaranteed)
146+ find_attr ! (
147+ self . tcx. get_all_attrs( def. did( ) ) ,
148+ AttributeKind :: RustcNonnullOptimizationGuaranteed
149+ )
146150 } ;
147151 let inner = self . unfold_transparent ( inner, /* may_unfold */ |def| {
148152 // Stop at NPO types so that we don't miss that attribute in the check below!
0 commit comments