diff options
| author | bors <bors@rust-lang.org> | 2020-09-05 09:35:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-09-05 09:35:17 +0000 |
| commit | 02fe30971ef397bcff3460a9aaf175e0810c2c90 (patch) | |
| tree | b6a3fc425642f8a041d6611779445efca45ab48b /compiler/rustc_passes/src | |
| parent | c3364780d2cfddfe329f62a3ec138fd4f9a60e27 (diff) | |
| parent | b61eab5d514af27009769373360b57dd55036a23 (diff) | |
| download | rust-02fe30971ef397bcff3460a9aaf175e0810c2c90.tar.gz rust-02fe30971ef397bcff3460a9aaf175e0810c2c90.zip | |
Auto merge of #75888 - GuillaumeGomez:trait-impl-assoc-const-doc-alias, r=ollie27
Add check for doc alias on assoc const in trait impl Fixes #73721. r? @ollie27
Diffstat (limited to 'compiler/rustc_passes/src')
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 832cde86d0b..392070839dc 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -250,13 +250,23 @@ impl CheckAttrVisitor<'tcx> { None } } + Target::AssocConst => { + let parent_hir_id = self.tcx.hir().get_parent_item(hir_id); + let containing_item = self.tcx.hir().expect_item(parent_hir_id); + // We can't link to trait impl's consts. + let err = "associated constant in trait implementation block"; + match containing_item.kind { + ItemKind::Impl { of_trait: Some(_), .. } => Some(err), + _ => None, + } + } _ => None, } { self.tcx .sess .struct_span_err( meta.span(), - &format!("`#[doc(alias = \"...\")]` isn't allowed on {}", err,), + &format!("`#[doc(alias = \"...\")]` isn't allowed on {}", err), ) .emit(); } |
