@@ -211,8 +211,8 @@ impl ExternalCrate {
211211 // Failing that, see if there's an attribute specifying where to find this
212212 // external crate
213213 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 ( ) )
216216 . filter ( |a| a. has_name ( sym:: html_root_url) )
217217 . filter_map ( |a| a. value_str ( ) )
218218 . map ( to_remote)
@@ -226,11 +226,13 @@ impl ExternalCrate {
226226
227227 let as_keyword = |res : Res < !> | {
228228 if let Res :: Def ( DefKind :: Mod , def_id) = res {
229- let attrs = tcx. get_attrs ( def_id) ;
230229 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 ( ) {
234236 keyword = Some ( v) ;
235237 break ;
236238 }
@@ -288,11 +290,13 @@ impl ExternalCrate {
288290 // rendering by delegating everything to a hash map.
289291 let as_primitive = |res : Res < !> | {
290292 if let Res :: Def ( DefKind :: Mod , def_id) = res {
291- let attrs = tcx. get_attrs ( def_id) ;
292293 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) {
296300 prim = PrimitiveType :: from_symbol ( v) ;
297301 if prim. is_some ( ) {
298302 break ;
@@ -413,7 +417,10 @@ impl Item {
413417 }
414418
415419 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 )
417424 }
418425
419426 crate fn span ( & self , tcx : TyCtxt < ' _ > ) -> Span {
@@ -464,7 +471,7 @@ impl Item {
464471 kind : ItemKind ,
465472 cx : & mut DocContext < ' _ > ,
466473 ) -> Item {
467- let ast_attrs = cx. tcx . get_attrs ( def_id) ;
474+ let ast_attrs = cx. tcx . get_attrs_unchecked ( def_id) ;
468475
469476 Self :: from_def_id_and_attrs_and_parts (
470477 def_id,
0 commit comments