Check attrs: Don't try to retrieve the name of list stems
This commit is contained in:
parent
1370611c0a
commit
b5069da9df
2 changed files with 12 additions and 2 deletions
|
@ -952,8 +952,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
tcx.dcx().emit_err(errors::DocAliasBadLocation { span, attr_str, location });
|
||||
return;
|
||||
}
|
||||
let item_name = self.tcx.hir_name(hir_id);
|
||||
if item_name == doc_alias {
|
||||
if self.tcx.hir_opt_name(hir_id) == Some(doc_alias) {
|
||||
tcx.dcx().emit_err(errors::DocAliasNotAnAlias { span, attr_str });
|
||||
return;
|
||||
}
|
||||
|
|
11
tests/ui/rustdoc/doc-alias-use-item-list-stem.rs
Normal file
11
tests/ui/rustdoc/doc-alias-use-item-list-stem.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// Check that we don't ICE on `#[doc(alias)]`es placed on use items with list stems.
|
||||
// issue: <https://github.com/rust-lang/rust/issues/138723>
|
||||
//@ check-pass
|
||||
|
||||
#[doc(alias = "empty")]
|
||||
pub use {};
|
||||
|
||||
#[doc(alias = "id")]
|
||||
pub use {std::convert::identity};
|
||||
|
||||
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue