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

Document inert vs active attributes #1110

Merged
merged 12 commits into from
Jun 23, 2024
Merged

Conversation

Aaron1011
Copy link
Member

This PR adds a subsection to the 'Syntax and AST' section describing
inert vs active attributes.

For consistency, I've also updated the '#[test] implementation' page to
stop referring to `#[test]' as a 'built in' attribute, since that has a
specific meaning defined on this page.

This PR adds a subsection to the 'Syntax and AST' section describing
inert vs active attributes.

For consistency, I've also updated the '#[test] implementation' page to
stop referring to `#[test]' as a 'built in' attribute, since that has a
specific meaning defined on this page.
@camelid camelid added the waiting-on-review This PR is waiting for a reviewer to verify its content label Apr 16, 2021
Copy link
Member

@camelid camelid left a comment

Choose a reason for hiding this comment

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

This looks really good, thanks for writing it up! I left a few typographical nits. I can't comment much on the content because I'm learning about attributes by reading this PR ;)

src/attributes.md Outdated Show resolved Hide resolved
src/attributes.md Outdated Show resolved Hide resolved
These definitions exist to allow the macros to participate in typical path-based resolution - they
can be imported, re-exported, and renamed just like any other item definition. However, the body of
the definition is empty. Instead, the macro is annotated with the `#[rustc_builtin_macro]`
attribute, which tells the compiler to run a corresponding function in `rustc_builtin_macros`.
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a link to the crate's API docs? That way it is easy for people to see more about it, and it will make our CI fail if the name ever changes.

@@ -0,0 +1,49 @@
# Attributes

Attributes come in two types - 'builtin'/'inert' attributes, and 'non-builtin'/'active' attributes:
Copy link
Member

Choose a reason for hiding this comment

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

I feel like the single quotes here and in the headings make the text a bit harder to read; are you okay with removing them?


They are 'inert', meaning they are left as-is by the macro expansion code.

This one seems fine to keep, but I feel that the others make it harder to read.

src/attributes.md Outdated Show resolved Hide resolved
src/attributes.md Outdated Show resolved Hide resolved
@petrochenkov
Copy link
Contributor

cfg and cfg_attr are probably worth mentioning as third category because they are both built-in (in the sense that they don't go through name resolution) and active (expanded directly by the compiler).

@camelid camelid added waiting-on-author This PR is waiting for additional action by the OP and removed waiting-on-review This PR is waiting for a reviewer to verify its content labels Apr 19, 2021
@rylev
Copy link
Member

rylev commented Jul 4, 2021

@Aaron1011 will you be able to work on this to get it over the finish line? I'd love to see it merged.

src/attributes.md Outdated Show resolved Hide resolved
src/attributes.md Outdated Show resolved Hide resolved
@JohnTitor
Copy link
Member

@Aaron1011 I'm not sure if this is still up-to-date, could you check? It'd also be great if you could address review comments.

@spastorino
Copy link
Member

I'm not sure what's the current status of this PR, but I guess it may be better to merge it and continue working on it on master.
Opinions?.

@spastorino
Copy link
Member

I'm not sure what's the current status of this PR, but I guess it may be better to merge it and continue working on it on master. Opinions?.

Any comment about this ☝️ ?

Noratrieb and others added 8 commits June 23, 2024 16:04
Co-authored-by: Noah Lev <camelidcamel@gmail.com>
Co-authored-by: Noah Lev <camelidcamel@gmail.com>
Co-authored-by: Noah Lev <camelidcamel@gmail.com>
Co-authored-by: Noah Lev <camelidcamel@gmail.com>
Co-authored-by: pierwill <19642016+pierwill@users.noreply.github.com>
Co-authored-by: pierwill <19642016+pierwill@users.noreply.github.com>
Co-authored-by: pierwill <19642016+pierwill@users.noreply.github.com>
src/test-implementation.md Show resolved Hide resolved
src/test-implementation.md Show resolved Hide resolved
src/test-implementation.md Outdated Show resolved Hide resolved
src/test-implementation.md Outdated Show resolved Hide resolved
@Noratrieb Noratrieb merged commit 88cc553 into rust-lang:master Jun 23, 2024
1 check passed
@Noratrieb
Copy link
Member

don't let typographical nits hold you back!

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 2, 2024
Update books

## rust-lang/book

2 commits in 45c1a6d69edfd1fc91fb7504cb73958dbd09441e..f1e49bf7a8ea6c31ce016a52b8a4f6e1ffcfbc64
2024-06-25 21:12:15 UTC to 2024-06-20 16:10:32 UTC

- Update ch10-00-generics.md (rust-lang/book#3963)
- infra: ignore Nova configuration directory (rust-lang/book#3962)

## rust-lang/edition-guide

3 commits in cb58c430b4e8054c2cb81d2d4434092c482a93d8..941db8b3df45fd46cd87b50a5c86714b91dcde9c
2024-06-30 19:26:27 UTC to 2024-06-20 18:43:18 UTC

- Add a section for the never type change in e2024 (rust-lang/edition-guide#310)
- Add 2024 unsafe attributes. (rust-lang/edition-guide#308)
- Add 2024 unsafe extern blocks. (rust-lang/edition-guide#309)

## rust-lang/reference

7 commits in 0b805c65804019b0ac8f2fe3117afad82a6069b8..1ae3deebc3ac16e276b6558e01420f8e605def08
2024-06-29 16:59:51 UTC to 2024-06-18 22:16:37 UTC

- Provide an example of `target_family` being multi-valued (rust-lang/reference#1518)
- Remove stubs needed for the link checker. (rust-lang/reference#1517)
- Document new `#[expect]` attribute and `reasons` parameter (RFC 2383) (rust-lang/reference#1237)
- Update recognized tool attributes (rust-lang/reference#1498)
- Add example of 1-ary tuple type (rust-lang/reference#1514)
- underscore-expr: add more examples (rust-lang/reference#1478)
- Remove outdated info about impl Trait in parameters and generics in the same function (rust-lang/reference#1495)

## rust-lang/rust-by-example

4 commits in b1d97bd6113aba732b2091ce093c76f2d05bb8a0..658c6c27cb975b92227936024816986c2d3716fb
2024-06-30 11:58:29 UTC to 2024-06-30 11:52:38 UTC

- Remove awkward match in if_let (rust-lang/rust-by-example#1725)
- Edit grammatical mistake (rust-lang/rust-by-example#1830)
- Update paragraph in src/fn/diverging.md (rust-lang/rust-by-example#1853)
- Fix minor typo in from_into.md (rust-lang/rust-by-example#1854)

## rust-lang/rustc-dev-guide

11 commits in aec82168dd3121289a194b381f56076fc789a4d2..d6e3a32a557db5902e714604def8015d6bb7e0f7
2024-07-01 10:51:26 UTC to 2024-06-18 18:24:17 UTC

- Update new target check-cfg instructions (rust-lang/rustc-dev-guide#2006)
- Add Rust for Linux integration tests documentation (rust-lang/rustc-dev-guide#2004)
- Add docs for building Fuchsia locally and in CI (rust-lang/rustc-dev-guide#1989)
- provide `libstdc++.so.6` through `LD_LIBRARY_PATH` (rust-lang/rustc-dev-guide#1999)
- Document how to run `run-make` tests on Windows (rust-lang/rustc-dev-guide#2002)
- Document `needs-symlink` directive (rust-lang/rustc-dev-guide#2001)
- Rename `wasm32-wasi` to `wasm32-wasip1` (rust-lang/rustc-dev-guide#1678)
- Document inert vs active attributes (rust-lang/rustc-dev-guide#1110)
- Document hard-resetting submodules (rust-lang/rustc-dev-guide#2000)
- Fix note about compiletest header `rustfix-only-machine-applicable` (rust-lang/rustc-dev-guide#1998)
- Mention `RUSTC_ICE=0` to suppress ICE file (rust-lang/rustc-dev-guide#1997)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jul 2, 2024
Rollup merge of rust-lang#127212 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/book

2 commits in 45c1a6d69edfd1fc91fb7504cb73958dbd09441e..f1e49bf7a8ea6c31ce016a52b8a4f6e1ffcfbc64
2024-06-25 21:12:15 UTC to 2024-06-20 16:10:32 UTC

- Update ch10-00-generics.md (rust-lang/book#3963)
- infra: ignore Nova configuration directory (rust-lang/book#3962)

## rust-lang/edition-guide

3 commits in cb58c430b4e8054c2cb81d2d4434092c482a93d8..941db8b3df45fd46cd87b50a5c86714b91dcde9c
2024-06-30 19:26:27 UTC to 2024-06-20 18:43:18 UTC

- Add a section for the never type change in e2024 (rust-lang/edition-guide#310)
- Add 2024 unsafe attributes. (rust-lang/edition-guide#308)
- Add 2024 unsafe extern blocks. (rust-lang/edition-guide#309)

## rust-lang/reference

7 commits in 0b805c65804019b0ac8f2fe3117afad82a6069b8..1ae3deebc3ac16e276b6558e01420f8e605def08
2024-06-29 16:59:51 UTC to 2024-06-18 22:16:37 UTC

- Provide an example of `target_family` being multi-valued (rust-lang/reference#1518)
- Remove stubs needed for the link checker. (rust-lang/reference#1517)
- Document new `#[expect]` attribute and `reasons` parameter (RFC 2383) (rust-lang/reference#1237)
- Update recognized tool attributes (rust-lang/reference#1498)
- Add example of 1-ary tuple type (rust-lang/reference#1514)
- underscore-expr: add more examples (rust-lang/reference#1478)
- Remove outdated info about impl Trait in parameters and generics in the same function (rust-lang/reference#1495)

## rust-lang/rust-by-example

4 commits in b1d97bd6113aba732b2091ce093c76f2d05bb8a0..658c6c27cb975b92227936024816986c2d3716fb
2024-06-30 11:58:29 UTC to 2024-06-30 11:52:38 UTC

- Remove awkward match in if_let (rust-lang/rust-by-example#1725)
- Edit grammatical mistake (rust-lang/rust-by-example#1830)
- Update paragraph in src/fn/diverging.md (rust-lang/rust-by-example#1853)
- Fix minor typo in from_into.md (rust-lang/rust-by-example#1854)

## rust-lang/rustc-dev-guide

11 commits in aec82168dd3121289a194b381f56076fc789a4d2..d6e3a32a557db5902e714604def8015d6bb7e0f7
2024-07-01 10:51:26 UTC to 2024-06-18 18:24:17 UTC

- Update new target check-cfg instructions (rust-lang/rustc-dev-guide#2006)
- Add Rust for Linux integration tests documentation (rust-lang/rustc-dev-guide#2004)
- Add docs for building Fuchsia locally and in CI (rust-lang/rustc-dev-guide#1989)
- provide `libstdc++.so.6` through `LD_LIBRARY_PATH` (rust-lang/rustc-dev-guide#1999)
- Document how to run `run-make` tests on Windows (rust-lang/rustc-dev-guide#2002)
- Document `needs-symlink` directive (rust-lang/rustc-dev-guide#2001)
- Rename `wasm32-wasi` to `wasm32-wasip1` (rust-lang/rustc-dev-guide#1678)
- Document inert vs active attributes (rust-lang/rustc-dev-guide#1110)
- Document hard-resetting submodules (rust-lang/rustc-dev-guide#2000)
- Fix note about compiletest header `rustfix-only-machine-applicable` (rust-lang/rustc-dev-guide#1998)
- Mention `RUSTC_ICE=0` to suppress ICE file (rust-lang/rustc-dev-guide#1997)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jul 4, 2024
Update books

## rust-lang/book

2 commits in 45c1a6d69edfd1fc91fb7504cb73958dbd09441e..f1e49bf7a8ea6c31ce016a52b8a4f6e1ffcfbc64
2024-06-25 21:12:15 UTC to 2024-06-20 16:10:32 UTC

- Update ch10-00-generics.md (rust-lang/book#3963)
- infra: ignore Nova configuration directory (rust-lang/book#3962)

## rust-lang/edition-guide

3 commits in cb58c430b4e8054c2cb81d2d4434092c482a93d8..941db8b3df45fd46cd87b50a5c86714b91dcde9c
2024-06-30 19:26:27 UTC to 2024-06-20 18:43:18 UTC

- Add a section for the never type change in e2024 (rust-lang/edition-guide#310)
- Add 2024 unsafe attributes. (rust-lang/edition-guide#308)
- Add 2024 unsafe extern blocks. (rust-lang/edition-guide#309)

## rust-lang/reference

7 commits in 0b805c65804019b0ac8f2fe3117afad82a6069b8..1ae3deebc3ac16e276b6558e01420f8e605def08
2024-06-29 16:59:51 UTC to 2024-06-18 22:16:37 UTC

- Provide an example of `target_family` being multi-valued (rust-lang/reference#1518)
- Remove stubs needed for the link checker. (rust-lang/reference#1517)
- Document new `#[expect]` attribute and `reasons` parameter (RFC 2383) (rust-lang/reference#1237)
- Update recognized tool attributes (rust-lang/reference#1498)
- Add example of 1-ary tuple type (rust-lang/reference#1514)
- underscore-expr: add more examples (rust-lang/reference#1478)
- Remove outdated info about impl Trait in parameters and generics in the same function (rust-lang/reference#1495)

## rust-lang/rust-by-example

4 commits in b1d97bd6113aba732b2091ce093c76f2d05bb8a0..658c6c27cb975b92227936024816986c2d3716fb
2024-06-30 11:58:29 UTC to 2024-06-30 11:52:38 UTC

- Remove awkward match in if_let (rust-lang/rust-by-example#1725)
- Edit grammatical mistake (rust-lang/rust-by-example#1830)
- Update paragraph in src/fn/diverging.md (rust-lang/rust-by-example#1853)
- Fix minor typo in from_into.md (rust-lang/rust-by-example#1854)

## rust-lang/rustc-dev-guide

11 commits in aec82168dd3121289a194b381f56076fc789a4d2..d6e3a32a557db5902e714604def8015d6bb7e0f7
2024-07-01 10:51:26 UTC to 2024-06-18 18:24:17 UTC

- Update new target check-cfg instructions (rust-lang/rustc-dev-guide#2006)
- Add Rust for Linux integration tests documentation (rust-lang/rustc-dev-guide#2004)
- Add docs for building Fuchsia locally and in CI (rust-lang/rustc-dev-guide#1989)
- provide `libstdc++.so.6` through `LD_LIBRARY_PATH` (rust-lang/rustc-dev-guide#1999)
- Document how to run `run-make` tests on Windows (rust-lang/rustc-dev-guide#2002)
- Document `needs-symlink` directive (rust-lang/rustc-dev-guide#2001)
- Rename `wasm32-wasi` to `wasm32-wasip1` (rust-lang/rustc-dev-guide#1678)
- Document inert vs active attributes (rust-lang/rustc-dev-guide#1110)
- Document hard-resetting submodules (rust-lang/rustc-dev-guide#2000)
- Fix note about compiletest header `rustfix-only-machine-applicable` (rust-lang/rustc-dev-guide#1998)
- Mention `RUSTC_ICE=0` to suppress ICE file (rust-lang/rustc-dev-guide#1997)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-author This PR is waiting for additional action by the OP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants