-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unneeded ItemId::Primitive variant #106628
Conversation
Some changes occurred in src/librustdoc/clean/types.rs cc @camelid |
src/librustdoc/clean/inline.rs
Outdated
@@ -600,7 +600,7 @@ fn build_module_items( | |||
items.push(clean::Item { | |||
name: None, | |||
attrs: Box::new(clean::Attributes::default()), | |||
item_id: ItemId::Primitive(prim_ty, did.krate), | |||
item_id: ItemId::DefId(DefId { index: 0u32.into(), krate: did.krate }), |
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.
This change is very ugly though. I wondered if making item_id
an Option
would have been better but in the end I just left as is. If you have a better idea, I'm all for it. Otherwise I can add a comment.
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.
Maybe use index: 0xFFFF_FFFFu32.into()
to prevent potential confusion with the crate root?
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.
Wouldn't u32::MAX
be better?
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.
That would work too :)
07c387b
to
db5d20f
Compare
This comment has been minimized.
This comment has been minimized.
Ah so it's |
db5d20f
to
fc7d9de
Compare
I think it needs to be rust/compiler/rustc_macros/src/newtype.rs Lines 84 to 85 in 89e0576
|
Oh that's a shame. I think I'll go back to 0 since we don't use the |
fc7d9de
to
2c09286
Compare
Sentinel If the PrimitiveType field of #[derive(Debug, Clone, PartialEq, Eq, Hash, Copy)]
pub(crate) enum ItemId {
/// A "normal" item that uses a [`DefId`] for identification.
DefId(DefId),
/// Identifier that is used for auto traits.
Auto { trait_: DefId, for_: DefId },
/// Identifier that is used for blanket implementations.
Blanket { impl_id: DefId, for_: DefId },
/// Identifier for primitive types.
Primitive(CrateNum),
} |
At this point we could just keep |
The other option, like you already mentioned, would be to wrap the |
Which one do you prefer? |
I don't really like I guess I would prefer to keep |
Let's go with that then! I'll make the update tomorrow. |
Actually the solution was much simpler: we can use the item's |
2c09286
to
afa65e0
Compare
afa65e0
to
36c9b49
Compare
@bors r=notriddle rollup |
🌲 The tree is currently closed for pull requests below priority 999. This pull request will be tested once the tree is reopened. |
Rollup of 14 pull requests Successful merges: - rust-lang#105194 (Add comment to cleanup_kinds) - rust-lang#106521 (remove E0280) - rust-lang#106628 (Remove unneeded ItemId::Primitive variant) - rust-lang#106635 (std sync tests: better type name, clarifying comment) - rust-lang#106642 (Add test for rust-lang#106062) - rust-lang#106645 ([RFC 2397] Initial implementation) - rust-lang#106653 (Fix help docs for -Zallow-features) - rust-lang#106657 (Remove myself from rust-lang/rust reviewers) - rust-lang#106662 (specialize impl of `ToString` on `bool`) - rust-lang#106669 (create helper function for `rustc_lint_defs::Level` and remove it's duplicated code) - rust-lang#106671 (Change flags with a fixed default value from Option<bool> to bool) - rust-lang#106689 (Fix invalid files array re-creation in rustdoc-gui tester) - rust-lang#106690 (Fix scrolling for item declaration block) - rust-lang#106698 (Add compiler-errors to some trait system notification groups) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
As I mentioned here, I wondered if
ItemId::Primitive
was actually used for anything. Apparently, it seems so because removing it led to no changes as far as I and tests could see.r? @notriddle