-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Error when #[doc(alias)] has same name as the item #80686
Error when #[doc(alias)] has same name as the item #80686
Conversation
|
||
#![crate_type = "lib"] | ||
|
||
#[doc(alias = "Foo")] //~ ERROR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I didn't realize this runs in rustc_attr itself. It shouldn't be changed here, but I wonder if it makes sense to run those checks in rustdoc instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's scheduled for later. :)
0ecf7da
to
9714ac0
Compare
Updated! |
@bors r+ |
📌 Commit 9714ac0 has been approved by |
☀️ Test successful - checks-actions |
…as-feature, r=jyn514 Remove useless doc_alias feature gate As `@jyn514` rightfully noted in rust-lang#80686 , this feature is no more. Therefore, cleanup time! r? `@jyn514`
@@ -358,6 +358,17 @@ impl CheckAttrVisitor<'tcx> { | |||
.emit(); | |||
return false; | |||
} | |||
let item_name = self.tcx.hir().name(hir_id); | |||
if item_name.to_string() == doc_alias { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it really need to_string
to compare between an Symbol and a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right, I opened #80750 to fix it.
…=lzutao Don't use to_string on Symbol in rustc_passes/check_attr.rs Improve code from rust-lang#80686. r? `@lzutao`
…=lzutao Don't use to_string on Symbol in rustc_passes/check_attr.rs Improve code from rust-lang#80686. r? ``@lzutao``
Something I came across when reviewing some doc alias PRs.
r? @jyn514