Skip to content
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

Add missing docs for some util modules #1024

Merged
merged 10 commits into from
Nov 16, 2023

Conversation

qinsoon
Copy link
Member

@qinsoon qinsoon commented Nov 14, 2023

This PR is a step towards #309.

  • Add missing docs for some util modules.
  • Make util::metadata::side_metadata::helpers/helpers_32 not public.
  • Make util::reference_processor not public.
  • Allow adding docs for options defined by the options! macro.

@qinsoon qinsoon added the PR-testing Run binding tests for the pull request (deprecated: use PR-extended-testing instead) label Nov 15, 2023
@qinsoon qinsoon requested a review from wks November 15, 2023 08:19
Copy link
Collaborator

@wks wks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly OK. There are some aesthetic problems that can be fixed.

.github/scripts/ci-test.sh Outdated Show resolved Hide resolved
@@ -672,88 +700,85 @@ mod gc_trigger_tests {
// Currently we allow all the options to be set by env var for the sake of convenience.
// At some point, we may disallow this and all the options can only be set by command line.
options! {
// The plan to use.
#[doc = "The plan to use."]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the other PR, we should be able to use /// here, too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// may not work here. We can use #[doc] as we capture the pattern $(#[$outer:meta])* in the macro. We should be able to use the same pattern to capture things like #[cfg(feature = "a")]. This seems to be a common way to add attributes for items that are generated by a macro.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify, I was also using #[doc] to pass attributes (including docs) to macros in the previous PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it works. I changed it to

    /// The plan to use. Blah blah. (to see if `///` works)
    plan:                  PlanSelector         [env_var: true, command_line: true] [always_valid] = PlanSelector::GenImmix,

Type cargo doc and the generated HTML contains the part in ///.

FYI: https://stackoverflow.com/questions/33999341/generating-documentation-in-macros

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Interesting. It works. Rust did not allow /// in macro_rules and that was why we have // in the options! macro. Probably Rust started to support this at some point. This is great. I will make these changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. #[$outer:meta]* matches ///.

@qinsoon qinsoon removed the PR-testing Run binding tests for the pull request (deprecated: use PR-extended-testing instead) label Nov 15, 2023
Copy link
Collaborator

@wks wks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qinsoon qinsoon added this pull request to the merge queue Nov 16, 2023
Merged via the queue into mmtk:master with commit 9786ce8 Nov 16, 2023
18 of 19 checks passed
@qinsoon qinsoon deleted the missing-docs-metadata branch November 16, 2023 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants