File tree 1 file changed +11
-1
lines changed
compiler/rustc_passes/src
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -250,13 +250,23 @@ impl CheckAttrVisitor<'tcx> {
250
250
None
251
251
}
252
252
}
253
+ Target :: AssocConst => {
254
+ let parent_hir_id = self . tcx . hir ( ) . get_parent_item ( hir_id) ;
255
+ let containing_item = self . tcx . hir ( ) . expect_item ( parent_hir_id) ;
256
+ // We can't link to trait impl's consts.
257
+ let err = "associated constant in trait implementation block" ;
258
+ match containing_item. kind {
259
+ ItemKind :: Impl { of_trait : Some ( _) , .. } => Some ( err) ,
260
+ _ => None ,
261
+ }
262
+ }
253
263
_ => None ,
254
264
} {
255
265
self . tcx
256
266
. sess
257
267
. struct_span_err (
258
268
meta. span ( ) ,
259
- & format ! ( "`#[doc(alias = \" ...\" )]` isn't allowed on {}" , err, ) ,
269
+ & format ! ( "`#[doc(alias = \" ...\" )]` isn't allowed on {}" , err) ,
260
270
)
261
271
. emit ( ) ;
262
272
}
You can’t perform that action at this time.
0 commit comments