Skip to content

General attribute docs improvements #352

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

Merged
merged 9 commits into from
Jun 30, 2018
Merged

Conversation

Havvy
Copy link
Contributor

@Havvy Havvy commented Jun 4, 2018

Each commit does its own small thing.

This builds on top of #350, so merge that before taking a look at this.

@Havvy Havvy requested a review from matthewjasper June 4, 2018 09:59
Copy link
Contributor

@matthewjasper matthewjasper 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. A few things I noticed going through this.

(C#). An attribute is a general, free-form metadatum that is interpreted
according to name, convention, and language and compiler version. Attributes
may appear as any of:
An _attribute_ is a
Copy link
Contributor

Choose a reason for hiding this comment

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

Short line

* [Statements] accept outer attributes.
* [Enum] variants and [struct] and [union] fields accept outer attributes.
* [Match expression arms][match expressions] accept outer attributes.
* [Generic lifetime or type parameter][generics] accept outer attributes.
Copy link
Contributor

Choose a reason for hiding this comment

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

(unsafe) block statements accept inner attributes

## Attributes in Implementations

Implementations may contain inner [attributes] inside the brackets that contain
the associated items. They must come before the associated items.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could there be a sentence on what attributes are allowed on impls?

@Havvy
Copy link
Contributor Author

Havvy commented Jun 10, 2018

Addressed comments. Also added which attributes are allowed on block expressions and statements. And apparently, as per the example I included on the block expressions page, block expressions also allow outer attributes and the only place you'd be able to tell that isn't overlapping with statements taking attributes is the return expression of a block expression. Go figure.

I'll add which attributes are allowed on functions / modules / the main module/ other items / variants and fields later.

@Havvy Havvy force-pushed the attr branch 2 times, most recently from 56473c4 to 4b2dc6e Compare June 12, 2018 09:07
@Havvy
Copy link
Contributor Author

Havvy commented Jun 22, 2018

Rebased against master due to merge conflict.

@Havvy
Copy link
Contributor Author

Havvy commented Jun 30, 2018

Rebased again for another merge conflict.

@matthewjasper matthewjasper merged commit ff14759 into rust-lang:master Jun 30, 2018
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.

2 participants