about summary refs log tree commit diff
path: root/src/doc
AgeCommit message (Collapse)AuthorLines
2021-05-23Add support for BPF inline assemblyAlessandro Decina-0/+6
2021-05-23Add BPF targetAlessandro Decina-0/+2
This change adds the bpfel-unknown-none and bpfeb-unknown-none targets which can be used to generate little endian and big endian BPF
2021-05-18Rollup merge of #83366 - jyn514:stabilize-key-value-attrs, r=petrochenkovJack Huey-0/+12
Stabilize extended_key_value_attributes Closes https://github.com/rust-lang/rust/issues/44732. Closes https://github.com/rust-lang/rust/issues/78835. Closes https://github.com/rust-lang/rust/issues/82768 (by making it irrelevant). # Stabilization report ## Summary This stabilizes using macro expansion in key-value attributes, like so: ```rust #[doc = include_str!("my_doc.md")] struct S; #[path = concat!(env!("OUT_DIR"), "/generated.rs")] mod m; ``` See Petrochenkov's excellent blog post [on internals](https://internals.rust-lang.org/t/macro-expansion-points-in-attributes/11455) for alternatives that were considered and rejected ("why accept no more and no less?") This has been available on nightly since 1.50 with no major issues. ## Notes ### Accepted syntax The parser accepts arbitrary Rust expressions in this position, but any expression other than a macro invocation will ultimately lead to an error because it is not expected by the built-in expression forms (e.g., `#[doc]`). Note that decorators and the like may be able to observe other expression forms. ### Expansion ordering Expansion of macro expressions in "inert" attributes occurs after decorators have executed, analogously to macro expressions appearing in the function body or other parts of decorator input. There is currently no way for decorators to accept macros in key-value position if macro expansion must be performed before the decorator executes (if the macro can simply be copied into the output for later expansion, that can work). ## Test cases - https://github.com/rust-lang/rust/blob/master/src/test/ui/attributes/key-value-expansion-on-mac.rs - https://github.com/rust-lang/rust/blob/master/src/test/rustdoc/external-doc.rs The feature has also been dogfooded extensively in the compiler and standard library: - https://github.com/rust-lang/rust/pull/83329 - https://github.com/rust-lang/rust/pull/83230 - https://github.com/rust-lang/rust/pull/82641 - https://github.com/rust-lang/rust/pull/80534 ## Implementation history - Initial proposal: https://github.com/rust-lang/rust/issues/55414#issuecomment-554005412 - Experiment to see how much code it would break: https://github.com/rust-lang/rust/pull/67121 - Preliminary work to restrict expansion that would conflict with this feature: https://github.com/rust-lang/rust/pull/77271 - Initial implementation: https://github.com/rust-lang/rust/pull/78837 - Fix for an ICE: https://github.com/rust-lang/rust/pull/80563 ## Unresolved Questions ~~https://github.com/rust-lang/rust/pull/83366#issuecomment-805180738 listed some concerns, but they have been resolved as of this final report.~~ ## Additional Information There are two workarounds that have a similar effect for `#[doc]` attributes on nightly. One is to emulate this behavior by using a limited version of this feature that was stabilized for historical reasons: ```rust macro_rules! forward_inner_docs { ($e:expr => $i:item) => { #[doc = $e] $i }; } forward_inner_docs!(include_str!("lib.rs") => struct S {}); ``` This also works for other attributes (like `#[path = concat!(...)]`). The other is to use `doc(include)`: ```rust #![feature(external_doc)] #[doc(include = "lib.rs")] struct S {} ``` The first works, but is non-trivial for people to discover, and difficult to read and maintain. The second is a strange special-case for a particular use of the macro. This generalizes it to work for any use case, not just including files. I plan to remove `doc(include)` when this is stabilized (https://github.com/rust-lang/rust/pull/82539). The `forward_inner_docs` workaround will still compile without warnings, but I expect it to be used less once it's no longer necessary.
2021-05-18Stabilize extended_key_value_attributesJoshua Nelson-0/+12
# Stabilization report ## Summary This stabilizes using macro expansion in key-value attributes, like so: ```rust #[doc = include_str!("my_doc.md")] struct S; #[path = concat!(env!("OUT_DIR"), "/generated.rs")] mod m; ``` See the changes to the reference for details on what macros are allowed; see Petrochenkov's excellent blog post [on internals](https://internals.rust-lang.org/t/macro-expansion-points-in-attributes/11455) for alternatives that were considered and rejected ("why accept no more and no less?") This has been available on nightly since 1.50 with no major issues. ## Notes ### Accepted syntax The parser accepts arbitrary Rust expressions in this position, but any expression other than a macro invocation will ultimately lead to an error because it is not expected by the built-in expression forms (e.g., `#[doc]`). Note that decorators and the like may be able to observe other expression forms. ### Expansion ordering Expansion of macro expressions in "inert" attributes occurs after decorators have executed, analogously to macro expressions appearing in the function body or other parts of decorator input. There is currently no way for decorators to accept macros in key-value position if macro expansion must be performed before the decorator executes (if the macro can simply be copied into the output for later expansion, that can work). ## Test cases - https://github.com/rust-lang/rust/blob/master/src/test/ui/attributes/key-value-expansion-on-mac.rs - https://github.com/rust-lang/rust/blob/master/src/test/rustdoc/external-doc.rs The feature has also been dogfooded extensively in the compiler and standard library: - https://github.com/rust-lang/rust/pull/83329 - https://github.com/rust-lang/rust/pull/83230 - https://github.com/rust-lang/rust/pull/82641 - https://github.com/rust-lang/rust/pull/80534 ## Implementation history - Initial proposal: https://github.com/rust-lang/rust/issues/55414#issuecomment-554005412 - Experiment to see how much code it would break: https://github.com/rust-lang/rust/pull/67121 - Preliminary work to restrict expansion that would conflict with this feature: https://github.com/rust-lang/rust/pull/77271 - Initial implementation: https://github.com/rust-lang/rust/pull/78837 - Fix for an ICE: https://github.com/rust-lang/rust/pull/80563 ## Unresolved Questions ~~https://github.com/rust-lang/rust/pull/83366#issuecomment-805180738 listed some concerns, but they have been resolved as of this final report.~~ ## Additional Information There are two workarounds that have a similar effect for `#[doc]` attributes on nightly. One is to emulate this behavior by using a limited version of this feature that was stabilized for historical reasons: ```rust macro_rules! forward_inner_docs { ($e:expr => $i:item) => { #[doc = $e] $i }; } forward_inner_docs!(include_str!("lib.rs") => struct S {}); ``` This also works for other attributes (like `#[path = concat!(...)]`). The other is to use `doc(include)`: ```rust #![feature(external_doc)] #[doc(include = "lib.rs")] struct S {} ``` The first works, but is non-trivial for people to discover, and difficult to read and maintain. The second is a strange special-case for a particular use of the macro. This generalizes it to work for any use case, not just including files. I plan to remove `doc(include)` when this is stabilized. The `forward_inner_docs` workaround will still compile without warnings, but I expect it to be used less once it's no longer necessary.
2021-05-17Address review commentsJoshua Nelson-13/+20
- Simplify boolean expression - Give an example of invalid syntax - Remove explanation of why code block is text
2021-05-17Rename INVALID_RUST_CODEBLOCK{,S}Joshua Nelson-2/+2
2021-05-17Add back missing help for ignore blocksJoshua Nelson-1/+1
This also gives a better error message when a span is missing.
2021-05-17New rustdoc lint to respect -Dwarnings correctlyAlexis Bourget-0/+37
This adds a new lint to `rustc` that is used in rustdoc when a code block is empty or cannot be parsed as valid Rust code. Previously this was unconditionally a warning. As such some documentation comments were (unknowingly) abusing this to pass despite the `-Dwarnings` used when compiling `rustc`, this should not be the case anymore.
2021-05-16Fixed item typo which did not need prefixSpencer Imbleau-1/+1
2021-05-16Noted necessessity and fixed rustdoc:: prefixSpencer Imbleau-4/+4
Now shows that certain warnings are unnecessary but includes them for consistency.
2021-05-14Remove support for floating-point constants in asm!Amanieu d'Antras-1/+1
Floating-point constants aren't very useful anyways and this simplifies the code since the type check can now be done in typeck.
2021-05-13Update global_asm! documentationAmanieu d'Antras-8/+41
2021-05-13Add support for const operands and options to global_asm!Amanieu d'Antras-10/+10
On x86, the default syntax is also switched to Intel to match asm!
2021-05-13Auto merge of #84732 - DrChat:asm_powerpc, r=Amanieubors-1/+11
Add asm!() support for PowerPC This includes GPRs and FPRs only. Note that this does not include PowerPC64. For my reference, this was mostly duplicated from PR #73214.
2021-05-12Clarified all attributes which prompt warningsSpencer Imbleau-0/+4
All calls which trigger rustdoc warnings and are now properly verbose for consistency. This uses the attribute in the examples which provides the user with more context.
2021-05-12Clarified the attribute which prompts the warningSpencer Imbleau-0/+2
The example call was lacking clarification of the `#![warn(rustdoc::invalid_codeblock_attributes)]` attribute which generates the specified warning.
2021-05-11Update booksEric Huss-0/+0
2021-05-11Add initial asm!() support for PowerPCDr. Chat-1/+11
This includes GPRs and FPRs only
2021-05-09remove const_fn feature gateRalf Jung-10/+0
2021-05-07Rollup merge of #84815 - richkadel:coverage-docs-update-2021-05, r=tmandryYuki Okushi-324/+378
Update coverage docs and command line help r? `@tmandry` cc: `@wesleywiser`
2021-05-06Renamed compiler-flags file to name of compiler-flag: instrument-coverageRich Kadel-344/+349
And redirect users from the old file name.
2021-05-06Update coverage docs and command line helpRich Kadel-75/+124
2021-05-05Implement RFC 2951: Native link modifiersLuqman Aden-0/+86
This commit implements both the native linking modifiers infrastructure as well as an initial attempt at the individual modifiers from the RFC. It also introduces a feature flag for the general syntax along with individual feature flags for each modifier.
2021-05-03platform-support: Center the contents of the `std` and `host` columnsJosh Triplett-2/+2
2021-05-03Link to MCP from target tier policyJan-Erik Rediger-4/+6
2021-05-01Auto merge of #84658 - Amanieu:reserved_regs, r=petrochenkovbors-12/+12
Be stricter about rejecting LLVM reserved registers in asm! LLVM will silently produce incorrect code if these registers are used as operands. cc `@rust-lang/wg-inline-asm`
2021-05-01Reserve x18 on AArch64 and un-reserve x16Amanieu d'Antras-3/+2
2021-05-01Rollup merge of #84774 - kraai:fix-misspelling, r=jyn514Yuki Okushi-1/+1
Fix misspelling Fix a misspelling of "or" in the source_code_based_coverage section of *The Rust Unstable Book*.
2021-05-01Rollup merge of #84756 - badboy:toc-for-tier-policy, r=GuillaumeGomezYuki Okushi-0/+11
Add a ToC to the Target Tier Policy documentation The policy document is quite lengthy, I figured it might be good to have a quick way to jump to the specific tier policies.
2021-05-01Rollup merge of #84704 - joshtriplett:platform-support-target-tier-policy, ↵Yuki Okushi-131/+174
r=pietroalbini platform-support.md: Update for consistency with Target Tier Policy Split into five sections to match the tiers: "Tier 1 with Host Tools", "Tier 1", "Tier 2 with Host Tools", "Tier 2", and "Tier 3". Explain each tier briefly in prose, and link to the corresponding section of the policy for full requirements. Drop the `host` columns from the first four, since the different sections distinguish that. (Keep the `host` column for "Tier 3", since it's a single list and the `host` column just indicates if host tools are expected to work.) Targets with host tools always have full support for std, so drop the `std` column from those. Move the explanations of the `std` column next to the appropriate tables, and drop the unknown/WIP case for tier 2 targets. Use "target" terminology consistently throughout. Sort each table by target name.
2021-04-30Fix misspellingMatthew James Kraai-1/+1
2021-04-30Add a ToC to the Target Tier Policy documentationJan-Erik Rediger-0/+11
2021-04-29platform-support.md: Update for consistency with Target Tier PolicyJosh Triplett-131/+174
Split into five sections to match the tiers: "Tier 1 with Host Tools", "Tier 1", "Tier 2 with Host Tools", "Tier 2", and "Tier 3". Explain each tier briefly in prose, and link to the corresponding section of the policy for full requirements. Drop the `host` columns from the first four, since the different sections distinguish that. (Keep the `host` column for "Tier 3", since it's a single list and the `host` column just indicates if host tools are expected to work.) Targets with host tools always have full support for std, so drop the `std` column from those. Move the explanations of the `std` column next to the appropriate tables, and drop the unknown/WIP case for tier 2 targets. Use "target" terminology consistently throughout. Sort each table by target name.
2021-04-28Update booksEric Huss-0/+0
2021-04-28Be stricter about rejecting LLVM reserved registers in asm!Amanieu d'Antras-12/+13
2021-04-26Cross-reference target tier policy from platform-supportJosh Triplett-1/+2
2021-04-26Add the target tier policy from accepted RFC 2803Josh Triplett-0/+640
2021-04-22doc/platform-support: clarify UEFI supportDavid Rheinsberg-2/+2
Add missing information on what standard-library features are supported by the UEFI targets. All current UEFI targets (which is i686 and x86_64) only support no_std cross-compilations. `std` support has not been worked on and is unlikely to emerge anytime soon, due to the much restricted environment that UEFI provides.
2021-04-20Fix broken doc linkStephen Albert-Moore-1/+1
2021-04-18Auto merge of #83799 - crlf0710:stablize_non_ascii_idents, r=Manishearthbors-48/+0
Stablize `non-ascii-idents` This is the stablization PR for RFC 2457. Currently this is waiting on fcp in [tracking issue](https://github.com/rust-lang/rust/issues/55467). r? `@Manishearth`
2021-04-14Update booksEric Huss-0/+0
2021-04-14Add powerpc64le-unknown-freebsd to src/doc/rustc/src/platform-support.mdPiotr Kubaj-0/+1
2021-04-10Auto merge of #84015 - tdelabro:issue-76704-fix, r=Amanieubors-19/+53
doc asm feature - Added new 'Label' section with example and explanations Fixes #76704
2021-04-09set allow_fail back on each exampleTimothée Delabrouille-17/+17
2021-04-09fix misspelling of register xmm23 which made xmm13 being clobbered twiceTimothée Delabrouille-1/+1
2021-04-09conjugationTimothée Delabrouille-1/+1
2021-04-09remove allow_fail and uncomment the [feature(asm)] on every exampleTimothée Delabrouille-30/+30
2021-04-09Merge branch 'issue-76704-fix' of https://github.com/tdelabro/rust into ↵Timothée Delabrouille-1/+1
issue-76704-fix merging
2021-04-09precisions on the authorized labels + typoTimothée Delabrouille-2/+2
2021-04-09add 'allow_fail' to exampleTimothée-1/+1