@@ -211,8 +211,8 @@ impl ExternalCrate {
211
211
// Failing that, see if there's an attribute specifying where to find this
212
212
// external crate
213
213
let did = self . crate_num . as_def_id ( ) ;
214
- tcx. get_attrs ( did)
215
- . lists ( sym :: doc )
214
+ tcx. get_attrs ( did, sym :: doc )
215
+ . flat_map ( |attr| attr . meta_item_list ( ) . unwrap_or_default ( ) )
216
216
. filter ( |a| a. has_name ( sym:: html_root_url) )
217
217
. filter_map ( |a| a. value_str ( ) )
218
218
. map ( to_remote)
@@ -226,11 +226,13 @@ impl ExternalCrate {
226
226
227
227
let as_keyword = |res : Res < !> | {
228
228
if let Res :: Def ( DefKind :: Mod , def_id) = res {
229
- let attrs = tcx. get_attrs ( def_id) ;
230
229
let mut keyword = None ;
231
- for attr in attrs. lists ( sym:: doc) {
232
- if attr. has_name ( sym:: keyword) {
233
- if let Some ( v) = attr. value_str ( ) {
230
+ let meta_items = tcx
231
+ . get_attrs ( def_id, sym:: doc)
232
+ . flat_map ( |attr| attr. meta_item_list ( ) . unwrap_or_default ( ) ) ;
233
+ for meta in meta_items {
234
+ if meta. has_name ( sym:: keyword) {
235
+ if let Some ( v) = meta. value_str ( ) {
234
236
keyword = Some ( v) ;
235
237
break ;
236
238
}
@@ -288,11 +290,13 @@ impl ExternalCrate {
288
290
// rendering by delegating everything to a hash map.
289
291
let as_primitive = |res : Res < !> | {
290
292
if let Res :: Def ( DefKind :: Mod , def_id) = res {
291
- let attrs = tcx. get_attrs ( def_id) ;
292
293
let mut prim = None ;
293
- for attr in attrs. lists ( sym:: doc) {
294
- if let Some ( v) = attr. value_str ( ) {
295
- if attr. has_name ( sym:: primitive) {
294
+ let meta_items = tcx
295
+ . get_attrs ( def_id, sym:: doc)
296
+ . flat_map ( |attr| attr. meta_item_list ( ) . unwrap_or_default ( ) ) ;
297
+ for meta in meta_items {
298
+ if let Some ( v) = meta. value_str ( ) {
299
+ if meta. has_name ( sym:: primitive) {
296
300
prim = PrimitiveType :: from_symbol ( v) ;
297
301
if prim. is_some ( ) {
298
302
break ;
@@ -413,7 +417,10 @@ impl Item {
413
417
}
414
418
415
419
crate fn inner_docs ( & self , tcx : TyCtxt < ' _ > ) -> bool {
416
- self . item_id . as_def_id ( ) . map ( |did| tcx. get_attrs ( did) . inner_docs ( ) ) . unwrap_or ( false )
420
+ self . item_id
421
+ . as_def_id ( )
422
+ . map ( |did| tcx. get_attrs_unchecked ( did) . inner_docs ( ) )
423
+ . unwrap_or ( false )
417
424
}
418
425
419
426
crate fn span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
@@ -464,7 +471,7 @@ impl Item {
464
471
kind : ItemKind ,
465
472
cx : & mut DocContext < ' _ > ,
466
473
) -> Item {
467
- let ast_attrs = cx. tcx . get_attrs ( def_id) ;
474
+ let ast_attrs = cx. tcx . get_attrs_unchecked ( def_id) ;
468
475
469
476
Self :: from_def_id_and_attrs_and_parts (
470
477
def_id,
0 commit comments