Skip to content

Add Documentation for the crate_type attribute - #164519

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
krokodeyu:document-crate-type-attribute
Nov 8, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
krokodeyu:document-crate-type-attribute

Conversation

@krokodeyu

Copy link
Copy Markdown
Contributor

Add documentation for the crate_type attribute

Briefly introduces how the attribute works, possible errors and necessary details when using the attribute.

Part of #157604

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 18, 2026
@rustbot

rustbot commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from JohnTitor, Mark-Simulacrum

@Mark-Simulacrum Mark-Simulacrum left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cc @rust-lang/lang-docs

View changes since this review

Comment thread library/core/src/attribute_docs.rs Outdated
/// ```
///
/// The specified crate type must be a known crate type (including `bin`, `lib`, `rlib`, `dylib`, `cdylib`,
/// `staticlib` and `proc-macro`), otherwise `rustc` reports an error (unless the `unknown_crate_types` lint

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think it makes sense to document that you can allow this lint. Essentially nobody should be doing that.

In general, I would keep this short and just link to the reference docs here.

The reference already contains relevant documentation here: https://doc.rust-lang.org/nightly/reference/linkage.html, which seems like we should link to instead of repeating the list of valid crate types here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the advice! I have changed the file accordingly. If anything else needs to be changed, please let me know.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 25, 2026
@rustbot

rustbot commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@krokodeyu
krokodeyu force-pushed the document-crate-type-attribute branch from 8c55e96 to de5aa1c Compare October 26, 2026 05:47
@krokodeyu

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 26, 2026
@traviscross traviscross added the T-lang-docs Relevant to the lang-docs team. label Oct 28, 2026
Comment thread library/core/src/attribute_docs.rs Outdated
/// ```
///
/// The specified crate type must be a known crate type (for the list of valid crate types, see [Linkage]),
/// otherwise `rustc` reports an error. Note that even when the `crate_type` attribute is ignored (for example

@Mark-Simulacrum Mark-Simulacrum Nov 1, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we need to document that unused attributes are still linted / examined. That's the case for ~all Rust code (e.g., we run type check against dead code).

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My bad. I have deleted this sentence, along with a few other places that might be redundant.
Please take another look when you have the time.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 1, 2026
@krokodeyu
krokodeyu force-pushed the document-crate-type-attribute branch from de5aa1c to 435ca70 Compare November 5, 2026 07:13
@krokodeyu

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 5, 2026
@Mark-Simulacrum

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 435ca70 has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 8, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 8, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #160777 (Document and correct assignment order for yield and inline-asm)
 - #165224 (Ensure all output is printed from lldb debugger tester)
 - #165629 (std: fix build on RTEMS after libc 0.2.191)
 - #163624 (String::retain: convert only the untouched UTF-8 tail)
 - #164519 (Add Documentation for the `crate_type` attribute)
 - #165249 (Fix unused attribute duplication for lint attributes)
 - #165643 (oneshot_multi_task_recv_then_send test: wait for test thread to finish)
@rust-bors
rust-bors Bot merged commit e16234c into rust-lang:main Nov 8, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 8, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 8, 2026
Rollup merge of #164519 - krokodeyu:document-crate-type-attribute, r=Mark-Simulacrum

Add Documentation for the `crate_type` attribute

Add documentation for the `crate_type` attribute

<!-- homu-ignore:start -->

Briefly introduces how the attribute works, possible errors and necessary details when using the attribute.

Part of #157604
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang-docs Relevant to the lang-docs team. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants