Add documentation for the no_main and repr attributes - #163627
Conversation
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b207bc2 to
a09c4c7
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| /// [representation]: ../reference/type-layout.html#representations | ||
| /// [`Rust`]: ../reference/type-layout.html#the-rust-representation | ||
| /// [`C`]: ../reference/type-layout.html#the-c-representation | ||
| /// [primitive representations]: ../reference/type-layout.html#primitiv |
There was a problem hiding this comment.
| /// [primitive representations]: ../reference/type-layout.html#primitiv | |
| /// [primitive representations]: ../reference/type-layout.html#primitive-representations |
I assume this is the link you're aiming for?
| /// | ||
| /// |
There was a problem hiding this comment.
| /// | |
| /// |
Added lines appear superfluous.
| /// If you define it yourself, it must use the platform's C ABI and be exported under an | ||
| /// unmangled name with the [`no_mangle` attribute]: |
There was a problem hiding this comment.
Is this actually true? I agree it's almost certainly what you should do, but I don't know if it's a "must" (e.g., you could use a naked ABI).
There was a problem hiding this comment.
So, there's no strict requirement for this, I think I'll rewrite this part. Good point, thanks!
| /// If you define it yourself, it must use the platform's C ABI and be exported under an | ||
| /// unmangled name with the [`no_mangle` attribute]: | ||
| /// | ||
| /// ```rust,ignore (needs to be built as a binary crate) |
There was a problem hiding this comment.
| /// ```rust,ignore (needs to be built as a binary crate) | |
| /// ```standalone_crate |
I believe standalone_crate is sufficient to have this test compile?
|
Reminder, once the PR becomes ready for a review, use |
294f5d8 to
e9ff173
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
|
@rustbot ready |
|
@bors try jobs=dist-various-1,test-various,test-x86_64-gnu-aux,test-x86_64-msvc-1,test-aarch64-apple-1,test-aarch64-apple-2,test-x86_64-mingw-1,test-i686-msvc,test-armhf-gnu |
This comment has been minimized.
This comment has been minimized.
…=<try> Add documentation for the `no_main` and `repr` attributes try-job: dist-various-1 try-job: test-various try-job: test-x86_64-gnu-aux try-job: test-x86_64-msvc-1 try-job: test-aarch64-apple-1 try-job: test-aarch64-apple-2 try-job: test-x86_64-mingw-1 try-job: test-i686-msvc try-job: test-armhf-gnu
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
3d16c35 to
f679d53
Compare
|
@JonathanBrouwer Can you run them again, please? |
|
@bors try jobs=dist-various-1,test-various,test-x86_64-gnu-aux,test-x86_64-msvc-1,test-aarch64-apple-1,test-aarch64-apple-2,test-x86_64-mingw-1,test-i686-msvc,test-armhf-gnu |
…=<try> Add documentation for the `no_main` and `repr` attributes try-job: dist-various-1 try-job: test-various try-job: test-x86_64-gnu-aux try-job: test-x86_64-msvc-1 try-job: test-aarch64-apple-1 try-job: test-aarch64-apple-2 try-job: test-x86_64-mingw-1 try-job: test-i686-msvc try-job: test-armhf-gnu
This comment has been minimized.
This comment has been minimized.
| /// If you define an entry point symbol that is suitable for your target, it must also be exported | ||
| /// under an unmangled name using the [`no_mangle` attribute]: | ||
| /// | ||
| /// ```rust, ignore (no_main) |
There was a problem hiding this comment.
Would it work to make this no_run instead of ignore?
Then we can at least test that the example checks
There was a problem hiding this comment.
This is actually good idea
Fix test-tidy review changes review changes review changes fix llvm build ignore attribute documentation example fix tidy use no_run instead of ignore
f679d53 to
17f3f9c
Compare
|
@bors try jobs=test-various |
This comment has been minimized.
This comment has been minimized.
…=<try> Add documentation for the `no_main` and `repr` attributes try-job: test-various
|
@bors r=bushrat011899,JonathanBrouwer rollup |
…uwer Rollup of 6 pull requests Successful merges: - #162974 (FCW for `#[panic_handler]` on `unsafe fn`.) - #163627 (Add documentation for the `no_main` and `repr` attributes) - #163671 (Add `--frontend-threads` option to `./x perf`) - #163694 (c_str_alloc_error test: mention why this is mostly Miri-only) - #163711 (Stabilize `CStr::display`) - #163723 ([tiny] Remove useless `.into()` calls)
Rollup merge of #163627 - literally-user:docs-repr-no_main_attribute, r=bushrat011899,JonathanBrouwer Add documentation for the `no_main` and `repr` attributes Part of #157604. This PR documents `no_main` and `repr` attributes in `library/core/src/attribute_docs.rs` with some examples. Tested with: `./x doc`
View all comments
Part of #157604.
This PR documents
no_mainandreprattributes inlibrary/core/src/attribute_docs.rswith some examples.Tested with:
./x doc