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 identifiers to attributes.md and its subchapters #1560

Merged
merged 18 commits into from
Nov 15, 2024

Conversation

chorman0773
Copy link
Contributor

This adds identifiers to the attributes.md file and its subchapters, being:

  • attributes/codegen.md
  • attributes/debugging.md
  • attributes/derive.md
  • attributes/diagnostics.md
  • attributes/limits.md
  • attributes/testing.md
  • attributes/type_system.md

@chorman0773 chorman0773 added S-waiting-on-review Status: The marked PR is awaiting review from a maintainer T-spec Team: spec labels Aug 6, 2024
@@ -15,29 +16,32 @@
>       [_DelimTokenTree_]\
>    | `=` [_Expression_]

r[attributes.general]
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and all elsewhere.

Suggested change
r[attributes.general]
r[attributes.intro]

(As an aside, I wonder if definition might fit these kinds of paragraphs better. We should probably define our common terms so that we understand when to use them appropriately.)

When applied to a function in an `extern` block the attribute must also be applied to any linked
implementations, otherwise undefined behavior results. When applied to a function which is made
available to an `extern` block, the declaration in the `extern` block must also have the attribute,
otherwise undefined behavior results.

### Behavior

r[attributes.codegen.track_caller.behaviour]
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and elsewhere

Suggested change
r[attributes.codegen.track_caller.behaviour]
r[attributes.codegen.track_caller.behavior]

@@ -397,8 +439,12 @@ And so on.

### Limitations

r[attributes.codegen.track_caller.limits]

r[attributes.codegent.track_caller.hint]
Copy link
Contributor

Choose a reason for hiding this comment

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

Please be careful about spelling.

Suggested change
r[attributes.codegent.track_caller.hint]
r[attributes.codegen.track_caller.hint]

Both attributes can be used on [functions]. When applied to a function in a
[trait], they apply only to that function when used as a default function for
a trait implementation and not to all trait implementations. The attributes
have no effect on a trait function without a body.

### The `inline` attribute

r[attributes.codgen.inline]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
r[attributes.codgen.inline]
r[attributes.codegen.inline]

The *`deprecated` attribute* marks an item as deprecated. `rustc` will issue
warnings on usage of `#[deprecated]` items. `rustdoc` will show item
deprecation, including the `since` version and `note`, if available.

r[attributes.diagnostics.deprectead.syntax]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
r[attributes.diagnostics.deprectead.syntax]
r[attributes.diagnostics.deprecated.syntax]

It uses the [_MetaListNameValueStr_] syntax to specify its inputs, and must be specified as a crate attribute.

### Using `debugger_visualizer` with Natvis

r[attributes.debugger.debugger_visualizer.natvis]

r[attributes.debugger.debugger_visualizer.natvis-general]
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason to use - and not . for nativis-general?

r[attributes.derive]


r[attributes.derived.general]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
r[attributes.derived.general]
r[attributes.derive.general]

