File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
compiler/rustc_passes/src Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -250,13 +250,23 @@ impl CheckAttrVisitor<'tcx> {
250250 None
251251 }
252252 }
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+ }
253263 _ => None ,
254264 } {
255265 self . tcx
256266 . sess
257267 . struct_span_err (
258268 meta. span ( ) ,
259- & format ! ( "`#[doc(alias = \" ...\" )]` isn't allowed on {}" , err, ) ,
269+ & format ! ( "`#[doc(alias = \" ...\" )]` isn't allowed on {}" , err) ,
260270 )
261271 . emit ( ) ;
262272 }
You can’t perform that action at this time.
0 commit comments