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

Fix docstring comment for constants #2027

Merged
merged 1 commit into from Apr 11, 2021
Merged

Conversation

nicochatzi
Copy link
Contributor

As a first contribution, here's a small and possibly quite naive fix and test for #1995 :)

@highfive
Copy link

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

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

just one minor change to handle the edge cases. With that fixed it looks great, thanks!

@@ -618,6 +618,10 @@ impl CodeGenerator for Var {
return;
}

if let Some(comment) = item.comment(ctx) {
result.push(attributes::doc(comment));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There's some places here were we could still bail out without generating the constant. Instead, let's move the let mut attrs = vec![]; from below to here, and append to attrs.

With that fixup, this looks great, thanks!

Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@emilio emilio merged commit d0d0726 into rust-lang:master Apr 11, 2021
@nicochatzi
Copy link
Contributor Author

Cool, thanks @emilio!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants