about summary refs log tree commit diff
path: root/src/doc
AgeCommit message (Collapse)AuthorLines
2023-07-28Auto merge of #97571 - ehuss:symbol-mangling, r=michaelwoeristerbors-2/+1283
Add documentation on v0 symbol mangling. This adds official documentation for the v0 symbol mangling format, migrating the documentation from [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html). The format was originally stabilized as the `-C symbol-mangling-version` option, but the specifics were not stabilized (per https://github.com/rust-lang/rust/pull/90128#issuecomment-948569123). Per the discussion at https://github.com/rust-lang/rust/pull/93661#discussion_r799783363 this adds those specifics as an official description of the format. cc #89917
2023-07-27docs(style-guide): don't flatten match arms with macro callCaleb Cartwright-1/+6
2023-07-27Format exploit mitigations documentationRamon de C Valle-177/+161
Formats lines in the exploit mitigations documentation to be at maximum 80 characters long.
2023-07-27Make `--print KIND=PATH` unstableUrgau-4/+11
https://github.com/rust-lang/rust/pull/113780 should have gone through an MCP+FCP but wasn't, but instead of reverting the original PR, this PR just make that new option unstable.
2023-07-27fix(serialization.md): add a necessary plural suffixİsmail Arılık-1/+1
This is better not to have an interruption while reading it fast.
2023-07-27fix(salsa.md): add punctuation to prevent confusionİsmail Arılık-2/+2
2023-07-27fix(salsa.md): remove duplicate "To Be" verbİsmail Arılık-1/+1
2023-07-26Add definitions for riscv64_linux_android targetChris Wailes-0/+1
2023-07-26add aarch64-unknown-teeos target天命剑主-0/+102
Signed-off-by: 袁浩 <yuanhao34@huawei.com>
2023-07-25Auto merge of #113411 - unikraft:unikraft, r=wesleywiserbors-0/+69
Add `x86_64-unikraft-linux-musl` target This introduces `x86_64-unikraft-linux-musl` as the first Rust target for the [Unikraft] Unikernel Development Kit. [Unikraft]: https://unikraft.org/ Unikraft imitates Linux and uses musl as libc. It is extremely configurable, and does not even provide a `poll` implementation or a network stack, unless enabled by the end user who compiles the application. Our approach for integrating the build process with `rustc` is to hide the build process as well as the actual final linking step behind a linker-shim (`kraftld`, see https://github.com/unikraft/kraftkit/issues/612). ## Tier 3 target policy > - A tier 3 target must have a designated developer or developers (the "target > maintainers") on record to be CCed when issues arise regarding the target. > (The mechanism to track and CC such developers may evolve over time.) I will be the target maintainer. > - Targets must use naming consistent with any existing targets; for instance, a > target for the same CPU or OS as an existing Rust target should use the same > name for that CPU or OS. Targets should normally use the same names and > naming conventions as used elsewhere in the broader ecosystem beyond Rust > (such as in other toolchains), unless they have a very good reason to > diverge. Changing the name of a target can be highly disruptive, especially > once the target reaches a higher tier, so getting the name right is important > even for a tier 3 target. > - Target names should not introduce undue confusion or ambiguity unless > absolutely necessary to maintain ecosystem compatibility. For example, if > the name of the target makes people extremely likely to form incorrect > beliefs about what it targets, the name should be changed or augmented to > disambiguate it. > - If possible, use only letters, numbers, dashes and underscores for the name. > Periods (`.`) are known to cause issues in Cargo. The target name `x86_64-unikraft-linux-musl` was derived from `x86_64-unknown-linux-musl`, setting Unikraft as vendor. Unikraft exactly imitates Linux + musl. > - Tier 3 targets may have unusual requirements to build or use, but must not > create legal issues or impose onerous legal terms for the Rust project or for > Rust developers or users. > - The target must not introduce license incompatibilities. > - Anything added to the Rust repository must be under the standard Rust > license (`MIT OR Apache-2.0`). > - The target must not cause the Rust tools or libraries built for any other > host (even when supporting cross-compilation to the target) to depend > on any new dependency less permissive than the Rust licensing policy. This > applies whether the dependency is a Rust crate that would require adding > new license exceptions (as specified by the `tidy` tool in the > rust-lang/rust repository), or whether the dependency is a native library > or binary. In other words, the introduction of the target must not cause a > user installing or running a version of Rust or the Rust tools to be > subject to any new license requirements. > - Compiling, linking, and emitting functional binaries, libraries, or other > code for the target (whether hosted on the target itself or cross-compiling > from another target) must not depend on proprietary (non-FOSS) libraries. > Host tools built for the target itself may depend on the ordinary runtime > libraries supplied by the platform and commonly used by other applications > built for the target, but those libraries must not be required for code > generation for the target; cross-compilation to the target must not require > such libraries at all. For instance, `rustc` built for the target may > depend on a common proprietary C runtime library or console output library, > but must not depend on a proprietary code generation library or code > optimization library. Rust's license permits such combinations, but the > Rust project has no interest in maintaining such combinations within the > scope of Rust itself, even at tier 3. > - "onerous" here is an intentionally subjective term. At a minimum, "onerous" > legal/licensing terms include but are *not* limited to: non-disclosure > requirements, non-compete requirements, contributor license agreements > (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, > requirements conditional on the employer or employment of any particular > Rust developers, revocable terms, any requirements that create liability > for the Rust project or its developers or users, or any requirements that > adversely affect the livelihood or prospects of the Rust project or its > developers or users. No dependencies were added to Rust. Requirements for linking are [Unikraft] and [KraftKit] (both BSD-3-Clause), but none of these are added to Rust. [KraftKit]: https://github.com/unikraft/kraftkit > - Neither this policy nor any decisions made regarding targets shall create any > binding agreement or estoppel by any party. If any member of an approving > Rust team serves as one of the maintainers of a target, or has any legal or > employment requirement (explicit or implicit) that might affect their > decisions regarding a target, they must recuse themselves from any approval > decisions regarding the target's tier status, though they may otherwise > participate in discussions. > - This requirement does not prevent part or all of this policy from being > cited in an explicit contract or work agreement (e.g. to implement or > maintain support for a target). This requirement exists to ensure that a > developer or team responsible for reviewing and approving a target does not > face any legal threats or obligations that would prevent them from freely > exercising their judgment in such approval, even if such judgment involves > subjective matters or goes beyond the letter of these requirements. Understood. I am not a member of a Rust team. > - Tier 3 targets should attempt to implement as much of the standard libraries > as possible and appropriate (`core` for most targets, `alloc` for targets > that can support dynamic memory allocation, `std` for targets with an > operating system or equivalent layer of system-provided functionality), but > may leave some code unimplemented (either unavailable or stubbed out as > appropriate), whether because the target makes it impossible to implement or > challenging to implement. The authors of pull requests are not obligated to > avoid calling any portions of the standard library on the basis of a tier 3 > target not implementing those portions. Understood. `std` is supported. > - The target must provide documentation for the Rust community explaining how > to build for the target, using cross-compilation if possible. If the target > supports running binaries, or running tests (even if they do not pass), the > documentation must explain how to run such binaries or tests for the target, > using emulation if possible or dedicated hardware if necessary. Building is described in the platform support doc. It will be updated once proper `kraftld` support has landed. > - Tier 3 targets must not impose burden on the authors of pull requests, or > other developers in the community, to maintain the target. In particular, > do not post comments (automated or manual) on a PR that derail or suggest a > block on the PR based on a tier 3 target. Do not send automated messages or > notifications (via any medium, including via ``@`)` to a PR author or others > involved with a PR regarding a tier 3 target, unless they have opted into > such messages. > - Backlinks such as those generated by the issue/PR tracker when linking to > an issue or PR are not considered a violation of this policy, within > reason. However, such messages (even on a separate repository) must not > generate notifications to anyone involved with a PR who has not requested > such notifications. Understood. > - Patches adding or updating tier 3 targets must not break any existing tier 2 > or tier 1 target, and must not knowingly break another tier 3 target without > approval of either the compiler team or the maintainers of the other tier 3 > target. > - In particular, this may come up when working on closely related targets, > such as variations of the same architecture with different features. Avoid > introducing unconditional uses of features that another variation of the > target may not have; use conditional compilation or runtime detection, as > appropriate, to let each target run code supported by that target. I don't think this PR breaks anything. r? compiler-team
2023-07-24compiler: Add `*-unikraft-linux-musl` documentationMartin Kröning-0/+69
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2023-07-24Rollup merge of #114006 - jonathanpallant:update-sparc-unknown-readme, r=AmanieuMatthias Krüger-18/+42
Update sparc-unknown-none-elf platform README Cherry picked a couple of commits that didn't quite make it in #113535
2023-07-24Fix span for punnycodeEric Huss-1/+1
2023-07-24feat(fuzzing.md): make `halfempty` word a linkİsmail Arılık-1/+1
2023-07-24fix(about.md): use `a` instead of `an`İsmail Arılık-1/+1
Pronunciation of the next word requires it.
2023-07-24Add clarification about build-std and using newer instructions.Jonathan Pallant (Ferrous Systems)-11/+42
2023-07-24Remove redundant note.Jonathan Pallant (Ferrous Systems)-7/+0
This came from x86_64-unknown-none and doesn't make sense here.
2023-07-24compiler: Add `*-unknown-hermit` documentationMartin Kröning-2/+79
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2023-07-22refactor(git.md) use `<>` instead of long `[...](...)` syntax for plain linksİsmail Arılık-2/+2
2023-07-22refactor(git.md): make git-scm links clickableİsmail Arılık-2/+2
Some of them wasn't clickable.
2023-07-22fix(walkthrough.md) add a comma operator to eliminate ambiguityİsmail Arılık-1/+1
There was an ambiguity on whether the `it` after `don't` is a subject or object.
2023-07-21fix(git.md): remove a confusing end of sentence characterİsmail Arılık-1/+1
It might cause a confusion since it is not end of a sentence.
2023-07-21Simplify wording in guide for unbraced closuresJosh Triplett-2/+2
2023-07-21Clarify guide for unbraced closures, regarding commentsJosh Triplett-2/+2
2023-07-21Clarify guide for unbraced closures: grammatical consistencyJosh Triplett-3/+3
2023-07-21Clarify conditions for single-line blocksJosh Triplett-2/+2
Use consistent phrasing, and add an "and".
2023-07-21Use roman 4 letter instead of wordIvan Tham-2/+2
Long text without numeric numbers when numeric numbers are used are hard to read.
2023-07-21Add missing code fencecherryblossom000-0/+2
2023-07-21Rollup merge of #113780 - dtolnay:printkindpath, r=b-naberMatthias Krüger-0/+4
Support `--print KIND=PATH` command line syntax As is already done for `--emit KIND=PATH` and `-L KIND=PATH`. In the discussion of #110785, it was pointed out that `--print KIND=PATH` is nicer than trying to apply the single global `-o` path to `--print`'s output, because in general there can be multiple print requests within a single rustc invocation, and anyway `-o` would already be used for a different meaning in the case of `link-args` and `native-static-libs`. I am interested in using `--print cfg=PATH` in Buck2. Currently Buck2 works around the lack of support for `--print KIND=PATH` by [indirecting through a Python wrapper script](https://github.com/facebook/buck2/blob/d43cf3a51a31f00be2c2248e78271b0fef0452b4/prelude/rust/tools/get_rustc_cfg.py) to redirect rustc's stdout into the location dictated by the build system. From skimming Cargo's usages of `--print`, it definitely seems like it would benefit from `--print KIND=PATH` too. Currently it is working around the lack of this by inserting `--crate-name=___ --print=crate-name` so that it can look for a line containing `___` as a delimiter between the 2 other `--print` informations it actually cares about. This is commented as a "HACK" and "abuse". https://github.com/rust-lang/cargo/blob/31eda6f7c360d9911f853b3014e057db61238f3e/src/cargo/core/compiler/build_context/target_info.rs#L242 (FYI `@weihanglo` as you dealt with this recently in https://github.com/rust-lang/cargo/pull/11633.) Mentioning reviewers active in #110785: `@fee1-dead` `@jyn514` `@bjorn3`
2023-07-20Clarify wording on breaking arrays across linesJosh Triplett-1/+1
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
2023-07-20style-guide: Fix example to match the rule it exemplifies (and match rustfmt)Josh Triplett-1/+2
An example immediately following "Put each bound on its own line." did not put each bound on its own line.
2023-07-20style-guide: Fix typo: s/right-hand side/left-hand side/Josh Triplett-1/+1
2023-07-20style-guide: Add an additional chaining exampleJosh Triplett-1/+4
Make it clear the rule for stacking the second line on the first applies recursively, as long as the condition holds.
2023-07-20style-guide: Avoid using "should" or "may" for required parts of the default ↵Josh Triplett-220/+252
style The style guide inconsistently used language like "there should be a space" or "it should be on its own line", or "may be written on a single line", for things that are required components of the default Rust style. "should" and especially "may" come across as optional. While the style guide overall now has a statement at the top that the default style itself is a *recommendation*, the *definition* of the default style should not be ambiguous about what's part of the default style. Rewrite language in the style guide to only use "should" and "may" and similar for truly optional components of the style (e.g. things a tool cannot or should not enforce in its default configuration). In their place, either use "must", or rewrite in imperative style ("put a space", "start it on the same line"). The latter also substantially reduces the use of passive voice. This is a purely editorial change, and does not affect the semantic definition of the Rust style.
2023-07-20style-guide: Simplify the structure of a recommendation (no semantic change)Josh Triplett-3/+1
Avoid putting a sentence fragment after a list; integrate it with the sentence before the list.
2023-07-20style-guide: Fix an example to match the styleJosh Triplett-1/+1
The style guide requires a trailing comma on where clause components, but then gives an example that doesn't include one. Add the missing trailing comma.
2023-07-20style-guide: Fix typo: s/forth/fourth/gJosh Triplett-2/+2
2023-07-20style-guide: Remove material about tool configurabilityJosh Triplett-46/+2
The style guide discusses the default Rust style. Configurability of Rust formatting tools are not the domain of the style guide.
2023-07-20Document --print KIND=PATH in Command-line Arguments documentationDavid Tolnay-0/+4
2023-07-19refactor(profiling/with_perf): remove a wrong to be verbİsmail Arılık-1/+1
2023-07-18refactor(tests/headers): remove duplicate list itemİsmail Arılık-1/+0
2023-07-18refactor(test/headers.md): make the meaning more obviousİsmail Arılık-1/+1
2023-07-18refactor(tests/ui): remove unnecessary duplicate wordİsmail Arılık-1/+1
2023-07-18fix(duplicate): remove unnecessary duplicate wordİsmail Arılık-1/+1
2023-07-18Auto merge of #113061 - Amanieu:x86_64-ohos, r=compiler-errorsbors-0/+34
Add x86_64-unknown-linux-ohos target This complements the existing `aarch64-unknown-linux-ohos` and `armv7-unknown-linux-ohos` targets. This should be covered by the existing MCP (https://github.com/rust-lang/compiler-team/issues/568), but I can also create a new MCP if that is preferred.
2023-07-17Rollup merge of #113535 - jonathanpallant:sparc-bare-metal, r=jackh726Matthias Krüger-0/+166
Add a sparc-unknown-none-elf target. # `sparc-unknown-none-elf` **Tier: 3** Rust for bare-metal 32-bit SPARC V7 and V8 systems, e.g. the Gaisler LEON3. ## Target maintainers - Jonathan Pallant, `jonathan.pallant@ferrous-systems.com`, https://ferrous-systems.com ## Requirements > Does the target support host tools, or only cross-compilation? Only cross-compilation. > Does the target support std, or alloc (either with a default allocator, or if the user supplies an allocator)? Only tested with `libcore` but I see no reason why you couldn't also support `liballoc`. > Document the expectations of binaries built for the target. Do they assume specific minimum features beyond the baseline of the CPU/environment/etc? What version of the OS or environment do they expect? Tested by linking with a standard SPARC bare-metal toolchain - specifically I used the [BCC2] toolchain from Gaisler (both GCC and clang variants, both pre-compiled for x64 Linux and compiling my own SPARC GCC from source to run on `aarch64-apple-darwin`). The target is set to use the lowest-common-denominator `SPARC V7` architecture (yes, they started at V7 - see [Wikipedia](https://en.wikipedia.org/wiki/SPARC#History)). [BCC2]: https://www.gaisler.com/index.php/downloads/compilers > Are there notable `#[target_feature(...)]` or `-C target-feature=` values that programs may wish to use? `-Ctarget-cpu=v8` adds the instructions added in V8. `-Ctarget-cpu=leon3` adds the V8 instructions and sets up scheduling to suit the Gaisler LEON3. > What calling convention does `extern "C"` use on the target? I believe this is defined by the SPARC architecture reference manuals and V7, V8 and V9 are all compatible. > What format do binaries use by default? ELF, PE, something else? ELF ## Building the target > If Rust doesn't build the target by default, how can users build it? Can users just add it to the `target` list in `config.toml`? Yes. I did: ```toml target = ["aarch64-apple-darwin", "sparc-unknown-none-elf"] ``` ## Building Rust programs > Rust does not yet ship pre-compiled artifacts for this target. To compile for this target, you will either need to build Rust with the target enabled (see "Building the target" above), or build your own copy of `core` by using `build-std` or similar. Correct. ## Testing > Does the target support running binaries, or do binaries have varying expectations that prevent having a standard way to run them? No - it's a bare metal platform. > If users can run binaries, can they do so in some common emulator, or do they need native hardware? But if you use [BCC2] as the linker, you get default memory map suitable for the LEON3, and a default BSP for the LEON3, and so you can run the binaries in the `tsim-leon3` simulator from Gaisler. ```console $ cat .cargo/config.toml | grep runner runner = "tsim-leon3 -c sim-commands.txt" $ cat sim-commands.txt run quit $ cargo +sparcrust run --targe=sparc-unknown-none-elf Compiling sparc-demo-rust v0.1.0 (/work/sparc-demo-rust) Finished dev [unoptimized + debuginfo] target(s) in 3.44s Running `tsim-leon3 -c sim-commands.txt target/sparc-unknown-none-elf/debug/sparc-demo-rust` TSIM3 LEON3 SPARC simulator, version 3.1.9 (evaluation version) Copyright (C) 2023, Frontgrade Gaisler - all rights reserved. This software may only be used with a valid license. For latest updates, go to https://www.gaisler.com/ Comments or bug-reports to support@gaisler.com This TSIM evaluation version will expire 2023-11-28 Number of CPUs: 2 system frequency: 50.000 MHz icache: 1 * 4 KiB, 16 bytes/line (4 KiB total) dcache: 1 * 4 KiB, 16 bytes/line (4 KiB total) Allocated 8192 KiB SRAM memory, in 1 bank at 0x40000000 Allocated 32 MiB SDRAM memory, in 1 bank at 0x60000000 Allocated 8192 KiB ROM memory at 0x00000000 section: .text, addr: 0x40000000, size: 104400 bytes section: .rodata, addr: 0x400197d0, size: 15616 bytes section: .data, addr: 0x4001d4d0, size: 1176 bytes read 1006 symbols Initializing and starting from 0x40000000 Hello, this is Rust! PANIC: PanicInfo { payload: Any { .. }, message: Some(I am a panic), location: Location { file: "src/main.rs", line: 33, col: 5 }, can_unwind: true } Program exited normally on CPU 0. ``` > Does the target support running the Rust testsuite? I don't think so, the testsuite requires `libstd` IIRC. ## Cross-compilation toolchains and C code > Does the target support C code? Yes. > If so, what toolchain target should users use to build compatible C code? (This may match the target triple, or it may be a toolchain for a different target triple, potentially with specific options or caveats.) I suggest [BCC2] from Gaisler. It comes in both GCC and Clang variants.
2023-07-17Rollup merge of #112741 - geometryolife:fix, r=workingjubileeMatthias Krüger-1/+1
fix typo in `rustdoc/src/what-is-rustdoc.md`
2023-07-17Rollup merge of #113614 - he32:netbsd-riscv64-more, r=JohnTitorMatthias Krüger-1/+1
platform-support.md: It's now verified that NetBSD/riscv64 can self-h… …ost.
2023-07-17Rollup merge of #113042 - Cyanoxygen:add-mipsr6-target-docs, r=JohnTitorMatthias Krüger-4/+186
Add Platform Support documentation for MIPS Release 6 targets This is a follow-up to our to-announce MCP, rust-lang/compiler-team#638, where we proposed to assign several maintainers for MIPS R6 targets and was told to explain that this set of targets are experimental in nature. This documentation describes Rust support for `mipsisa*r6*-unknown-linux-gnu*` targets (mainly `mipsisa64r6el-unknown-linux-gnuabi64`), including toolchain setup, building, and testing procedures.
2023-07-15generic_arguments.md: substs -> GenericArgsMahdi Dibaiee-13/+13
See https://github.com/rust-lang/rust/pull/113591