-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Small improvements to internal documentation #120388
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged. You can start a rebase with the following commands:
The following commits are merge commits: |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@rustbot review |
This comment has been minimized.
This comment has been minimized.
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.
General comment: I notice that a lot of the new docstrings are longer than 100 chars long. Could you break them up to take more than one line when appropriate?
Everywhere you have "/// Checks if" change for "/// true
if".
Instead of "creates", use "create".
I noticed quite a few typos. I'm not one to complain about this in general, but please in the future take some care to do a cursory review of your own changes so that we can avoid the reviewers getting distracted by pointing them out instead of looking at the meat of the contribution.
/// Returns the size and sign of an inieger type. | ||
/// If the type is not an intieger, will panic with message "non integer discriminant". |
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.
/// Returns the size and sign of an inieger type. | |
/// If the type is not an intieger, will panic with message "non integer discriminant". | |
/// Returns the size and sign of an integer type or panic. |
@@ -2312,6 +2341,7 @@ impl<'tcx> Ty<'tcx> { | |||
*self.kind() == Str | |||
} | |||
|
|||
/// Checks if a type is a parameter type, with index `index`. |
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 could do with a better explanation. What is index? An index into what?
#[inline] | ||
pub fn is_phantom_data(self) -> bool { | ||
if let Adt(def, _) = self.kind() { def.is_phantom_data() } else { false } | ||
} | ||
|
||
/// Checks if this type is a boolean. |
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.
I appreciate you taking the time to document all these methods, but some like this one are somewhat self-explanatory and don't know how much value there is in documenting them. When you were working and navigating this codebase, was the lack of documentation on the is_*
and expect_
methods a hindrance?
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.
No, I have just added them since I was already documenting that file anyway.
I also thought that, in the future, #[warn(missing_docs)]
or even #[deny(missing_docs)]
could be added, ensuring documentation is always present. In such case, even small function would need documentation.
/// NOTE: this signature may not match exactly with the signature of a compiled function. | ||
/// Attributes like `#[track_caller]` may introduce additional arguments, which are not present here, but are represented in [`rustc_target::abi::call::FnAbi`]. | ||
/// If you are interested in the exact signature and the way arguments are aligned/passed, use [`rustc_target::abi::call::FnAbi`]. |
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.
These are the kind of documentation additions that are very useful.
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.
I agree with most of the comments. I believe mentioning the unusual panic message in int_size_and_signed is still worth keeping.
But if you still believe this info should not be there - I will remove it.
As for the typos - sorry, I will try to search for them better in the future. I have dyslexia and I just can't see some of those things. I am currently trying to get some spellcheck VS Code plugins to work, so this should not be a problem in the future.
@rustbot review |
☔ The latest upstream changes (presumably #120807) made this pull request unmergeable. Please resolve the merge conflicts. |
There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged. You can start a rebase with the following commands:
The following commits are merge commits: |
This comment has been minimized.
This comment has been minimized.
@FractalFir can you get the conflicts resolved when you have a chance? thanks |
There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged. You can start a rebase with the following commands:
The following commits are merge commits: |
This comment has been minimized.
This comment has been minimized.
Should be OK to merge now. @rustbot review |
@FractalFir I see perhaps a few tiny nits around still pending, is it correct? Example here and here. thanks @rustbot author |
I am not happy with this PR (some of what I wrote should be reworded). I think closing it and starting from scratch will be a better option. |
Hi!
While working on my project (rustc_codegen_clr) I have noticed the internal
rustc
documentation is lacking in some places. So, I have decided to add documentation for a few types/methods, and extend some of it by adding additional information.Those commits add documentation to
Instance
, some methods of Ty, and extend documentation ofFnSig
andFnAbi
to add info about some edge cases.