@@ -390,6 +432,7 @@ impl Trait for i32 {
5i32.use_me();
```

r[attributes.diagnostics.must_use.impl-function]
Copy link
Contributor

Choose a reason for hiding this comment

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

To distinguish from other non-trait impl, maybe?

Suggested change
r[attributes.diagnostics.must_use.impl-function]
r[attributes.diagnostics.must_use.trait-impl-function]

@@ -424,36 +467,59 @@ When used on a function in a trait implementation, the attribute does nothing.

## The `diagnostic` tool attribute namespace

r[attributes.diagnostics.namespace]
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, I'm on the fence here, since the namespace is singular diagnostic. I realize this is in the "diagnostics" section, and being inconsistent with the rest of the section could be more trouble. I'm just a little concerned about seeing diagnostics.namespace could confuse a reader, since it is a subtle distinction. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking the section should be changed to diagnostic because I've been otherwise favouring the singular form except for lists and when the construct is plural in the language.

The following [attributes] affect compile-time limits.

## The `recursion_limit` attribute

r[attributes.limits.recursion_limits]
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and elsewhere.

Suggested change
r[attributes.limits.recursion_limits]
r[attributes.limits.recursion_limit]

@chorman0773
Copy link
Contributor Author

I need to modify the identifiers to be more consistent with the other chapters, and the guidelines I wrote.

@rustbot modify-labels +S-waiting-on-author -S-waiting-on-review

@chorman0773 chorman0773 added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-review Status: The marked PR is awaiting review from a maintainer labels Sep 12, 2024
@traviscross
Copy link
Contributor

@rustbot labels +S-waiting-on-author -S-waiting-on-review

The CI is failing on this one.

@chorman0773 chorman0773 force-pushed the spec-add-identifiers-attributes branch from e579b2a to d3ef277 Compare October 21, 2024 16:20
@chorman0773
Copy link
Contributor Author

@rustbot labels +S-waiting-on-review -S-waiting-on-author

@rustbot rustbot added S-waiting-on-review Status: The marked PR is awaiting review from a maintainer and removed S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. labels Oct 21, 2024
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks!

These are some misc rule name changes. Some of them are to give the
rules more specific names (indicating what they do, instead of using
generic terms).

The `allowed-positions` name is intended to be used for all attributes
to have a specific rule that defines where an attribute may be used. It
is not consistently used, yet. Also, some of the paragraphs mix "where
it goes" with "what it does" that should probably be teased apart so
that we can label those independently.

I expect us to do some more cleanup to bring some consistency to the
attribute rules since there are a lot of attributes, and they generally
have the same requirements of what needs to be specified.
This is keeping in line with using plurals throughout the rest of the
naming convention. This also differentiates it from the `diagnostic`
namespace. The `diagnostic` namespace remains singular, and is not
nested with the plural `diagnostics` just to avoid the repetition.
@ehuss ehuss force-pushed the spec-add-identifiers-attributes branch from 94aa44f to 4ef5f5d Compare November 15, 2024 21:42
@ehuss ehuss enabled auto-merge November 15, 2024 21:43
@ehuss ehuss added this pull request to the merge queue Nov 15, 2024
Merged via the queue into rust-lang:master with commit 41ccb0e Nov 15, 2024
5 checks passed
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 18, 2024
Update books

## rust-lang/edition-guide

2 commits in 2d482e203eb6d6e353814cf1415c5f94e590b9e0..915f9b319c2823f310430ecdecd86264a7870d7e
2024-11-06 07:23:07 UTC to 2024-11-05 09:03:41 UTC

- 2021: Update for raw lifetimes (rust-lang/edition-guide#330)
- CI: Switch to merge queue (rust-lang/edition-guide#333)

## rust-lang/nomicon

1 commits in 456b904f791751892b01282fd2757904993c4c26..eac89a3cbe6c4714e5029ae8b5a1c556fd4e8c42
2024-11-16 14:05:28 UTC to 2024-11-16 14:05:28 UTC

- Fix typo in what-unsafe-does (rust-lang/nomicon#469)

## rust-lang/reference

10 commits in da0f6dad767670da0e8cd5af8a7090db3272f626..41ccb0e6478305401dad92e8fd3d04a4304edb4c
2024-11-15 21:45:16 UTC to 2024-11-05 21:46:30 UTC

- Add identifiers to attributes.md and its subchapters (rust-lang/reference#1560)
- Fix 2 typos (rust-lang/reference#1674)
- Add examples to clarify the casting rules (rust-lang/reference#686)
- Explaining how to link mixed C/Rust binaries. (rust-lang/reference#838)
- Add Arm64EC to inline-assembly documentation (rust-lang/reference#1653)
- Add three more WebAssembly features to the list of accepted ones (rust-lang/reference#1638)
- Add s390x to inline-assembly documentation (rust-lang/reference#1643)
- trait object constraint correction (rust-lang/reference#1670)
- Update some "default" representation references (rust-lang/reference#1667)
- Update lifetimes for pre-expansion validation (rust-lang/reference#1668)

## rust-lang/rustc-dev-guide

12 commits in 6a5accd..b679e71
2024-11-18 08:18:15 UTC to 2024-11-05 07:22:17 UTC

- Mention `RUSTC_BOOTSTRAP` for misc testing (rust-lang/rustc-dev-guide#2136)
- Document how to acquire `cdb.exe` (rust-lang/rustc-dev-guide#2137)
- Document `max-llvm-major-version` directive (rust-lang/rustc-dev-guide#2129)
- Document `exact-llvm-major-version` directive (rust-lang/rustc-dev-guide#2135)
- Note Rustfmt for separate rust-analyzer directory (rust-lang/rustc-dev-guide#2134)
- still accurate (rust-lang/rustc-dev-guide#2133)
- typo (rust-lang/rustc-dev-guide#2132)
- add valid date-check marker (rust-lang/rustc-dev-guide#2131)
- Update parallel-rustc.md (rust-lang/rustc-dev-guide#1926)
- Rename `{ignore,only}-debug` -> `{ignore,needs}-{rustc,std}-debug-assertions` (rust-lang/rustc-dev-guide#2101)
- update const stability docs (rust-lang/rustc-dev-guide#2111)
- Ask folks to use the Oxford comma in diagnostics (rust-lang/rustc-dev-guide#2093)
fmease added a commit to fmease/rust that referenced this pull request Nov 19, 2024
Update books

## rust-lang/edition-guide

2 commits in 2d482e203eb6d6e353814cf1415c5f94e590b9e0..915f9b319c2823f310430ecdecd86264a7870d7e
2024-11-06 07:23:07 UTC to 2024-11-05 09:03:41 UTC

- 2021: Update for raw lifetimes (rust-lang/edition-guide#330)
- CI: Switch to merge queue (rust-lang/edition-guide#333)

## rust-lang/nomicon

1 commits in 456b904f791751892b01282fd2757904993c4c26..eac89a3cbe6c4714e5029ae8b5a1c556fd4e8c42
2024-11-16 14:05:28 UTC to 2024-11-16 14:05:28 UTC

- Fix typo in what-unsafe-does (rust-lang/nomicon#469)

## rust-lang/reference

10 commits in da0f6dad767670da0e8cd5af8a7090db3272f626..41ccb0e6478305401dad92e8fd3d04a4304edb4c
2024-11-15 21:45:16 UTC to 2024-11-05 21:46:30 UTC

- Add identifiers to attributes.md and its subchapters (rust-lang/reference#1560)
- Fix 2 typos (rust-lang/reference#1674)
- Add examples to clarify the casting rules (rust-lang/reference#686)
- Explaining how to link mixed C/Rust binaries. (rust-lang/reference#838)
- Add Arm64EC to inline-assembly documentation (rust-lang/reference#1653)
- Add three more WebAssembly features to the list of accepted ones (rust-lang/reference#1638)
- Add s390x to inline-assembly documentation (rust-lang/reference#1643)
- trait object constraint correction (rust-lang/reference#1670)
- Update some "default" representation references (rust-lang/reference#1667)
- Update lifetimes for pre-expansion validation (rust-lang/reference#1668)

## rust-lang/rustc-dev-guide

12 commits in 6a5accd..b679e71
2024-11-18 08:18:15 UTC to 2024-11-05 07:22:17 UTC

- Mention `RUSTC_BOOTSTRAP` for misc testing (rust-lang/rustc-dev-guide#2136)
- Document how to acquire `cdb.exe` (rust-lang/rustc-dev-guide#2137)
- Document `max-llvm-major-version` directive (rust-lang/rustc-dev-guide#2129)
- Document `exact-llvm-major-version` directive (rust-lang/rustc-dev-guide#2135)
- Note Rustfmt for separate rust-analyzer directory (rust-lang/rustc-dev-guide#2134)
- still accurate (rust-lang/rustc-dev-guide#2133)
- typo (rust-lang/rustc-dev-guide#2132)
- add valid date-check marker (rust-lang/rustc-dev-guide#2131)
- Update parallel-rustc.md (rust-lang/rustc-dev-guide#1926)
- Rename `{ignore,only}-debug` -> `{ignore,needs}-{rustc,std}-debug-assertions` (rust-lang/rustc-dev-guide#2101)
- update const stability docs (rust-lang/rustc-dev-guide#2111)
- Ask folks to use the Oxford comma in diagnostics (rust-lang/rustc-dev-guide#2093)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 19, 2024
Rollup merge of rust-lang#133181 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/edition-guide

2 commits in 2d482e203eb6d6e353814cf1415c5f94e590b9e0..915f9b319c2823f310430ecdecd86264a7870d7e
2024-11-06 07:23:07 UTC to 2024-11-05 09:03:41 UTC

- 2021: Update for raw lifetimes (rust-lang/edition-guide#330)
- CI: Switch to merge queue (rust-lang/edition-guide#333)

## rust-lang/nomicon

1 commits in 456b904f791751892b01282fd2757904993c4c26..eac89a3cbe6c4714e5029ae8b5a1c556fd4e8c42
2024-11-16 14:05:28 UTC to 2024-11-16 14:05:28 UTC

- Fix typo in what-unsafe-does (rust-lang/nomicon#469)

## rust-lang/reference

10 commits in da0f6dad767670da0e8cd5af8a7090db3272f626..41ccb0e6478305401dad92e8fd3d04a4304edb4c
2024-11-15 21:45:16 UTC to 2024-11-05 21:46:30 UTC

- Add identifiers to attributes.md and its subchapters (rust-lang/reference#1560)
- Fix 2 typos (rust-lang/reference#1674)
- Add examples to clarify the casting rules (rust-lang/reference#686)
- Explaining how to link mixed C/Rust binaries. (rust-lang/reference#838)
- Add Arm64EC to inline-assembly documentation (rust-lang/reference#1653)
- Add three more WebAssembly features to the list of accepted ones (rust-lang/reference#1638)
- Add s390x to inline-assembly documentation (rust-lang/reference#1643)
- trait object constraint correction (rust-lang/reference#1670)
- Update some "default" representation references (rust-lang/reference#1667)
- Update lifetimes for pre-expansion validation (rust-lang/reference#1668)

## rust-lang/rustc-dev-guide

12 commits in 6a5accd..b679e71
2024-11-18 08:18:15 UTC to 2024-11-05 07:22:17 UTC

- Mention `RUSTC_BOOTSTRAP` for misc testing (rust-lang/rustc-dev-guide#2136)
- Document how to acquire `cdb.exe` (rust-lang/rustc-dev-guide#2137)
- Document `max-llvm-major-version` directive (rust-lang/rustc-dev-guide#2129)
- Document `exact-llvm-major-version` directive (rust-lang/rustc-dev-guide#2135)
- Note Rustfmt for separate rust-analyzer directory (rust-lang/rustc-dev-guide#2134)
- still accurate (rust-lang/rustc-dev-guide#2133)
- typo (rust-lang/rustc-dev-guide#2132)
- add valid date-check marker (rust-lang/rustc-dev-guide#2131)
- Update parallel-rustc.md (rust-lang/rustc-dev-guide#1926)
- Rename `{ignore,only}-debug` -> `{ignore,needs}-{rustc,std}-debug-assertions` (rust-lang/rustc-dev-guide#2101)
- update const stability docs (rust-lang/rustc-dev-guide#2111)
- Ask folks to use the Oxford comma in diagnostics (rust-lang/rustc-dev-guide#2093)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: The marked PR is awaiting review from a maintainer T-spec Team: spec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants