├── .cargo └── config.toml ├── .dockerignore ├── .envrc ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── enhancement_request.yml │ └── wsl_panic.yml ├── renovate.json └── workflows │ └── ci.yaml ├── .gitignore ├── .taplo.toml ├── CHANGELOG.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── build.rs ├── ci ├── actions-templates │ ├── README.md │ ├── all-features-template.yaml │ ├── centos-fmt-clippy-template.yaml │ ├── conclusion-template.yaml │ ├── freebsd-builds-template.yaml │ ├── gen-workflows.sh │ ├── linux-builds-template.yaml │ ├── macos-builds-template.yaml │ ├── test-docs-template.yaml │ └── windows-builds-template.yaml ├── changelog_helper.py ├── cloudfront-invalidation.txt ├── deploy.bash ├── docker │ ├── aarch64-unknown-linux-gnu │ │ └── Dockerfile │ ├── aarch64-unknown-linux-musl │ │ └── Dockerfile │ ├── android │ │ └── Dockerfile │ ├── arm-unknown-linux-gnueabi │ │ └── Dockerfile │ ├── arm-unknown-linux-gnueabihf │ │ └── Dockerfile │ ├── armv7-unknown-linux-gnueabihf │ │ └── Dockerfile │ ├── i686-unknown-linux-gnu │ │ └── Dockerfile │ ├── loongarch64-unknown-linux-gnu │ │ └── Dockerfile │ ├── loongarch64-unknown-linux-musl │ │ └── Dockerfile │ ├── mips-unknown-linux-gnu │ │ └── Dockerfile │ ├── mips64-unknown-linux-gnuabi64 │ │ └── Dockerfile │ ├── mips64el-unknown-linux-gnuabi64 │ │ └── Dockerfile │ ├── mipsel-unknown-linux-gnu │ │ └── Dockerfile │ ├── powerpc-unknown-linux-gnu │ │ └── Dockerfile │ ├── powerpc64-unknown-linux-gnu │ │ └── Dockerfile │ ├── powerpc64le-unknown-linux-gnu │ │ └── Dockerfile │ ├── powerpc64le-unknown-linux-musl │ │ └── Dockerfile │ ├── riscv64gc-unknown-linux-gnu │ │ └── Dockerfile │ ├── s390x-unknown-linux-gnu │ │ └── Dockerfile │ ├── scripts │ │ └── sccache.bash │ ├── x86_64-unknown-freebsd │ │ └── Dockerfile │ ├── x86_64-unknown-illumos │ │ └── Dockerfile │ ├── x86_64-unknown-linux-gnu │ │ └── Dockerfile │ ├── x86_64-unknown-linux-musl │ │ └── Dockerfile │ └── x86_64-unknown-netbsd │ │ └── Dockerfile ├── fetch-rust-docker.bash ├── freebsd │ └── script.bash ├── prepare-deploy.bash ├── prepare-deploy.ps1 ├── raw_init.sh ├── run.bash ├── shared.bash └── sync-dist.py ├── doc ├── dev-guide │ ├── .gitignore │ ├── README.md │ ├── book.toml │ └── src │ │ ├── SUMMARY.md │ │ ├── coding-standards.md │ │ ├── index.md │ │ ├── linting.md │ │ ├── release-process.md │ │ ├── tips-and-tricks.md │ │ ├── tracing.md │ │ └── version-numbers.md └── user-guide │ ├── .gitignore │ ├── README.md │ ├── book.toml │ └── src │ ├── SUMMARY.md │ ├── basics.md │ ├── concepts │ ├── channels.md │ ├── components.md │ ├── index.md │ ├── profiles.md │ ├── proxies.md │ └── toolchains.md │ ├── configuration.md │ ├── cross-compilation.md │ ├── environment-variables.md │ ├── examples.md │ ├── faq.md │ ├── index.md │ ├── installation │ ├── already-installed-rust.md │ ├── images │ │ ├── component-msvc.png │ │ ├── component-sdk.png │ │ ├── step1.png │ │ ├── step2.png │ │ ├── step3.png │ │ ├── step4.png │ │ └── step5.png │ ├── index.md │ ├── other.md │ ├── windows-msvc.md │ └── windows.md │ ├── network-proxies.md │ ├── overrides.md │ └── security.md ├── flake.nix ├── rustup-init.sh ├── src ├── bin │ └── rustup-init.rs ├── cli.rs ├── cli │ ├── common.rs │ ├── download_tracker.rs │ ├── errors.rs │ ├── help.rs │ ├── job.rs │ ├── log.rs │ ├── markdown.rs │ ├── proxy_mode.rs │ ├── rustup_mode.rs │ ├── self_update.rs │ ├── self_update │ │ ├── env.fish │ │ ├── env.nu │ │ ├── env.sh │ │ ├── shell.rs │ │ ├── unix.rs │ │ └── windows.rs │ ├── setup_mode.rs │ └── topical_doc.rs ├── command.rs ├── config.rs ├── diskio │ ├── immediate.rs │ ├── mod.rs │ ├── test.rs │ └── threaded.rs ├── dist │ ├── component │ │ ├── components.rs │ │ ├── mod.rs │ │ ├── package.rs │ │ ├── tests.rs │ │ └── transaction.rs │ ├── config.rs │ ├── download.rs │ ├── manifest.rs │ ├── manifest │ │ └── tests │ │ │ ├── channel-rust-nightly-example.toml │ │ │ └── channel-rust-nightly-example2.toml │ ├── manifestation.rs │ ├── manifestation │ │ └── tests.rs │ ├── mod.rs │ ├── notifications.rs │ ├── prefix.rs │ ├── temp.rs │ ├── triple.rs │ └── triple │ │ └── known.rs ├── download │ ├── mod.rs │ └── tests.rs ├── env_var.rs ├── errors.rs ├── fallback_settings.rs ├── install.rs ├── lib.rs ├── notifications.rs ├── process.rs ├── process │ ├── filesource.rs │ └── terminalsource.rs ├── settings.rs ├── test.rs ├── test │ ├── clitools.rs │ ├── dist.rs │ ├── mock.rs │ └── mock_bin_src.rs ├── toolchain.rs ├── toolchain │ ├── distributable.rs │ └── names.rs └── utils │ ├── mod.rs │ ├── notifications.rs │ ├── notify.rs │ ├── raw.rs │ └── units.rs ├── tests ├── suite │ ├── cli-ui │ │ ├── rustup-init │ │ │ ├── rustup-init_help_flag_stdout.toml │ │ │ └── rustup-init_sh_help_flag_stdout.toml │ │ └── rustup │ │ │ ├── rustup_check_cmd_help_flag_stdout.toml │ │ │ ├── rustup_completions_cmd_help_flag_stdout.toml │ │ │ ├── rustup_component_cmd_add_cmd_help_flag_stdout.toml │ │ │ ├── rustup_component_cmd_list_cmd_help_flag_stdout.toml │ │ │ ├── rustup_component_cmd_remove_cmd_help_flag_stdout.toml │ │ │ ├── rustup_default_cmd_help_flag_stdout.toml │ │ │ ├── rustup_doc_cmd_help_flag_stdout.toml │ │ │ ├── rustup_help_cmd_stdout.toml │ │ │ ├── rustup_help_flag_stdout.toml │ │ │ ├── rustup_man_cmd_help_flag_stdout.toml │ │ │ ├── rustup_only_options_stdout.toml │ │ │ ├── rustup_override_cmd_add_cmd_help_flag_stdout.toml │ │ │ ├── rustup_override_cmd_help_flag_stdout.toml │ │ │ ├── rustup_override_cmd_list_cmd_help_flag_stdout.toml │ │ │ ├── rustup_override_cmd_remove_cmd_help_flag_stdout.toml │ │ │ ├── rustup_override_cmd_set_cmd_help_flag_stdout.toml │ │ │ ├── rustup_override_cmd_unset_cmd_help_flag_stdout.toml │ │ │ ├── rustup_run_cmd_help_flag_stdout.toml │ │ │ ├── rustup_self_cmd_help_flag_stdout.toml │ │ │ ├── rustup_self_cmd_uninstall_cmd_help_flag_stdout.toml │ │ │ ├── rustup_self_cmd_update_cmd_help_flag_stdout.toml │ │ │ ├── rustup_self_cmd_upgrade-data _cmd_help_flag_stdout.toml │ │ │ ├── rustup_set_cmd_auto-install_cmd_help_flag_stdout.toml │ │ │ ├── rustup_set_cmd_auto-self-update_cmd_help_flag_stdout.toml │ │ │ ├── rustup_set_cmd_default-host_cmd_help_flag_stdout.toml │ │ │ ├── rustup_set_cmd_help_flag_stdout.toml │ │ │ ├── rustup_set_cmd_profile_cmd_help_flag_stdout.toml │ │ │ ├── rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml │ │ │ ├── rustup_show_cmd_help_flag_stdout.toml │ │ │ ├── rustup_show_cmd_home_cmd_help_flag_stdout.toml │ │ │ ├── rustup_show_cmd_profile_cmd_help_flag_stdout.toml │ │ │ ├── rustup_target_cmd_add_cmd_help_flag_stdout.toml │ │ │ ├── rustup_target_cmd_help_flag_stdout.toml │ │ │ ├── rustup_target_cmd_list_cmd_help_flag_stdout.toml │ │ │ ├── rustup_target_cmd_remove_cmd_help_flag_stdout.toml │ │ │ ├── rustup_toolchain_cmd_help_flag_stdout.toml │ │ │ ├── rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml │ │ │ ├── rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml │ │ │ ├── rustup_toolchain_cmd_list_cmd_help_flag_stdout.toml │ │ │ ├── rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml │ │ │ ├── rustup_unknown_arg_stdout.toml │ │ │ ├── rustup_up_cmd_help_flag_stdout.toml │ │ │ ├── rustup_update_cmd_help_flag_stdout.toml │ │ │ ├── rustup_upgrade_cmd_help_flag_stdout.toml │ │ │ └── rustup_which_cmd_help_flag_stdout.toml │ ├── cli_exact.rs │ ├── cli_inst_interactive.rs │ ├── cli_misc.rs │ ├── cli_paths.rs │ ├── cli_rustup.rs │ ├── cli_self_upd.rs │ ├── cli_ui.rs │ ├── cli_v1.rs │ ├── cli_v2.rs │ ├── dist_install.rs │ ├── known_triples.rs │ └── mod.rs └── test_bonanza.rs ├── triagebot.toml └── www ├── fonts ├── AlfaSlabOne-Regular.woff ├── AlfaSlabOne-Regular.woff2 ├── FiraMono-Regular.ttf ├── FiraSans-Light.woff ├── FiraSans-Medium.woff ├── FiraSans-Regular.woff ├── OFL.txt └── WorkSans-Medium.ttf ├── index.html ├── normalize.css ├── rustup.css ├── rustup.js └── website_config.json /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | dev-install = "run -- --no-modify-path -y" 3 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | target 3 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use flake 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.rs text eol=lf 2 | *.lock text eol=lf 3 | *.txt text eol=lf 4 | *.toml text eol=lf 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug report 2 | description: Create a report to help us improve 3 | labels: [bug] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: > 8 | **Thanks for filing a 🐛 bug report 😄!** 9 | 10 | - type: checkboxes 11 | attributes: 12 | label: Verification 13 | description: Please verify that you've followed these steps. 14 | options: 15 | - label: I searched for recent similar issues at https://github.com/rust-lang/rustup/issues?q=is%3Aissue+is%3Aopen%2Cclosed and found no duplicates. 16 | required: true 17 | - label: I am on the latest version of Rustup according to https://github.com/rust-lang/rustup/tags and am still able to reproduce my issue. 18 | required: true 19 | 20 | - type: textarea 21 | id: problem 22 | attributes: 23 | label: Problem 24 | description: > 25 | A clear and concise description of what the bug is, 26 | including what currently happens and what you expected to happen. 27 | validations: 28 | required: true 29 | 30 | - type: textarea 31 | id: steps 32 | attributes: 33 | label: Steps 34 | description: The steps to reproduce the bug. 35 | placeholder: | 36 | 1. 37 | 2. 38 | 3. 39 | validations: 40 | required: true 41 | 42 | - type: textarea 43 | id: solutions 44 | attributes: 45 | label: Possible Solution(s) 46 | description: > 47 | Not obligatory, but suggest a fix/reason for the bug, 48 | or ideas how to implement the addition or change. 49 | 50 | - type: textarea 51 | id: notes 52 | attributes: 53 | label: Notes 54 | 55 | - type: textarea 56 | id: version 57 | attributes: 58 | label: Rustup version 59 | description: Output of `rustup --version` 60 | render: console 61 | validations: 62 | required: true 63 | 64 | - type: textarea 65 | id: toolchains 66 | attributes: 67 | label: Installed toolchains 68 | description: Output of `rustup show` 69 | render: console 70 | validations: 71 | required: true 72 | 73 | - type: textarea 74 | id: os 75 | attributes: 76 | label: OS version 77 | render: console 78 | validations: 79 | required: true 80 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement_request.yml: -------------------------------------------------------------------------------- 1 | name: Enhancement request 2 | description: Suggest an enhancement for this project 3 | labels: [enhancement] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: > 8 | **Thanks for filing an 🙋 enhancement request 😄!** 9 | 10 | - type: textarea 11 | id: problem 12 | attributes: 13 | label: Problem you are trying to solve 14 | description: > 15 | A clear and concise description of the problem this enhancement request is trying to solve. 16 | validations: 17 | required: true 18 | 19 | - type: textarea 20 | id: solution 21 | attributes: 22 | label: Solution you'd like 23 | description: > 24 | A clear and concise description of what you want to happen. 25 | validations: 26 | required: true 27 | 28 | - type: textarea 29 | id: notes 30 | attributes: 31 | label: Notes 32 | description: > 33 | Any additional context or information you feel may be relevant to the issue. 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/wsl_panic.yml: -------------------------------------------------------------------------------- 1 | name: I am experiencing a panic on WSL 2 | description: Report a panic when using Rustup on WSL 3 | labels: [bug] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: > 8 | Please read the following very carefully and decide if you 9 | actually need to file this bug... 10 | 11 | WSL, specifically WSL 1, has a limitation where glibc 2.31 and 12 | newer will panic, fundamentally the panic will look something 13 | like the following: 14 | 15 | thread 'main' panicked at 'assertion failed: `(left == right)` 16 | left: `22`, 17 | right: `4`', src/libstd/sys/unix/thread.rs:166:21 18 | 19 | This is a bug, but it's a bug in WSL, not in Rust/Rustup and will 20 | affect other programs built with Rust too. Working around it 21 | with Rustup will not help you until WSL (or glibc) is fixed. 22 | 23 | This is known to affect: 24 | 25 | * Ubuntu 20.04 26 | * Arch Linux 27 | 28 | But it may affect other versions of Linux on WSL1. 29 | 30 | You can find more information on the WSL bug report 31 | [here](https://github.com/microsoft/WSL/issues/4898). 32 | 33 | If you're CERTAIN that you're not reporting yet another duplicate 34 | of the above issue, then... 35 | 36 | **Thanks for filing a 🐛 bug report 😄!** 37 | 38 | - type: textarea 39 | id: problem 40 | attributes: 41 | label: Problem 42 | description: > 43 | A clear and concise description of what the bug is, 44 | including what currently happens and what you expected to happen. 45 | validations: 46 | required: true 47 | 48 | - type: textarea 49 | id: steps 50 | attributes: 51 | label: Steps 52 | description: The steps to reproduce the bug. 53 | placeholder: | 54 | 1. 55 | 2. 56 | 3. 57 | validations: 58 | required: true 59 | 60 | - type: textarea 61 | id: solutions 62 | attributes: 63 | label: Possible Solution(s) 64 | description: > 65 | Not obligatory, but suggest a fix/reason for the bug, 66 | or ideas how to implement the addition or change. 67 | 68 | - type: textarea 69 | id: notes 70 | attributes: 71 | label: Notes 72 | 73 | - type: textarea 74 | id: version 75 | attributes: 76 | label: Rustup version 77 | description: Output of `rustup --version` 78 | render: console 79 | validations: 80 | required: true 81 | 82 | - type: textarea 83 | id: toolchains 84 | attributes: 85 | label: Installed toolchains 86 | description: Output of `rustup show` 87 | render: console 88 | validations: 89 | required: true 90 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:recommended", 5 | "customManagers:githubActionsVersions" 6 | ], 7 | "labels": [ 8 | "dependencies" 9 | ], 10 | "lockFileMaintenance": { 11 | "enabled": true, 12 | "automerge": false, 13 | "schedule": "before 4am on Monday" 14 | }, 15 | "prCreation": "immediate", 16 | "rangeStrategy": "update-lockfile", 17 | "minimumReleaseAge": "3 days", 18 | "github-actions": { 19 | "fileMatch": [ 20 | "^ci\\/.*/[^/]+\\.ya?ml$" 21 | ] 22 | }, 23 | "packageRules": [ 24 | { 25 | "matchManagers": [ 26 | "cargo" 27 | ], 28 | "matchUpdateTypes": [ 29 | "patch" 30 | ], 31 | "enabled": false 32 | }, 33 | { 34 | "matchManagers": [ 35 | "cargo" 36 | ], 37 | "matchUpdateTypes": [ 38 | "minor" 39 | ], 40 | "matchCurrentVersion": "!/^0/", 41 | "enabled": false 42 | }, 43 | { 44 | "groupName": "opentelemetry", 45 | "matchPackageNames": [ 46 | "/opentelemetry/" 47 | ] 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.project 2 | /target 3 | /Cargo.lock 4 | /.settings 5 | /.idea/ 6 | /.vscode/ 7 | *~ 8 | /**/target 9 | /home 10 | /local-rustup 11 | /snapcraft 12 | flake.lock 13 | -------------------------------------------------------------------------------- /.taplo.toml: -------------------------------------------------------------------------------- 1 | include = ["**/*.toml"] 2 | 3 | [[rule]] 4 | include = ["**/Cargo.toml"] 5 | keys = [ 6 | "dependencies", 7 | "dev-dependencies", 8 | "build-dependencies", 9 | "workspace.dependencies", 10 | ] 11 | 12 | [rule.formatting] 13 | column_width = 160 14 | reorder_keys = true 15 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 The Rust Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rustup: the Rust toolchain installer 2 | 3 | | Master CI | Build Status | 4 | |--------------|----------------------------------------------------------| 5 | | Windows | ![Windows builds][actions-windows-master] | 6 | | macOS | ![maOS builds][actions-macos-master] | 7 | | Linux Etc | ![Linux (etc) builds][actions-linux-master] | 8 | 9 | *Rustup* installs [The Rust Programming Language][rustlang] from the official 10 | release channels, enabling you to easily switch between stable, beta, 11 | and nightly compilers and keep them updated. It makes cross-compiling 12 | simpler with binary builds of the standard library for common platforms. 13 | And it runs on all platforms Rust supports, including Windows. 14 | 15 | [rustlang]: https://www.rust-lang.org 16 | 17 | ## Documentation 18 | 19 | See [**The Rustup book**](https://rust-lang.github.io/rustup/) for 20 | documentation on installing and using Rustup. 21 | 22 | The latest documentation for the master branch can be found 23 | under [devel](https://rust-lang.github.io/rustup/devel/). 24 | 25 | ## Contributing 26 | 27 | See [**The Rustup dev guide**](https://rust-lang.github.io/rustup/dev-guide) for information on contributing to Rustup. 28 | 29 | ## License 30 | 31 | Copyright Diggory Blake, the Mozilla Corporation, and Rustup 32 | contributors. 33 | 34 | Licensed under either of 35 | 36 | * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0) 37 | * MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT) 38 | 39 | at your option. 40 | 41 | 42 | [actions-windows-master]: https://github.com/rust-lang/rustup/workflows/Windows%20(master)/badge.svg 43 | [actions-macos-master]: https://github.com/rust-lang/rustup/workflows/macOS/badge.svg?branch=master 44 | [actions-linux-master]: https://github.com/rust-lang/rustup/workflows/Linux%20(master)/badge.svg 45 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | 3 | use platforms::Platform; 4 | 5 | fn from_build() -> Result { 6 | let triple = 7 | env::var("RUSTUP_OVERRIDE_BUILD_TRIPLE").unwrap_or_else(|_| env::var("TARGET").unwrap()); 8 | if Platform::ALL.iter().any(|p| p.target_triple == triple) { 9 | Ok(triple) 10 | } else { 11 | Err(triple) 12 | } 13 | } 14 | 15 | fn main() { 16 | println!("cargo::rerun-if-env-changed=RUSTUP_OVERRIDE_BUILD_TRIPLE"); 17 | println!("cargo::rerun-if-env-changed=TARGET"); 18 | match from_build() { 19 | Ok(triple) => eprintln!("Computed build based on target triple: {triple:#?}"), 20 | Err(s) => { 21 | eprintln!("Unable to parse target '{s}' as a known target triple"); 22 | eprintln!( 23 | "If you are attempting to bootstrap a new target, you might need to update `platforms` to a newer version" 24 | ); 25 | std::process::abort(); 26 | } 27 | } 28 | let target = env::var("TARGET").unwrap(); 29 | println!("cargo::rustc-env=TARGET={target}"); 30 | 31 | // Set linker options specific to Windows MSVC. 32 | let target_os = env::var("CARGO_CFG_TARGET_OS"); 33 | let target_env = env::var("CARGO_CFG_TARGET_ENV"); 34 | if !(target_os.as_deref() == Ok("windows") && target_env.as_deref() == Ok("msvc")) { 35 | return; 36 | } 37 | 38 | // # Only search system32 for DLLs 39 | // 40 | // This applies to DLLs loaded at load time. However, this setting is ignored 41 | // before Windows 10 RS1 (aka 1601). 42 | // https://learn.microsoft.com/en-us/cpp/build/reference/dependentloadflag?view=msvc-170 43 | println!("cargo::rustc-link-arg-bin=rustup-init=/DEPENDENTLOADFLAG:0x800"); 44 | 45 | // # Delay load 46 | // 47 | // Delay load dlls that are not "known DLLs"[1]. 48 | // Known DLLs are always loaded from the system directory whereas other DLLs 49 | // are loaded from the application directory. By delay loading the latter 50 | // we can ensure they are instead loaded from the system directory. 51 | // [1]: https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#factors-that-affect-searching 52 | // 53 | // This will work on all supported Windows versions but it relies on 54 | // us using `SetDefaultDllDirectories` before any libraries are loaded. 55 | // See also: src/bin/rustup-init.rs 56 | let delay_load_dlls = ["bcrypt", "api-ms-win-core-synch-l1-2-0"]; 57 | for dll in delay_load_dlls { 58 | println!("cargo::rustc-link-arg-bin=rustup-init=/delayload:{dll}.dll"); 59 | } 60 | // When using delayload, it's necessary to also link delayimp.lib 61 | // https://learn.microsoft.com/en-us/cpp/build/reference/dependentloadflag?view=msvc-170 62 | println!("cargo::rustc-link-arg-bin=rustup-init=delayimp.lib"); 63 | 64 | // # Turn linker warnings into errors 65 | // 66 | // Rust hides linker warnings meaning mistakes may go unnoticed. 67 | // Turning them into errors forces them to be displayed (and the build to fail). 68 | // If we do want to ignore specific warnings then `/IGNORE:` should be used. 69 | println!("cargo::rustc-link-arg-bin=rustup-init=/WX"); 70 | 71 | // Increase the stack size to 2 mb. 72 | // Works around issue with the clap parser using a lot of stack space in debug mode. 73 | // See https://github.com/clap-rs/clap/issues/5134 74 | println!("cargo::rustc-link-arg-bin=rustup-init=/STACK:0x200000"); 75 | } 76 | -------------------------------------------------------------------------------- /ci/actions-templates/README.md: -------------------------------------------------------------------------------- 1 | # Rustup GitHub Actions Workflows 2 | 3 | This directory contains all the workflows we use in Rustup for GitHub Actions. 4 | 5 | ## Triggers for CI builds 6 | 7 | Rustup has five situations in which we perform CI builds: 8 | 9 | 1. On PR changes 10 | 2. On merge to master 11 | 3. Time-based rebuilds of master 12 | 4. Pushes to the stable branch 13 | 5. Renovate branches with dependency updates, tested before opening a PR or 14 | merging. They are assessed the same as a PR: if it would be good enough as a 15 | human proposed change, it's good enough as a robot proposed change. 16 | 17 | The goals for each of those situations are subtly different. For PR changes, 18 | we want to know as quickly as possible if the change is likely to be an issue. 19 | 20 | Once a change hits master, we want to know that all our targets build. 21 | 22 | Time based rebuilds of master are about determining if updates to the toolchain 23 | have caused us problems, and also to try and highlight if we have flaky tests. 24 | 25 | The stable branch is about making releases. Builds from that branch are uploaded 26 | to S3 so that we can then make a release of rustup. 27 | 28 | ## Targets we need to build 29 | 30 | We follow `rustc`'s [platform support policy] closely, and so `rustup` is expected 31 | to build for all targets listed in the _tier 1_ or the _tier 2 with host tools_ section. 32 | 33 | [platform support policy]: https://doc.rust-lang.org/nightly/rustc/platform-support.html 34 | 35 | In order to reduce the maintainance burden, targets listed in the _tier 2 without host 36 | tools_ section might get limited support, but should by no means become a blocker. 37 | We should not build for targets listed in the _tier 3_ section, and if a target gets 38 | downgraded to tier 3, its CI workflows should be dropped accordingly. 39 | 40 | If a platform is directly supported by GitHub Action's free runners, we should always 41 | build for it natively with the full test suite activated. 42 | Otherwise, we might consider performing a cross-build, in which case we won't run the 43 | tests for the the target. 44 | 45 | ## Useful notes about how we run builds 46 | 47 | For the builds which run on x86_64 linux, we deliberately run inside a docker 48 | image which comes from `rust-lang/rust`'s CI so that we know we're linking against 49 | the same libc etc as the release of Rust. 50 | 51 | For the builds which run on Windows, we retrieve mingw from Rust's CI as well 52 | so that we're clearly using the right version of that. 53 | 54 | In all cases, we attempt to use the `rustup-init.sh` from the branch under test 55 | where at all possible, so that we spot errors in that ASAP. 56 | 57 | Given that, we prefer to not use a preinstalled rust/rustup at all if we can, 58 | so we start from as bare a VM as makes sense. 59 | 60 | For Windows builds, we use a Visual Studio 2017 image if we can. 61 | 62 | ## The workflows 63 | 64 | Due to limitations in how github workflows work, we have to create our workflows 65 | from template files and then commit them. 66 | 67 | The templates are in this directory, and the built workflows end up in the 68 | `.github/workflows` directory. `-all` always runs, `-on-pr` `-on-master` and 69 | `-on-stable` do the obvious. 70 | -------------------------------------------------------------------------------- /ci/actions-templates/all-features-template.yaml: -------------------------------------------------------------------------------- 1 | jobs: # skip-all 2 | 3 | # This is ci/actions-templates/all-features-template.yaml 4 | # Do not edit this file in .github/workflows 5 | # 6 | # This is an additional workflow to test building with all feature combinations. 7 | # Unlike our main workflows, this doesn't self-test the rustup install scripts, 8 | # nor run on the rust docker images. This permits a smaller workflow without the 9 | # templating and so on. 10 | build-all-features: # job-name 11 | runs-on: ${{ matrix.os }} 12 | if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | include: 17 | # Might add more targets in future. 18 | - os: ubuntu-latest 19 | target: x86_64-unknown-linux-gnu 20 | - os: windows-latest 21 | target: x86_64-pc-windows-msvc 22 | steps: 23 | - name: Clone repo 24 | uses: actions/checkout@v4 25 | - name: Install rustup stable 26 | run: rustup toolchain install stable --profile minimal 27 | - name: Install Protoc 28 | uses: arduino/setup-protoc@v1 29 | with: 30 | version: "3.x" 31 | repo-token: ${{ secrets.GITHUB_TOKEN }} 32 | - name: Install OpenSSL 33 | if: ${{ contains(matrix.os, 'windows') }} 34 | run: | 35 | Get-Command openssl 36 | openssl version 37 | echo "OPENSSL_LIB_DIR=C:/Program Files/OpenSSL/lib" >> $env:GITHUB_ENV 38 | echo "OPENSSL_DIR=C:/Program Files/OpenSSL/" >> $env:GITHUB_ENV 39 | echo "OPENSSL_INCLUDE_DIR=C:/Program Files/OpenSSL/include" >> $env:GITHUB_ENV 40 | - name: Install NASM 41 | # Building `aws-lc-rs` for Windows MSVC depends on `NASM`. 42 | # See: https://aws.github.io/aws-lc-rs/requirements/windows.html 43 | uses: ilammy/setup-nasm@v1 44 | if: ${{ contains(matrix.os, 'windows') }} 45 | - name: Set environment variables appropriately for the build 46 | shell: bash 47 | run: | 48 | echo "$HOME/.cargo/bin" >> $GITHUB_PATH 49 | echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV 50 | - name: Cache Cargo 51 | uses: Swatinem/rust-cache@v2 52 | - name: Install cargo-all-features 53 | shell: bash 54 | run: which cargo-check-all-features || cargo install cargo-all-features --git https://github.com/rbtcollins/cargo-all-features.git 55 | - name: Ensure we have our goal target installed 56 | run: | 57 | rustup target install ${{ matrix.target }} 58 | - name: Build every combination 59 | env: 60 | RUSTFLAGS: -D warnings 61 | run: | 62 | cargo check-all-features --root-only 63 | -------------------------------------------------------------------------------- /ci/actions-templates/centos-fmt-clippy-template.yaml: -------------------------------------------------------------------------------- 1 | jobs: # skip-all 2 | 3 | # This is ci/actions-templates/centos-fmt-clippy.yaml 4 | # Do not edit this file in .github/workflows 5 | check: # job-name 6 | runs-on: ubuntu-latest 7 | strategy: 8 | fail-fast: false 9 | steps: 10 | - name: Clone repo 11 | uses: actions/checkout@v4 12 | with: 13 | # v2 defaults to a shallow checkout, but we need at least to the previous tag 14 | fetch-depth: 0 15 | - name: Acquire tags for the repo 16 | run: | 17 | git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* 18 | - name: Display the current git status 19 | run: | 20 | git status 21 | git describe 22 | - name: Run CI workflow generation checks 23 | run: | 24 | ./ci/actions-templates/gen-workflows.sh 25 | git diff --exit-code 26 | - name: Prep cargo dirs 27 | run: | 28 | mkdir -p ~/.cargo/{registry,git} 29 | - name: Set environment variables appropriately for the build 30 | run: | 31 | echo "$HOME/.cargo/bin" >> $GITHUB_PATH 32 | - name: Cache cargo registry and git trees 33 | uses: actions/cache@v4 34 | with: 35 | path: | 36 | ~/.cargo/registry 37 | ~/.cargo/git 38 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 39 | - name: Get rustc commit hash 40 | id: cargo-target-cache 41 | run: | 42 | echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT 43 | shell: bash 44 | - name: Cache cargo build 45 | uses: actions/cache@v4 46 | with: 47 | path: target 48 | key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} 49 | restore-keys: ${{ github.base_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} 50 | - name: Install Rustup using ./rustup-init.sh 51 | run: | 52 | sh ./rustup-init.sh --default-toolchain=stable --profile=minimal -c=rustfmt -c=clippy -y 53 | - name: Run the centos check within the docker image 54 | run: | 55 | docker run \ 56 | --volume "$PWD":/checkout:ro \ 57 | --workdir /checkout \ 58 | --tty \ 59 | --init \ 60 | --rm \ 61 | centos:7 \ 62 | sh ./ci/raw_init.sh 63 | - name: Run shell checks 64 | run: | 65 | shellcheck -x -s dash -- rustup-init.sh 66 | git ls-files -- '*.sh' | xargs shellcheck -x -s dash 67 | git ls-files -- '*.bash' | xargs shellcheck -x -s bash 68 | - name: Install taplo 69 | uses: taiki-e/install-action@v2 70 | with: 71 | tool: taplo-cli 72 | - name: Run TOML formatting checks 73 | run: | 74 | taplo fmt 75 | git diff --exit-code 76 | - name: Run Rust formatting checks 77 | run: | 78 | cargo fmt --all --check 79 | - name: Run cargo check and clippy 80 | run: | 81 | cargo check --all --all-targets --features test 82 | git ls-files -- '*.rs' | xargs touch 83 | cargo clippy --all-targets --all-features -- -D warnings 84 | -------------------------------------------------------------------------------- /ci/actions-templates/conclusion-template.yaml: -------------------------------------------------------------------------------- 1 | jobs: # skip-all 2 | 3 | # This is ci/actions-templates/conclusion-template.yaml 4 | # Do not edit this file in .github/workflows 5 | conclusion: 6 | # https://github.com/PyO3/pyo3/blob/42601f3af94242b017402b763a495798a92da8f8/.github/workflows/ci.yml#L452-L472 7 | if: always() 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Result 11 | run: | 12 | jq -C <<< "${needs}" 13 | # Check if all needs were successful or skipped. 14 | "$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")" 15 | env: 16 | needs: ${{ toJson(needs) }} 17 | needs: 18 | -------------------------------------------------------------------------------- /ci/actions-templates/freebsd-builds-template.yaml: -------------------------------------------------------------------------------- 1 | jobs: # skip-master skip-stable 2 | 3 | # This is ci/actions-templates/freebsd-builds-template.yaml 4 | # Do not edit this file in .github/workflows 5 | build-freebsd-master: # job-name skip-stable 6 | build-freebsd-stable: # job-name skip-master 7 | runs-on: ubuntu-latest 8 | if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-stable 9 | if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-master 10 | steps: 11 | - uses: actions/checkout@v4 12 | with: 13 | # v2 defaults to a shallow checkout, but we need at least to the previous tag 14 | fetch-depth: 0 15 | - name: Acquire tags for the repo 16 | run: | 17 | git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* 18 | - name: Run a full build 19 | uses: vmactions/freebsd-vm@v1 20 | with: 21 | release: 13.2 22 | usesh: true 23 | copyback: false 24 | prepare: | 25 | pkg install -y git gmake bash sudo \ 26 | `# The following packages are required by 'aws-lc-rs':` \ 27 | cmake-core llvm-devel-lite rust-bindgen-cli 28 | run: | 29 | echo "=========" 30 | echo "create non-root user and log into it" 31 | pw group add -n tester 32 | pw user add -n tester -g tester -s `which bash` 33 | pw user mod tester -d `pwd` 34 | chown -R tester . 35 | sudo -u tester bash ci/freebsd/script.bash 36 | -------------------------------------------------------------------------------- /ci/actions-templates/gen-workflows.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | INPATH=$(dirname "$0") 4 | OUTPATH="${INPATH}/../../.github/workflows/ci.yaml" 5 | 6 | gen_job () { 7 | grep -v "skip-$2" "$INPATH/$1-template.yaml" >> "$OUTPATH" 8 | } 9 | 10 | cat << 'EOF' > "$OUTPATH" 11 | # GitHub Actions workflow generated by ci/actions-templates/gen-workflows.sh 12 | # Do not edit this file in .github/workflows 13 | 14 | name: CI 15 | 16 | on: 17 | merge_group: 18 | pull_request: 19 | branches: 20 | - "*" 21 | push: 22 | branches: 23 | - master 24 | - stable 25 | schedule: 26 | - cron: "30 0 * * 1,3,5" # At 00:30 UTC on Monday, Wednesday, and Friday 27 | 28 | jobs: 29 | EOF 30 | 31 | gen_job windows-builds pr 32 | gen_job windows-builds master 33 | gen_job windows-builds stable 34 | 35 | gen_job linux-builds pr 36 | gen_job linux-builds master 37 | gen_job linux-builds stable 38 | 39 | gen_job macos-builds x86_64 40 | gen_job macos-builds aarch64 41 | 42 | gen_job freebsd-builds master 43 | gen_job freebsd-builds stable 44 | 45 | # The following targets only have a single job 46 | gen_job centos-fmt-clippy all 47 | gen_job all-features all 48 | gen_job test-docs all 49 | 50 | # Finally, we generate the conclusion, 51 | # adding all the `# job-name` jobs to the `needs` list. 52 | gen_job conclusion all 53 | cat "$INPATH"/*-template.yaml | perl -nE 'say " - $1" if (m/^\s*([\w-_]+)\s*:.*job-name.*$/)' >> "$OUTPATH" 54 | -------------------------------------------------------------------------------- /ci/actions-templates/test-docs-template.yaml: -------------------------------------------------------------------------------- 1 | jobs: # skip-all 2 | 3 | # This is ci/actions-templates/test-docs-templates.yaml 4 | # Do not edit this file in .github/workflows 5 | # 6 | # Builds docs for both stable and master branches. 7 | # stable is placed in the root of the gh-pages branch, while master is placed at /devel 8 | doc: # job-name 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v4 12 | with: 13 | fetch-depth: 0 14 | - name: Install mdbook 15 | uses: taiki-e/install-action@v2 16 | env: 17 | # renovate: datasource=crate depName=mdbook 18 | MDBOOK_VERSION: "0.4.43" 19 | with: 20 | tool: mdbook@${{ env.MDBOOK_VERSION }} 21 | - name: Build user-guide (stable) 22 | if: ${{ !contains('["pull_request", "merge_group"]', github.event_name) }} 23 | run: | 24 | git checkout stable 25 | # Support both old and new directory structure during the transition 26 | cd doc/user-guide || cd doc 27 | mdbook build 28 | mv book ${{ runner.temp }} 29 | - name: Build user-guide (master) 30 | run: | 31 | git checkout master 32 | cd doc/user-guide 33 | mdbook build 34 | mkdir -p ${{ runner.temp }}/book 35 | mv book ${{ runner.temp }}/book/devel 36 | - name: Build dev-guide (master) 37 | run: | 38 | git checkout master 39 | cd doc/dev-guide 40 | mdbook build 41 | mkdir -p ${{ runner.temp }}/book 42 | mv book ${{ runner.temp }}/book/dev-guide 43 | - name: Deploy to GitHub 44 | if: ${{ !contains('["pull_request", "merge_group"]', github.event_name) }} 45 | run: | 46 | cd ${{ runner.temp }}/book 47 | git init 48 | git config user.name "Deploy from CI" 49 | git config user.email "" 50 | git add . .nojekyll 51 | git commit -m "Deploy $GITHUB_REF $GITHUB_SHA to gh-pages" 52 | git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY 53 | git push --force --set-upstream origin master:gh-pages 54 | -------------------------------------------------------------------------------- /ci/changelog_helper.py: -------------------------------------------------------------------------------- 1 | import json 2 | import re 3 | import subprocess 4 | import sys 5 | 6 | USAGE = """ 7 | Usage: 8 | python changelog_helper.py replace-nums CHANGELOG_MARKDOWN 9 | Replace Rustup PR numbers or links with `[pr#1234]`, moving the actual links to the bottom 10 | 11 | python changelog_helper.py usernames GITHUB_GENERATED_CHANGELOG 12 | Generate a Markdown list of contributors to be pasted below the line `Thanks go to:` 13 | A logged-in GitHub CLI (https://cli.github.com) is required for this subcommand 14 | For a GitHub-generated changelog, see https://github.com/rust-lang/rustup/releases/new 15 | """ 16 | 17 | BOTS = {"renovate": "Renovate Bot"} 18 | 19 | 20 | def extract_usernames(text): 21 | return sorted( 22 | set(re.findall(r"@([\w-]+)", text)), 23 | key=lambda name: (name in BOTS, str.casefold(name)), 24 | ) 25 | 26 | 27 | def github_name(username): 28 | # url = f"https://api.github.com/users/{username}" 29 | # response = urlopen(url) 30 | if username in BOTS: 31 | return BOTS[username] 32 | try: 33 | response = subprocess.check_output( 34 | [ 35 | "gh", 36 | "api", 37 | "-H", 38 | "Accept: application/vnd.github+json", 39 | "-H", 40 | "X-GitHub-Api-Version: 2022-11-28", 41 | f"/users/{username}", 42 | ] 43 | ) 44 | data = json.loads(response) 45 | return data["name"] or username 46 | except Exception as e: 47 | print("An error occurred:", str(e)) 48 | 49 | 50 | def read_file(file_name): 51 | try: 52 | with open(file_name, "r") as file: 53 | return file.read() 54 | except FileNotFoundError: 55 | print("File not found") 56 | except Exception as e: 57 | print("An error occurred:", str(e)) 58 | 59 | 60 | def help(): 61 | print(USAGE) 62 | sys.exit(1) 63 | 64 | 65 | def main(): 66 | if len(sys.argv) < 3: 67 | help() 68 | 69 | _, subcmd, file_name = sys.argv[:3] 70 | 71 | if subcmd == "usernames": 72 | content = read_file(file_name) 73 | if not content: 74 | return 75 | for username in extract_usernames(content): 76 | print(f"- {github_name(username)} ({username})") 77 | elif subcmd == "replace-nums": 78 | content = read_file(file_name) 79 | footer = "" 80 | if not content: 81 | return 82 | issue_pat = r"(#|https://github\.com/rust-lang/rustup/pull/)(\d+)" 83 | for prefix, num in re.findall(issue_pat, content): 84 | link = f"[pr#{num}]" 85 | footer += f"{link}: https://github.com/rust-lang/rustup/pull/{num}\n" 86 | content = content.replace(prefix + num, link) 87 | print(f"{content}\n{footer}") 88 | else: 89 | help() 90 | 91 | 92 | if __name__ == "__main__": 93 | main() 94 | -------------------------------------------------------------------------------- /ci/cloudfront-invalidation.txt: -------------------------------------------------------------------------------- 1 | rustup/* 2 | rustup/www/* 3 | rustup/stable-release.toml 4 | rustup/dist/aarch64-apple-darwin/rustup-init 5 | rustup/dist/aarch64-apple-darwin/rustup-init.sha256 6 | rustup/dist/aarch64-linux-android/rustup-init 7 | rustup/dist/aarch64-linux-android/rustup-init.sha256 8 | rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe 9 | rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe.sha256 10 | rustup/dist/aarch64-unknown-linux-gnu/rustup-init 11 | rustup/dist/aarch64-unknown-linux-gnu/rustup-init.sha256 12 | rustup/dist/aarch64-unknown-linux-musl/rustup-init 13 | rustup/dist/aarch64-unknown-linux-musl/rustup-init.sha256 14 | rustup/dist/arm-linux-androideabi/rustup-init 15 | rustup/dist/arm-linux-androideabi/rustup-init.sha256 16 | rustup/dist/arm-unknown-linux-gnueabi/rustup-init 17 | rustup/dist/arm-unknown-linux-gnueabi/rustup-init.sha256 18 | rustup/dist/arm-unknown-linux-gnueabihf/rustup-init 19 | rustup/dist/arm-unknown-linux-gnueabihf/rustup-init.sha256 20 | rustup/dist/armv7-linux-androideabi/rustup-init 21 | rustup/dist/armv7-linux-androideabi/rustup-init.sha256 22 | rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init 23 | rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init.sha256 24 | rustup/dist/i686-apple-darwin/rustup-init 25 | rustup/dist/i686-apple-darwin/rustup-init.sha256 26 | rustup/dist/i686-linux-android/rustup-init 27 | rustup/dist/i686-linux-android/rustup-init.sha256 28 | rustup/dist/i686-pc-windows-gnu/rustup-init.exe 29 | rustup/dist/i686-pc-windows-gnu/rustup-init.exe.sha256 30 | rustup/dist/i686-pc-windows-msvc/rustup-init.exe 31 | rustup/dist/i686-pc-windows-msvc/rustup-init.exe.sha256 32 | rustup/dist/i686-unknown-linux-gnu/rustup-init 33 | rustup/dist/i686-unknown-linux-gnu/rustup-init.sha256 34 | rustup/dist/loongarch64-unknown-linux-gnu/rustup-init 35 | rustup/dist/loongarch64-unknown-linux-gnu/rustup-init.sha256 36 | rustup/dist/loongarch64-unknown-linux-musl/rustup-init 37 | rustup/dist/loongarch64-unknown-linux-musl/rustup-init.sha256 38 | rustup/dist/mips-unknown-linux-gnu/rustup-init 39 | rustup/dist/mips-unknown-linux-gnu/rustup-init.sha256 40 | rustup/dist/mips64-unknown-linux-gnuabi64/rustup-init 41 | rustup/dist/mips64-unknown-linux-gnuabi64/rustup-init.sha256 42 | rustup/dist/mips64el-unknown-linux-gnuabi64/rustup-init 43 | rustup/dist/mips64el-unknown-linux-gnuabi64/rustup-init.sha256 44 | rustup/dist/mipsel-unknown-linux-gnu/rustup-init 45 | rustup/dist/mipsel-unknown-linux-gnu/rustup-init.sha256 46 | rustup/dist/powerpc-unknown-linux-gnu/rustup-init 47 | rustup/dist/powerpc-unknown-linux-gnu/rustup-init.sha256 48 | rustup/dist/powerpc64-unknown-linux-gnu/rustup-init 49 | rustup/dist/powerpc64-unknown-linux-gnu/rustup-init.sha256 50 | rustup/dist/powerpc64le-unknown-linux-gnu/rustup-init 51 | rustup/dist/powerpc64le-unknown-linux-gnu/rustup-init.sha256 52 | rustup/dist/powerpc64le-unknown-linux-musl/rustup-init 53 | rustup/dist/powerpc64le-unknown-linux-musl/rustup-init.sha256 54 | rustup/dist/s390x-unknown-linux-gnu/rustup-init 55 | rustup/dist/s390x-unknown-linux-gnu/rustup-init.sha256 56 | rustup/dist/x86_64-apple-darwin/rustup-init 57 | rustup/dist/x86_64-apple-darwin/rustup-init.sha256 58 | rustup/dist/x86_64-linux-android/rustup-init 59 | rustup/dist/x86_64-linux-android/rustup-init.sha256 60 | rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe 61 | rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe.sha256 62 | rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe 63 | rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe.sha256 64 | rustup/dist/x86_64-unknown-freebsd/rustup-init 65 | rustup/dist/x86_64-unknown-freebsd/rustup-init.sha256 66 | rustup/dist/x86_64-unknown-illumos/rustup-init 67 | rustup/dist/x86_64-unknown-illumos/rustup-init.sha256 68 | rustup/dist/x86_64-unknown-linux-gnu/rustup-init 69 | rustup/dist/x86_64-unknown-linux-gnu/rustup-init.sha256 70 | rustup/dist/x86_64-unknown-linux-musl/rustup-init 71 | rustup/dist/x86_64-unknown-linux-musl/rustup-init.sha256 72 | rustup/dist/x86_64-unknown-netbsd/rustup-init 73 | rustup/dist/x86_64-unknown-netbsd/rustup-init.sha256 74 | -------------------------------------------------------------------------------- /ci/deploy.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script is used to do rustup releases. It requires an AWS access token 3 | # allowed to update our S3 buckets and to invalidate CloudFront distributions. 4 | # 5 | # Usage: 6 | # 7 | # 1. Deploy the release on the dev environment: 8 | # ./deploy.bash dev VERSION_NUMBER 9 | # 10 | # 2. Test everything works correctly: 11 | # RUSTUP_UPDATE_ROOT=https://dev-static.rust-lang.org/rustup rustup self update 12 | # 13 | # 3. Deploy the release to the prod environment: 14 | # ./deploy.bash prod VERSION_NUMBER 15 | 16 | set -euo pipefail 17 | IFS=$'\n\t' 18 | 19 | CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )" 20 | LOCAL_RUSTUP_DIR="local-rustup" 21 | 22 | usage() { 23 | echo "usage: $0 {dev,prod} " 24 | exit 1 25 | } 26 | 27 | run() { 28 | python3 "${CI_DIR}/sync-dist.py" "$@" --live-run 29 | } 30 | 31 | if [[ $# -ne 2 ]]; then 32 | usage 33 | fi 34 | mode="$1" 35 | version="$2" 36 | 37 | case "${mode}" in 38 | dev) 39 | # Ask for confirmation before clearing the local directory 40 | if [[ -e "${LOCAL_RUSTUP_DIR}" ]]; then 41 | read -rp "The directory ${LOCAL_RUSTUP_DIR} will be removed. Continue (y/n)?" choice 42 | case "${choice}" in 43 | y|Y) 44 | rm -rf "${LOCAL_RUSTUP_DIR}" 45 | ;; 46 | *) 47 | echo "Exiting..." 48 | exit 0 49 | esac 50 | fi 51 | 52 | run dev-to-local 53 | run local-to-dev-archives "${version}" 54 | run update-dev-release "${version}" 55 | ;; 56 | prod) 57 | run local-to-prod-archives "${version}" 58 | run local-to-prod 59 | run update-prod-release "${version}" 60 | ;; 61 | *) 62 | usage 63 | ;; 64 | esac 65 | -------------------------------------------------------------------------------- /ci/docker/aarch64-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-aarch64-unknown-linux-gnu 2 | -------------------------------------------------------------------------------- /ci/docker/aarch64-unknown-linux-musl/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-aarch64-unknown-linux-musl 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_aarch64_unknown_linux_musl=aarch64-linux-musl-gcc \ 8 | CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-musl-gcc \ 9 | RUSTFLAGS="-C target-feature=+crt-static -C link-arg=-lgcc" 10 | -------------------------------------------------------------------------------- /ci/docker/android/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-android 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV PATH=$PATH:/android/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin \ 8 | ANDROID_NDK=/android/ndk/ \ 9 | AR_arm_linux_androideabi=llvm-ar \ 10 | AR_armv7_linux_androideabi=llvm-ar \ 11 | AR_aarch64_linux_android=llvm-ar \ 12 | AR_i686_linux_android=llvm-ar \ 13 | AR_x86_64_linux_android=llvm-ar \ 14 | RANLIB_arm_linux_androideabi=llvm-ranlib \ 15 | RANLIB_armv7_linux_androideabi=llvm-ranlib \ 16 | RANLIB_aarch64_linux_android=llvm-ranlib \ 17 | RANLIB_i686_linux_android=llvm-ranlib \ 18 | RANLIB_x86_64_linux_android=llvm-ranlib \ 19 | CC_arm_linux_androideabi=armv7a-linux-androideabi23-clang \ 20 | CC_armv7_linux_androideabi=armv7a-linux-androideabi23-clang \ 21 | CC_aarch64_linux_android=aarch64-linux-android23-clang \ 22 | CC_i686_linux_android=i686-linux-android23-clang \ 23 | CC_x86_64_linux_android=x86_64-linux-android23-clang \ 24 | CXX_arm_linux_androideabi=armv7a-linux-androideabi23-clang++ \ 25 | CXX_armv7_linux_androideabi=armv7a-linux-androideabi23-clang++ \ 26 | CXX_aarch64_linux_android=aarch64-linux-android23-clang++ \ 27 | CXX_i686_linux_android=i686-linux-android23-clang++ \ 28 | CXX_x86_64_linux_android=x86_64-linux-android23-clang++ \ 29 | CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi23-clang \ 30 | CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi23-clang \ 31 | CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android23-clang \ 32 | CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android23-clang \ 33 | CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android23-clang 34 | -------------------------------------------------------------------------------- /ci/docker/arm-unknown-linux-gnueabi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-arm-unknown-linux-gnueabi 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-gcc \ 8 | CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-unknown-linux-gnueabi-gcc 9 | -------------------------------------------------------------------------------- /ci/docker/arm-unknown-linux-gnueabihf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-arm-unknown-linux-gnueabihf 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \ 8 | CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-unknown-linux-gnueabihf-gcc 9 | -------------------------------------------------------------------------------- /ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-armv7-unknown-linux-gnueabihf 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \ 8 | CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=armv7-unknown-linux-gnueabihf-gcc 9 | -------------------------------------------------------------------------------- /ci/docker/i686-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-i686-unknown-linux-gnu 2 | 3 | # Install `perl-IPC-Cmd` to make OpenSSL v3 happy. 4 | # See: 5 | RUN yum upgrade -y && \ 6 | yum install -y perl-IPC-Cmd \ 7 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 8 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 9 | glibc-devel.i686 clang-libs 10 | -------------------------------------------------------------------------------- /ci/docker/loongarch64-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-loongarch64-unknown-linux-gnu 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-gcc \ 8 | CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER=loongarch64-unknown-linux-gnu-gcc 9 | -------------------------------------------------------------------------------- /ci/docker/loongarch64-unknown-linux-musl/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-loongarch64-unknown-linux-musl 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc \ 8 | CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=loongarch64-unknown-linux-musl-gcc 9 | -------------------------------------------------------------------------------- /ci/docker/mips-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-mips-unknown-linux-gnu 2 | 3 | ENV CC_mips_unknown_linux_gnu=mips-unknown-linux-gnu-gcc \ 4 | CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-unknown-linux-gnu-gcc 5 | -------------------------------------------------------------------------------- /ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-mips64-unknown-linux-gnuabi64 2 | 3 | ENV CC_mips64_unknown_linux_gnuabi64=mips64-unknown-linux-gnu-gcc \ 4 | CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-unknown-linux-gnu-gcc 5 | -------------------------------------------------------------------------------- /ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-mips64el-unknown-linux-gnuabi64 2 | 3 | ENV CC_mips64el_unknown_linux_gnuabi64=mips64el-unknown-linux-gnu-gcc \ 4 | CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_LINKER=mips64el-unknown-linux-gnu-gcc 5 | -------------------------------------------------------------------------------- /ci/docker/mipsel-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-mipsel-unknown-linux-gnu 2 | 3 | ENV CC_mipsel_unknown_linux_gnu=mipsel-unknown-linux-gnu-gcc \ 4 | CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-unknown-linux-gnu-gcc 5 | -------------------------------------------------------------------------------- /ci/docker/powerpc-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-powerpc-unknown-linux-gnu 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-gcc \ 8 | CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-unknown-linux-gnu-gcc 9 | -------------------------------------------------------------------------------- /ci/docker/powerpc64-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-powerpc64-unknown-linux-gnu 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-gcc \ 8 | CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-unknown-linux-gnu-gcc 9 | -------------------------------------------------------------------------------- /ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-powerpc64le-unknown-linux-gnu 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \ 8 | CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc 9 | -------------------------------------------------------------------------------- /ci/docker/powerpc64le-unknown-linux-musl/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-powerpc64le-unknown-linux-musl 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_powerpc64le_unknown_linux_musl=powerpc64le-unknown-linux-musl-gcc \ 8 | CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_MUSL_LINKER=powerpc64le-unknown-linux-musl-gcc \ 9 | RUSTFLAGS="-C target-feature=+crt-static -C link-arg=-lgcc" -------------------------------------------------------------------------------- /ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-riscv64gc-unknown-linux-gnu 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-gcc \ 8 | CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER=riscv64-unknown-linux-gnu-gcc 9 | -------------------------------------------------------------------------------- /ci/docker/s390x-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-s390x-unknown-linux-gnu 2 | 3 | # Building `aws-lc-rs` for Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-gcc \ 8 | CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-ibm-linux-gnu-gcc 9 | -------------------------------------------------------------------------------- /ci/docker/scripts/sccache.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -xe 3 | 4 | VERSION=0.2.12 5 | TARGET=x86_64-unknown-linux-musl 6 | # from https://github.com/mozilla/sccache/releases 7 | SHA="26fd04c1273952cc2a0f359a71c8a1857137f0ee3634058b3f4a63b69fc8eb7f" 8 | DL_URL="https://github.com/mozilla/sccache/releases/download" 9 | BIN_DIR=/usr/local/bin 10 | TEMP_DIR=$(mktemp -d) 11 | TAR_NAME="sccache-${VERSION}-${TARGET}.tar.gz" 12 | 13 | cd "${TEMP_DIR}" 14 | mkdir -p "${BIN_DIR}" 15 | 16 | curl -sSL -O "${DL_URL}/${VERSION}/${TAR_NAME}" 17 | echo "${SHA} ${TAR_NAME}" | sha256sum --check - 18 | tar -xzf "${TAR_NAME}" --strip-components 1 19 | cp sccache "${BIN_DIR}/sccache" 20 | chmod +x "${BIN_DIR}/sccache" 21 | -------------------------------------------------------------------------------- /ci/docker/x86_64-unknown-freebsd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-x86_64-unknown-freebsd 2 | 3 | # Building `aws-lc-rs` for FreeBSD on Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-clang \ 8 | CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd12-clang 9 | -------------------------------------------------------------------------------- /ci/docker/x86_64-unknown-illumos/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-x86_64-unknown-illumos 2 | 3 | # Building `aws-lc-rs` for Illumos on Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV \ 8 | AR_x86_64_unknown_illumos="x86_64-illumos-ar" \ 9 | RANLIB_x86_64_unknown_illumos="x86_64-illumos-ranlib" \ 10 | CC_x86_64_unknown_illumos=x86_64-illumos-gcc \ 11 | CXX_x86_64_unknown_illumos=x86_64-illumos-g++ \ 12 | CARGO_TARGET_X86_64_UNKNOWN_ILLUMOS_LINKER=x86_64-illumos-gcc 13 | -------------------------------------------------------------------------------- /ci/docker/x86_64-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-x86_64-unknown-linux-gnu 2 | 3 | # Install `perl-IPC-Cmd` to make OpenSSL v3 happy. 4 | # See: 5 | RUN yum upgrade -y && \ 6 | yum install -y perl-IPC-Cmd 7 | -------------------------------------------------------------------------------- /ci/docker/x86_64-unknown-linux-musl/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:24.04 2 | 3 | COPY ci/docker/scripts/sccache.bash /scripts/ 4 | 5 | RUN \ 6 | apt-get update && \ 7 | apt-get install -qy \ 8 | musl-dev \ 9 | musl-tools \ 10 | curl \ 11 | ca-certificates \ 12 | perl \ 13 | make \ 14 | gcc && \ 15 | bash /scripts/sccache.bash 16 | -------------------------------------------------------------------------------- /ci/docker/x86_64-unknown-netbsd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust-x86_64-unknown-netbsd 2 | 3 | # Building `aws-lc-rs` for NetBSD on Linux depends on `gcc-multilib`, `libclang` and `bindgen`. 4 | # See: https://aws.github.io/aws-lc-rs/requirements/linux 5 | RUN apt-get update && apt-get install -qy gcc-multilib libclang-dev 6 | 7 | ENV CARGO_TARGET_X86_64_UNKNOWN_NETBSD_LINKER=x86_64--netbsd-gcc-sysroot 8 | -------------------------------------------------------------------------------- /ci/fetch-rust-docker.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | script_dir=$(cd "$(dirname "$0")" && pwd) 4 | # shellcheck source=ci/shared.bash 5 | . "$script_dir/shared.bash" 6 | 7 | set -e 8 | # Disable cause it makes shared script not to work properly 9 | #set -x 10 | 11 | TARGET="$1" 12 | 13 | RUST_REPO="https://github.com/rust-lang/rust" 14 | ARTIFACTS_BASE_URL="https://ci-artifacts.rust-lang.org/rustc-builds" 15 | 16 | # A `Dockerfile` under `rustup`'s `ci/docker` directory may start with `FROM rust-$TARGET`. 17 | # This means it is using a Docker image fetched from a container registry provided by `rustc`'s CI. 18 | LOCAL_DOCKER_TAG="rust-$TARGET" 19 | # The following is a mapping from `$TARGET`s to cached Docker images built from `Dockerfile`s under 20 | # , 21 | # e.g. `FROM rust-aarch64-unknown-linux-musl` means the base `Dockerfile` to look at is located under 22 | # . 23 | case "$TARGET" in 24 | aarch64-unknown-linux-gnu) image=dist-aarch64-linux ;; 25 | aarch64-unknown-linux-musl) image=dist-arm-linux ;; 26 | arm-unknown-linux-gnueabi) image=dist-arm-linux ;; 27 | arm-unknown-linux-gnueabihf) image=dist-armhf-linux ;; 28 | armv7-unknown-linux-gnueabihf) image=dist-armv7-linux ;; 29 | i686-unknown-linux-gnu) image=dist-i686-linux ;; 30 | *-linux-android*) image=dist-android; LOCAL_DOCKER_TAG=rust-android ;; 31 | mips-unknown-linux-gnu) image=dist-mips-linux ;; 32 | mips64-unknown-linux-gnuabi64) image=dist-mips64-linux ;; 33 | mips64el-unknown-linux-gnuabi64) image=dist-mips64el-linux ;; 34 | mipsel-unknown-linux-gnu) image=dist-mipsel-linux ;; 35 | powerpc-unknown-linux-gnu) image=dist-powerpc-linux ;; 36 | powerpc64-unknown-linux-gnu) image=dist-powerpc64-linux ;; 37 | powerpc64le-unknown-linux-gnu) image=dist-powerpc64le-linux ;; 38 | powerpc64le-unknown-linux-musl) image=dist-powerpc64le-linux ;; 39 | s390x-unknown-linux-gnu) image=dist-s390x-linux ;; 40 | x86_64-unknown-freebsd) image=dist-x86_64-freebsd ;; 41 | x86_64-unknown-illumos) image=dist-x86_64-illumos ;; 42 | x86_64-unknown-linux-gnu) image=dist-x86_64-linux ;; 43 | x86_64-unknown-netbsd) image=dist-x86_64-netbsd ;; 44 | riscv64gc-unknown-linux-gnu) image=dist-riscv64-linux ;; 45 | loongarch64-unknown-linux-gnu) image=dist-loongarch64-linux ;; 46 | loongarch64-unknown-linux-musl) image=dist-loongarch64-musl ;; 47 | *) exit ;; 48 | esac 49 | 50 | master=$(git ls-remote "$RUST_REPO" refs/heads/master | cut -f1) 51 | image_url="$ARTIFACTS_BASE_URL/$master/image-$image.txt" 52 | info="/tmp/image-$image.txt" 53 | 54 | rm -f "$info" 55 | curl -o "$info" "$image_url" 56 | 57 | if [ -z "$(docker images -q "${LOCAL_DOCKER_TAG}")" ]; then 58 | set -e 59 | image_tag=$(cat $info) 60 | echo "Attempting to pull image ${image_tag}" 61 | docker pull "${image_tag}" 62 | docker tag "${image_tag}" "${LOCAL_DOCKER_TAG}" 63 | fi 64 | -------------------------------------------------------------------------------- /ci/freebsd/script.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | # First, we check that this script is not run as root because it would fail tests. 6 | if [ "root" == "$(whoami)" ]; then exit 1; fi 7 | 8 | echo "=========" 9 | echo "Display the current git status" 10 | 11 | git status 12 | git tag --list 13 | git describe 14 | 15 | echo "=========" 16 | echo "Prep cargo dirs" 17 | 18 | mkdir -p ~/.cargo/{registry,git} 19 | 20 | echo "=========" 21 | echo "Install Rustup using ./rustup-init.sh" 22 | 23 | sh rustup-init.sh --default-toolchain=stable --profile=minimal -y 24 | # It's the equivalent of `source` 25 | # shellcheck source=src/cli/self_update/env.sh 26 | source "$HOME"/.cargo/env 27 | 28 | echo "=========" 29 | echo "Ensure we have the components we need" 30 | 31 | rustup component add rustfmt 32 | rustup component add clippy 33 | 34 | echo "=========" 35 | echo "Run the freebsd check" 36 | 37 | unset SKIP_TESTS 38 | export LIBZ_SYS_STATIC=1 39 | export CARGO_BUILD_JOBS=1 40 | export TARGET="x86_64-unknown-freebsd" 41 | # TODO: This should be split into two as the other jobs are. 42 | export BUILD_PROFILE="release" 43 | 44 | # HACK: Works around `aws-lc-rs`' issue with internal bindgen on FreeBSD. 45 | # See: https://github.com/aws/aws-lc-rs/issues/476#issuecomment-2263118015 46 | export AWS_LC_SYS_EXTERNAL_BINDGEN=1 47 | 48 | bash ci/run.bash 49 | -------------------------------------------------------------------------------- /ci/prepare-deploy.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -u -e 4 | 5 | # Copy rustup-init to rustup-setup for backwards compatibility 6 | cp target/"$TARGET"/release/rustup-init target/"$TARGET"/release/rustup-setup 7 | 8 | # Generate hashes 9 | pushd target/"$TARGET"/release/ 10 | if [ "$(uname -s)" = "Darwin" ]; then 11 | find . -maxdepth 1 -type f -exec sh -c 'fn="$1"; shasum -a 256 -b "$fn" > "$fn".sha256' sh {} \; 12 | else 13 | find . -maxdepth 1 -type f -exec sh -c 'fn="$1"; sha256sum -b "$fn" > "$fn".sha256' sh {} \; 14 | fi 15 | popd 16 | 17 | # The directory for deployment artifacts 18 | dest="deploy" 19 | 20 | # Prepare bins for upload 21 | bindest="$dest/dist/$TARGET" 22 | mkdir -p "$bindest/" 23 | cp target/"$TARGET"/release/rustup-init "$bindest/" 24 | cp target/"$TARGET"/release/rustup-init.sha256 "$bindest/" 25 | cp target/"$TARGET"/release/rustup-setup "$bindest/" 26 | cp target/"$TARGET"/release/rustup-setup.sha256 "$bindest/" 27 | 28 | if [ "$TARGET" != "x86_64-unknown-linux-gnu" ]; then 29 | exit 0 30 | fi 31 | 32 | cp rustup-init.sh "$dest/" 33 | 34 | # Prepare website for upload 35 | cp -R www "$dest/www" 36 | -------------------------------------------------------------------------------- /ci/prepare-deploy.ps1: -------------------------------------------------------------------------------- 1 | 2 | # Copy rustup-init to rustup-setup for backwards compatibility 3 | cp target\${env:TARGET}\release\rustup-init.exe target\${env:TARGET}\release\rustup-setup.exe 4 | 5 | # Generate hashes 6 | Get-FileHash .\target\${env:TARGET}\release\* | ForEach-Object {[io.file]::WriteAllText($_.Path + ".sha256", $_.Hash.ToLower() + "`n")} 7 | 8 | # Prepare bins for upload 9 | $dest = "dist\$env:TARGET" 10 | md -Force "$dest" 11 | cp target\${env:TARGET}\release\rustup-init.exe "$dest/" 12 | cp target\${env:TARGET}\release\rustup-init.exe.sha256 "$dest/" 13 | cp target\${env:TARGET}\release\rustup-setup.exe "$dest/" 14 | cp target\${env:TARGET}\release\rustup-setup.exe.sha256 "$dest/" 15 | 16 | ls "$dest" 17 | -------------------------------------------------------------------------------- /ci/raw_init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | 5 | sh ./rustup-init.sh --default-toolchain none -y 6 | # shellcheck source=src/cli/self_update/env.sh 7 | . "$HOME"/.cargo/env 8 | rustup -Vv 9 | -------------------------------------------------------------------------------- /ci/run.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | export RUST_BACKTRACE=1 6 | 7 | rustc -vV 8 | cargo -vV 9 | 10 | if [ -n "$INSTALL_BINDGEN" ]; then 11 | if ! curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rust-lang/rust-bindgen/releases/latest/download/bindgen-cli-installer.sh | sh -s -- --no-modify-path \ 12 | | grep "everything's installed!"; 13 | # Ignoring exit code since the script might fail to write the receipt after a successful installation. 14 | then 15 | cargo install --force --locked bindgen-cli 16 | fi 17 | mkdir "$CARGO_HOME"/bin/bindgen-cli 18 | mv "$CARGO_HOME"/bin/bindgen "$CARGO_HOME"/bin/bindgen-cli/ 19 | export PATH="$CARGO_HOME/bin/bindgen-cli:$PATH" 20 | fi 21 | 22 | 23 | FEATURES=('--no-default-features' '--features' 'curl-backend,reqwest-native-tls') 24 | case "$(uname -s)" in 25 | *NT* ) ;; # Windows NT 26 | * ) FEATURES+=('--features' 'vendored-openssl') ;; 27 | esac 28 | 29 | case "$TARGET" in 30 | # these platforms aren't supported by aws-lc-rs: 31 | powerpc64* ) ;; 32 | mips* ) ;; 33 | loongarch* ) ;; 34 | *netbsd* ) ;; 35 | *illumos* ) ;; 36 | # default case, build with rustls enabled 37 | * ) FEATURES+=('--features' 'reqwest-rustls-tls') ;; 38 | esac 39 | 40 | # rustc only supports armv7: https://doc.rust-lang.org/nightly/rustc/platform-support.html 41 | if [ "$TARGET" = arm-linux-androideabi ]; then 42 | export CFLAGS='-march=armv7' 43 | fi 44 | 45 | target_cargo() { 46 | cmd="$1" 47 | shift 48 | cargo "${cmd}" --locked --profile "$BUILD_PROFILE" --target "$TARGET" "${FEATURES[@]}" "$@" 49 | } 50 | 51 | target_cargo build 52 | 53 | # Machines have 7GB of RAM, and our target/ contents is large enough that 54 | # thrashing will occur if we build-run-build-run rather than 55 | # build-build-build-run-run-run. Since this is used solely for non-release 56 | # artifacts, we try to keep features consistent across the builds, whether for 57 | # docs/test/runs etc. 58 | build_test() { 59 | cmd="$1" 60 | shift 61 | 62 | features=('--features' 'curl-backend,reqwest-native-tls') 63 | case "$TARGET" in 64 | # these platforms aren't supported by aws-lc-rs: 65 | powerpc* ) ;; 66 | mips* ) ;; 67 | riscv* ) ;; 68 | s390x* ) ;; 69 | # default case, build with rustls enabled 70 | * ) features+=('--features' 'reqwest-rustls-tls') ;; 71 | esac 72 | 73 | if [ "build" = "${cmd}" ]; then 74 | target_cargo "${cmd}" --workspace --all-targets "${features[@]}" --features test 75 | else 76 | target_cargo "${cmd}" --workspace "${features[@]}" --features test --tests 77 | target_cargo "${cmd}" --doc --workspace "${features[@]}" --features test 78 | fi 79 | } 80 | 81 | if [ -z "$SKIP_TESTS" ]; then 82 | target_cargo run --features test -- --dump-testament 83 | build_test build 84 | RUSTUP_CI=1 build_test test 85 | fi 86 | -------------------------------------------------------------------------------- /ci/shared.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This file is intended to be sourced, so it is not being marked as 4 | # an executable file in git. 5 | 6 | # This is modified from 7 | # https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_setup_env.bash 8 | export ANSI_RED='\033[31;1m' 9 | export ANSI_GREEN='\033[32;1m' 10 | export ANSI_YELLOW='\033[33;1m' 11 | export ANSI_RESET='\033[0m' 12 | export ANSI_CLEAR='\033[0K' 13 | 14 | # This is modified loop version of 15 | # https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_retry.bash 16 | command_retry() { 17 | local result=0 18 | local count=1 19 | local max=5 20 | while [ "${count}" -le "${max}" ]; do 21 | [ "${result}" -ne 0 ] && { 22 | printf "${ANSI_RED}"'The command "%s" failed. Retrying, %s of %s.'"${ANSI_RESET}"'\n' "${*}" "${count}" "${max}" >&2 23 | } 24 | "${@}" && { result=0 && break; } || result="${?}" 25 | : $((count=count+1)) 26 | sleep 1 27 | done 28 | 29 | [ "${count}" -gt "${max}" ] && { 30 | printf "${ANSI_RED}"'The command "%s" failed %s times.'"${ANSI_RESET}"'\n' "${*}" "${max}" >&2 31 | } 32 | 33 | return "${result}" 34 | } 35 | 36 | -------------------------------------------------------------------------------- /doc/dev-guide/.gitignore: -------------------------------------------------------------------------------- 1 | book 2 | -------------------------------------------------------------------------------- /doc/dev-guide/README.md: -------------------------------------------------------------------------------- 1 | # rustup documentation 2 | 3 | This directory contains rustup's developer / contributing documentation. 4 | 5 | ## Building the book 6 | 7 | Building the book requires [mdBook](https://github.com/rust-lang/mdBook). To get it: 8 | 9 | ```console 10 | $ cargo install mdbook 11 | ``` 12 | 13 | To build the book: 14 | 15 | ```console 16 | $ mdbook build 17 | ``` 18 | 19 | `mdbook` provides a variety of different commands and options to help you work 20 | on the book: 21 | 22 | * `mdbook build --open`: Build the book and open it in a web browser. 23 | * `mdbook serve`: Launches a web server on localhost. It also automatically 24 | rebuilds the book whenever any file changes and automatically reloads your 25 | web browser. 26 | 27 | The book contents are driven by the [`SUMMARY.md`](src/SUMMARY.md) file, and 28 | every file must be linked there. 29 | -------------------------------------------------------------------------------- /doc/dev-guide/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | authors = ["The Rust Project Developers"] 3 | language = "en" 4 | multilingual = false 5 | src = "src" 6 | title = "The Rustup developer guide" 7 | 8 | [output.html] 9 | curly-quotes = true 10 | edit-url-template = "https://github.com/rust-lang/rustup/edit/master/doc/dev-guide/{path}" 11 | git-repository-url = "https://github.com/rust-lang/rustup/tree/master/doc/dev-guide" 12 | site-url = "https://rust-lang.github.io/rustup/dev-guide" 13 | -------------------------------------------------------------------------------- /doc/dev-guide/src/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | - [Introduction](index.md) 4 | - [Linting](linting.md) 5 | - [Coding standards](coding-standards.md) 6 | - [Version numbers](version-numbers.md) 7 | - [Release process](release-process.md) 8 | - [Tips and tricks](tips-and-tricks.md) 9 | - [Tracing](tracing.md) -------------------------------------------------------------------------------- /doc/dev-guide/src/coding-standards.md: -------------------------------------------------------------------------------- 1 | # Coding standards 2 | 3 | Generally we just follow good sensible Rust practices, clippy and so forth. 4 | However there are some practices we've agreed on that are not machine-enforced; 5 | meeting those requirements in a PR will make it easier to merge. 6 | 7 | ## Atomic commits 8 | 9 | We use atomic commits across the repo. Each commit should represent a single unit of change. 10 | You can read more about atomic commits [here](https://www.aleksandrhovhannisyan.com/blog/atomic-git-commits). 11 | 12 | ## Import grouping 13 | 14 | In each file the imports should be grouped into at most 4 groups in the 15 | following order: 16 | 17 | 1. stdlib 18 | 2. non-repository local crates 19 | 3. repository local other crates 20 | 4. this crate 21 | 22 | Separate each group with a blank line, and rustfmt will sort into a canonical 23 | order. Any file that is not grouped like this can be rearranged whenever the 24 | file is touched - we're not precious about having it done in a separate commit, 25 | though that is helpful. 26 | 27 | ## No direct use of process state outside rustup::process 28 | 29 | The `rustup::process` module abstracts the global state that is 30 | `std::env::args`, `std::env::vars`, `std::io::std*` and `std::env::current_dir` 31 | permitting threaded tests of the CLI logic; use the relevant methods of the 32 | `rustup::process::Process` type rather than those APIs directly. 33 | Usually, a `process: &Process` variable will be available to you in the current context. 34 | For example, it could be in the form of a parameter of the current function, 35 | or a field of a `Cfg` instance, etc. 36 | 37 | ## Clippy lints 38 | 39 | We do not enforce lint status in the checks done by GitHub Actions, because 40 | clippy is a moving target that can make it hard to merge for little benefit. 41 | 42 | We do ask that contributors keep the clippy status clean themselves. 43 | 44 | Minimally, run `cargo clippy --all --all-targets --features test -- -D warnings` before 45 | submitting code. 46 | 47 | If possible, adding `--all-features` to the command is useful, but will require 48 | additional dependencies like `libcurl-dev`. 49 | 50 | Regular contributors or contributors to particularly OS-specific code should 51 | also make sure that their clippy checking is done on at least Linux and Windows, 52 | as OS-conditional code is a common source of unused imports and other small 53 | lints, which can build up over time. 54 | 55 | For developers using BSD/Linux/Mac OS, there are Windows VM's suitable for such 56 | development tasks for use with virtualbox and other hypervisors are downloadable 57 | from 58 | [Microsoft](https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/). 59 | Similarly, there are many Linux and Unix operating systems images available for 60 | developers whose usual operating system is Windows. Currently Rustup has no Mac 61 | OS specific code, so there should be no need to worry about Mac VM images. 62 | 63 | Clippy is also run in GitHub Actions, in the `General Checks / Checks` build 64 | task, but not currently run per-platform, which means there is no way to find 65 | out the status of clippy per platform without running it on that platform as a 66 | developer. 67 | -------------------------------------------------------------------------------- /doc/dev-guide/src/index.md: -------------------------------------------------------------------------------- 1 | # Contributing to rustup 2 | 3 | 1. Fork it! 4 | 2. Create your feature branch: `git checkout -b my-new-feature` 5 | 3. Test it: `cargo test --features=test` 6 | 4. [Lint it!](linting.md) 7 | 5. Commit your changes: `git commit -am 'Add some feature'` 8 | 6. Push to the branch: `git push origin my-new-feature` 9 | 7. Submit a pull request :D 10 | 11 | For developing on `rustup` itself, you may want to install into a temporary 12 | directory, with a series of commands similar to this: 13 | 14 | ```bash 15 | cargo build 16 | mkdir home 17 | RUSTUP_HOME=home CARGO_HOME=home target/debug/rustup-init --no-modify-path -y 18 | ``` 19 | 20 | You can then try out `rustup` with your changes by running `home/bin/rustup`, without 21 | affecting any existing installation. Remember to keep those two environment variables 22 | set when running your compiled `rustup-init` or the toolchains it installs, but _unset_ 23 | when rebuilding `rustup` itself. 24 | 25 | If you wish to install your new build to try out longer term in your home directory 26 | then you can run `cargo dev-install` which is an alias in `.cargo/config` which 27 | runs `cargo run -- --no-modify-path -y` to install your build into your homedir. 28 | 29 | We use `rustfmt` to keep our codebase consistently formatted. Please ensure that 30 | you have correctly formatted your code (most editors will do this automatically 31 | when saving) or it may not pass the CI tests. 32 | 33 | If you are moving, renaming or removing an existing mdBook page, please use mdBook's 34 | [`output.html.redirect`] feature to ensure that the old URL gets redirected. 35 | 36 | [`output.html.redirect`]: https://rust-lang.github.io/mdBook/format/configuration/renderers.html#outputhtmlredirect 37 | 38 | Unless you explicitly state otherwise, any contribution intentionally 39 | submitted for inclusion in the work by you, as defined in the 40 | Apache-2.0 license, shall be dual licensed as in the README, without any 41 | additional terms or conditions. 42 | -------------------------------------------------------------------------------- /doc/dev-guide/src/linting.md: -------------------------------------------------------------------------------- 1 | # Linting 2 | 3 | We use `cargo clippy` to ensure high-quality code and to enforce a set of best practices for Rust programming. 4 | However, not all lints provided by `cargo clippy` are relevant or applicable to our project. 5 | We may choose to ignore some lints if they are unstable, experimental, or specific to our project. 6 | If you are unsure about a lint, please ask us in the [rustup Discord channel](https://discord.com/channels/442252698964721669/463480252723888159). 7 | 8 | ## Manual linting 9 | 10 | When checking the codebase with [`clippy`](https://doc.rust-lang.org/stable/clippy/index.html), 11 | it is recommended to use the following command: 12 | 13 | ```console 14 | $ cargo clippy --all --all-targets --all-features -- -D warnings 15 | ``` 16 | 17 | Please note the `--all-features` flag: it is used because we need to enable the `test` feature 18 | to make lints fully work, for which `--all-features` happens to be a convenient shortcut. 19 | 20 | The `test` feature is required because `rustup` uses 21 | [cargo features](https://doc.rust-lang.org/cargo/reference/features.html) to 22 | [conditionally compile](https://doc.rust-lang.org/reference/conditional-compilation.html) 23 | support code for integration tests, as `#[cfg(test)]` is only available for unit tests. 24 | 25 | If you encounter an issue or wish to speed up the initial analysis, you could also try 26 | activating only the `test` feature by replacing `--all-features` with `--features=test`. 27 | 28 | ## Rust-Analyzer 29 | 30 | When checking the codebase using `rust-analyzer`, the first thing to do remains unchanged: 31 | enabling the features. 32 | 33 | This is done by setting the `rust-analyzer.cargo.features` property to `"all"`. 34 | 35 | For example, if you are using `rust-analyzer` within VSCode, you would want to 36 | add the following to your project's `.vscode/settings.json`[^vscode-global-cfg]: 37 | 38 | ```jsonc 39 | "rust-analyzer.cargo.features": "all", 40 | ``` 41 | 42 | [^vscode-global-cfg]: 43 | Alternatively, if you want to apply the configuration to all your Rust projects, 44 | you can add it to your global configuration at `~/.config/Code/User/settings.json` instead. 45 | 46 | Alternatively, if you want to enable the `test` feature only, you should set the 47 | following instead: 48 | 49 | ```jsonc 50 | "rust-analyzer.cargo.features": ["test"] 51 | ``` 52 | 53 | Next, as `rust-analyzer` depends on `cargo check` by default, it is also recommended to 54 | enable the `cargo clippy` integration by adding the following: 55 | 56 | ```jsonc 57 | "rust-analyzer.check.command": "clippy", 58 | ``` 59 | 60 | You might also want to refer to the 61 | [`rust-analyzer` manual](https://rust-analyzer.github.io/manual.html#configuration) 62 | for more details on properly setting up `rust-analyzer` in your IDE of choice. 63 | -------------------------------------------------------------------------------- /doc/dev-guide/src/release-process.md: -------------------------------------------------------------------------------- 1 | # Making a release 2 | 3 | Before making a release, ensure that `rustup-init.sh` is behaving correctly, 4 | and that you're satisfied that nothing in the ecosystem is breaking because 5 | of the update. A useful set of things to check includes verifying that 6 | real-world toolchains install okay, and that `rust-analyzer` isn't broken by 7 | the release. While it's not our responsibility if they depend on non-stable 8 | APIs, we should behave well if we can. 9 | 10 | As a maintainer, you have two options to choose from when cutting a new 11 | release: a beta release or an official release. 12 | The main difference between the two is that they use different values for 13 | the `RUSTUP_UPDATE_ROOT` environment variable: 14 | - A beta release is deployed on `https://dev-static.rust-lang.org/rustup`. 15 | - An official release is deployed on `https://static.rust-lang.org/rustup`. 16 | 17 | By switching between those two values, Rustup effectively provides two "self 18 | update channels", making beta testing possible with `rustup self update`. 19 | 20 | Producing the final release artifacts is a bit involved because of the way 21 | Rustup is distributed. 22 | Below is a list of things to be done in order to cut a new [b]eta release 23 | or an official [r]elease: 24 | 25 | 1. [b/r] In a separate PR: 26 | 1. If the version strings in `Cargo.toml`s haven't been updated: 27 | - Decide what the new version number `$VER_NUM` should be. 28 | > **Note:** We always increment the *minor* number unless: 29 | > - A major incompatibility has been introduced in this release: 30 | > increment the *major* number instead. 31 | > - This release is a hotfix because the last one had a defect: 32 | > increment the *patch* number instead. 33 | - Update `Cargo.toml` and `download/Cargo.toml` to have that same new 34 | version number, then run `cargo build` and review `Cargo.lock` changes. 35 | If all looks well, make a commit. 36 | 2. Update `CHANGELOG.md` accordingly if necessary. 37 | 2. [b/r] After merging the PR made in step 1, in a separate PR: 38 | 1. Update the commit shasum in `rustup-init.sh` to match the latest commit 39 | on `master`. 40 | 3. [b/r] After merging the PR made in step 2, sync `master` to `stable` using 41 | `--ff-only`: 42 | - `git fetch origin master:master` 43 | - `git checkout stable && git merge --ff-only master` 44 | - `git push origin HEAD:stable` 45 | 4. [b/r] While you wait for green CI on `stable`, double-check the 46 | functionality of `rustup-init.sh` and `rustup-init` just in case. 47 | 5. [b/r] Ensure all of CI is green on the `stable` branch. 48 | Once it is, check through a representative proportion of the builds looking 49 | for the reported version statements to ensure that 50 | we definitely built something cleanly which reports as the right version 51 | number when run `--version`. 52 | 6. [r] Make a new PR to the [Rust Blog] adding a new release announcement post. 53 | 7. [b/r] Ping someone in the release team to perform the actual release. 54 | They can find instructions in `ci/sync-dist.py`. 55 | > **Note:** Some manual testing occurs here, so hopefully they'll catch 56 | anything egregious in which case abort the change and roll back. 57 | 8. [b] Once the beta release has happened, post a new topic named "Seeking beta 58 | testers for Rustup $VER_NUM" on the [Internals Forum]. 59 | 9. [r] Once the official release has happened, prepare and push a tag on the 60 | latest `stable` commit. 61 | - `git tag -as $VER_NUM -m $VER_NUM` (optionally without `-s` if not GPG 62 | signing the tag) 63 | - `git push origin $VER_NUM` 64 | 65 | [Rust Blog]: https://github.com/rust-lang/blog.rust-lang.org 66 | [Internals Forum]: https://internals.rust-lang.org 67 | -------------------------------------------------------------------------------- /doc/dev-guide/src/version-numbers.md: -------------------------------------------------------------------------------- 1 | # Version numbers 2 | 3 | If you ever see a released version of rustup which has `::` in its version string 4 | then something went wrong with the CI and that needs to be addressed. 5 | 6 | We use `git-testament` to construct our version strings. This records, as a 7 | struct, details of the git commit, tag description, and also an indication 8 | of modifications to the working tree present when the binary was compiled. 9 | 10 | During normal development you may get information from invoking `rustup --version` 11 | which looks like `rustup-init 1.18.3+15 (a54051502 2019-05-26)` or even 12 | `rustup-init 1.18.3+15 (a54051502 2019-05-26) dirty 1 modification`. 13 | 14 | The first part is always the binary name as per `clap`'s normal operation. The 15 | version number is a combination of the most recent tag in the git repo, and the 16 | number of commits since that tag. The parenthesised information is, naturally, 17 | the SHA of the most recent commit and the date of that commit. If the indication 18 | of a dirty tree is present, the number of changes is indicated. This combines 19 | adds, deletes, modifies, and unknown entries. 20 | 21 | You can request further information of a `rustup` binary with the 22 | `rustup dump-testament` hidden command. It produces output of the form: 23 | 24 | ```shell 25 | $ rustup dump-testament 26 | Rustup version renders as: 1.18.3+15 (a54051502 2019-05-26) dirty 1 modification 27 | Current crate version: 1.18.3 28 | Built from branch: kinnison/version-strings 29 | Commit info: 1.18.3+15 (a54051502 2019-05-26) 30 | Modified: CONTRIBUTING.md 31 | ``` 32 | 33 | This can be handy when you are testing development versions on your PC 34 | and cannot remember exactly which version you had installed, or if you have given 35 | a development copy (or instruction to build such) to a user, and wish to have them 36 | confirm _exactly_ what they are using. 37 | 38 | Finally, we tell `git-testament` that we trust the `stable` branch to carry 39 | releases. If the build is being performed when not on the `stable` branch, and 40 | the tag and `CARGO_PKG_VERSION` differ, then the short version string will include 41 | both, in the form `rustup-init 1.18.3 :: 1.18.2+99 (a54051502 2019-05-26)` which 42 | indicates the crate version before the rest of the commit. 43 | On the other hand, if the build was on the `stable` branch then regardless 44 | of the tag information, providing the commit was clean, the version is 45 | always replaced by the crate version. The `dump-testament` hidden command can 46 | reveal the truth however. 47 | -------------------------------------------------------------------------------- /doc/user-guide/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore built book 2 | book/ 3 | -------------------------------------------------------------------------------- /doc/user-guide/README.md: -------------------------------------------------------------------------------- 1 | # rustup documentation 2 | 3 | This directory contains rustup's documentation. 4 | 5 | ## Building the book 6 | 7 | Building the book requires [mdBook](https://github.com/rust-lang/mdBook). To get it: 8 | 9 | ```console 10 | $ cargo install mdbook 11 | ``` 12 | 13 | To build the book: 14 | 15 | ```console 16 | $ mdbook build 17 | ``` 18 | 19 | `mdbook` provides a variety of different commands and options to help you work 20 | on the book: 21 | 22 | * `mdbook build --open`: Build the book and open it in a web browser. 23 | * `mdbook serve`: Launches a web server on localhost. It also automatically 24 | rebuilds the book whenever any file changes and automatically reloads your 25 | web browser. 26 | 27 | The book contents are driven by the [`SUMMARY.md`](src/SUMMARY.md) file, and 28 | every file must be linked there. 29 | -------------------------------------------------------------------------------- /doc/user-guide/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | authors = ["The Rust Project Developers"] 3 | title = "The rustup book" 4 | 5 | [output.html] 6 | curly-quotes = true 7 | edit-url-template = "https://github.com/rust-lang/rustup/edit/master/doc/user-guide/{path}" 8 | git-repository-url = "https://github.com/rust-lang/rustup/tree/master/doc/user-guide" 9 | site-url = "https://rust-lang.github.io/rustup/" 10 | 11 | [output.html.redirect] 12 | "/installation/package-managers.html" = "already-installed-rust.html" 13 | -------------------------------------------------------------------------------- /doc/user-guide/src/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | [Introduction](index.md) 4 | - [Installation](installation/index.md) 5 | - [Windows](installation/windows.md) 6 | - [MSVC prerequisites](installation/windows-msvc.md) 7 | - [Other installation methods](installation/other.md) 8 | - [Already installed Rust?](installation/already-installed-rust.md) 9 | - [Concepts](concepts/index.md) 10 | - [Channels](concepts/channels.md) 11 | - [Toolchains](concepts/toolchains.md) 12 | - [Components](concepts/components.md) 13 | - [Profiles](concepts/profiles.md) 14 | - [Proxies](concepts/proxies.md) 15 | - [Basic usage](basics.md) 16 | - [Overrides](overrides.md) 17 | - [Cross-compilation](cross-compilation.md) 18 | - [Environment variables](environment-variables.md) 19 | - [Configuration](configuration.md) 20 | - [Network proxies](network-proxies.md) 21 | - [Examples](examples.md) 22 | - [Security](security.md) 23 | - [FAQ](faq.md) 24 | -------------------------------------------------------------------------------- /doc/user-guide/src/basics.md: -------------------------------------------------------------------------------- 1 | # Basic usage 2 | 3 | ## Keeping Rust up to date 4 | 5 | Rust is distributed on three different [release channels]: stable, beta, and 6 | nightly. `rustup` uses the stable channel by default, which 7 | represents the latest release of Rust. Stable publishes new releases every six weeks. 8 | 9 | [release channels]: concepts/channels.md 10 | 11 | When a new version of Rust is released, simply type `rustup update` to update: 12 | 13 | ```console 14 | $ rustup update 15 | info: syncing channel updates for 'stable' 16 | info: downloading component 'rustc' 17 | info: downloading component 'rust-std' 18 | info: downloading component 'rust-docs' 19 | info: downloading component 'cargo' 20 | info: installing component 'rustc' 21 | info: installing component 'rust-std' 22 | info: installing component 'rust-docs' 23 | info: installing component 'cargo' 24 | info: checking for self-update 25 | info: downloading self-update 26 | 27 | stable updated: rustc 1.7.0 (a5d1e7a59 2016-02-29) 28 | 29 | ``` 30 | 31 | ## Keeping `rustup` up to date 32 | 33 | If your `rustup` was built with the [no-self-update feature](https://github.com/rust-lang/rustup/blob/master/Cargo.toml#L25), it can not update 34 | itself. This is not the default, and only versions of `rustup` built with 35 | `--no-default-features`, or obtained from a third-party distributor who has 36 | disabled it (such as NixOS). 37 | 38 | Otherwise Rustup can update itself. It is possible to control Rustup's automatic 39 | self update mechanism with the `auto-self-update` configuration variable. This 40 | setting supports three values: `enable` and `disable` and `check-only`. 41 | 42 | * `disable` will ensure that no automatic self updating actions are taken. 43 | * `enable` will mean that `rustup update` and similar commands will also check for, and install, any update to Rustup. 44 | * `check-only` will cause any automatic self update to check and report on any updates, but not to automatically install them. 45 | 46 | Whether `auto-self-update` is `enable` or not, you can request that Rustup 47 | update itself to the latest version of `rustup` by running `rustup self update`. 48 | This will not download new toolchains: 49 | 50 | ```console 51 | $ rustup self update 52 | info: checking for self-update 53 | info: downloading self-update 54 | ``` 55 | 56 | ### Disabling self updates on a per-invocation basis 57 | > Self updates can also be suppressed on individual invocations of `rustup` by 58 | > passing the argument `--no-self-update` when running `rustup update` or 59 | > `rustup toolchain install`. 60 | 61 | ## Help system 62 | 63 | The `rustup` command-line has a built-in help system that provides more 64 | information about each command. Run `rustup help` for an overview. Detailed 65 | help for each subcommand is also available. For example, run `rustup toolchain 66 | install --help` for specifics on installing [toolchains]. 67 | 68 | [toolchains]: concepts/toolchains.md 69 | 70 | -------------------------------------------------------------------------------- /doc/user-guide/src/concepts/index.md: -------------------------------------------------------------------------------- 1 | # Concepts 2 | 3 | ## How rustup works 4 | 5 | `rustup` is a *toolchain multiplexer*. It installs and manages many Rust 6 | toolchains and presents them all through a single set of tools installed to 7 | `~/.cargo/bin`. The [`rustc`] and [`cargo`] executables installed in 8 | `~/.cargo/bin` are *[proxies]* that delegate to the real toolchain. `rustup` 9 | then provides mechanisms to easily change the active toolchain by 10 | reconfiguring the behavior of the proxies. 11 | 12 | So when `rustup` is first installed, running `rustc` will run the proxy in 13 | `$HOME/.cargo/bin/rustc`, which in turn will run the stable compiler. If you 14 | later *change the default toolchain* to nightly with `rustup default nightly`, 15 | then that same proxy will run the `nightly` compiler instead. 16 | 17 | This is similar to Ruby's [rbenv], Python's [pyenv], or Node's [nvm]. 18 | 19 | [rbenv]: https://github.com/rbenv/rbenv 20 | [pyenv]: https://github.com/yyuu/pyenv 21 | [nvm]: https://github.com/creationix/nvm 22 | [`rustc`]: https://doc.rust-lang.org/rustc/ 23 | [`cargo`]: https://doc.rust-lang.org/cargo/ 24 | [proxies]: proxies.md 25 | 26 | ## Terminology 27 | 28 | * **channel** --- Rust is released to three different "channels": stable, beta, 29 | and nightly. See the [Channels] chapter for more details. 30 | 31 | * **toolchain** --- A "toolchain" is a complete installation of the Rust 32 | compiler (`rustc`) and related tools (like `cargo`). A [toolchain 33 | specification] includes the release channel or version, and the host 34 | platform that the toolchain runs on. 35 | 36 | * **target** --- `rustc` is capable of generating code for many platforms. The 37 | "target" specifies the platform that the code will be generated for. By 38 | default, `cargo` and `rustc` use the host toolchain's platform as the 39 | target. To build for a different target, usually the target's standard 40 | library needs to be installed first via the `rustup target` command. See the 41 | [Cross-compilation] chapter for more details. 42 | 43 | * **component** --- Each release of Rust includes several "components", some of 44 | which are required (like `rustc`) and some that are optional (like 45 | [`clippy`]). See the [Components] chapter for more detail. 46 | 47 | * **profile** --- In order to make it easier to work with components, a 48 | "profile" defines a grouping of components. See the [Profiles] chapter for 49 | more details. 50 | 51 | * **proxy** --- A wrapper for a common Rust component (like `rustc`), built to forward 52 | CLI invocations to the active Rust toolchain. See the [Proxies] chapter for more details. 53 | 54 | [`clippy`]: https://github.com/rust-lang/rust-clippy 55 | [components]: components.md 56 | [cross-compilation]: ../cross-compilation.md 57 | [profiles]: profiles.md 58 | [toolchain specification]: toolchains.md 59 | [channels]: channels.md 60 | [proxies]: proxies.md 61 | -------------------------------------------------------------------------------- /doc/user-guide/src/concepts/profiles.md: -------------------------------------------------------------------------------- 1 | # Profiles 2 | 3 | `rustup` has the concept of "profiles". They are groups of [components] you 4 | can choose to download while installing a new Rust toolchain. The profiles 5 | available at this time are `minimal`, `default`, and `complete`: 6 | 7 | * The **minimal** profile includes as few components as possible to get a 8 | working compiler (`rustc`, `rust-std`, and `cargo`). It's recommended to use 9 | this component on Windows systems if you don't use local documentation (the 10 | large number of files can cause issues with some Antivirus systems), and in 11 | CI. 12 | * The **default** profile includes all of components in the **minimal** 13 | profile, and adds `rust-docs`, `rustfmt`, and `clippy`. This profile will be 14 | used by `rustup` by default, and it's the one recommended for general use. 15 | * The **complete** profile includes all the components available through 16 | `rustup`. This should never be used, as it includes *every* component ever 17 | included in the metadata and thus will almost always fail. If you are 18 | looking for a way to install devtools such as `miri` or IDE integration 19 | tools (`rust-analyzer`), you should use the `default` profile and 20 | install the needed additional components manually, either by using `rustup 21 | component add` or by using `-c` when installing the toolchain. 22 | 23 | To change the profile `rustup install` uses by default, you can use the 24 | `rustup set profile` command. 25 | For example, to select the minimal profile you can use: 26 | 27 | ```console 28 | rustup set profile minimal 29 | ``` 30 | 31 | You can also directly select the profile used when installing a toolchain with: 32 | 33 | ```console 34 | rustup install --profile 35 | ``` 36 | 37 | It's also possible to choose the default profile when installing `rustup` for 38 | the first time, either interactively by choosing the "Customize installation" 39 | option or programmatically by passing the `--profile=` flag. Profiles 40 | will only affect newly installed toolchains: as usual it will be possible to 41 | install individual components later with: `rustup component add`. 42 | 43 | [components]: components.md 44 | -------------------------------------------------------------------------------- /doc/user-guide/src/concepts/proxies.md: -------------------------------------------------------------------------------- 1 | # Proxies 2 | 3 | `rustup` provides a number of wrappers for common Rust tools. 4 | These are called _proxies_ and represent commands which are 5 | provided by the various [components]. 6 | 7 | The list of proxies is currently static in `rustup` and is as follows: 8 | 9 | [components]: components.md 10 | 11 | - `rustc` is the compiler for the Rust programming language, provided by the project itself and comes from the `rustc` component. 12 | 13 | - `rustdoc` is a tool distributed in the `rustc` component which helps you to generate documentation for Rust projects. 14 | 15 | - `cargo` is the Rust package manager which downloads your Rust package’s dependencies, compiles your packages, makes distributable packages, and uploads them to crates.io (the Rust community’s package registry). It comes from the `cargo` component. 16 | 17 | - `rust-lldb`, `rust-gdb`, and `rust-gdbgui` are simple wrappers around the `lldb`, `gdb`, and `gdbgui` debuggers respectively. The wrappers enable some pretty-printing of Rust values and add some convenience features to the debuggers by means of their scripting interfaces. 18 | 19 | - `rust-analyzer` is part of the Rust IDE integration tooling. It implements the language-server protocol to permit IDEs and editors such as Visual Studio Code, Vim, or Emacs, access to the semantics of the Rust code you are editing. It comes from the `rust-analyzer` component. 20 | 21 | - `cargo-clippy` and `clippy-driver` are related to the `clippy` linting tool which provides extra checks for common mistakes and stylistic choices and it comes from the `clippy` component. 22 | 23 | - `cargo-miri` is an experimental interpreter for Rust's mid-level intermediate representation (MIR) and it comes from the `miri` component. 24 | 25 | - `rls` is a deprecated IDE tool that has been replaced by `rust-analyzer`. It comes from the `rls` component. 26 | -------------------------------------------------------------------------------- /doc/user-guide/src/concepts/toolchains.md: -------------------------------------------------------------------------------- 1 | # Toolchains 2 | 3 | Many `rustup` commands deal with *toolchains*, a single installation of the 4 | Rust compiler. `rustup` supports multiple types of toolchains. The most basic 5 | track the official release [channels]: *stable*, *beta* and *nightly*; but 6 | `rustup` can also install toolchains from the official archives, for alternate 7 | host platforms, and from local builds. 8 | 9 | [channels]: channels.md 10 | 11 | ## Toolchain specification 12 | 13 | Standard release channel toolchain names have the following form: 14 | 15 | ``` 16 | [-][-] 17 | 18 | = stable|beta|nightly|[-] 19 | = | 20 | = beta[.] 21 | = YYYY-MM-DD 22 | = 23 | ``` 24 | 25 | 'channel' is a named release channel, a major and minor version number such as 26 | `1.42`, or a fully specified version number, such as `1.42.0`. Channel names 27 | can be optionally appended with an archive date, as in `nightly-2014-12-18`, in 28 | which case the toolchain is downloaded from the archive for that date. 29 | 30 | Finally, the host may be specified as a target triple. This is most useful for 31 | installing a 32-bit compiler on a 64-bit platform, or for installing the 32 | [MSVC-based toolchain][msvc-toolchain] on Windows. For example: 33 | 34 | ```console 35 | $ rustup toolchain install stable-x86_64-pc-windows-msvc 36 | ``` 37 | 38 | For convenience, elements of the target triple that are omitted will be 39 | inferred, so the above could be written: 40 | 41 | ```console 42 | $ rustup toolchain install stable-msvc 43 | ``` 44 | 45 | Toolchain names that don't name a channel instead can be used to name [custom 46 | toolchains]. 47 | 48 | [msvc-toolchain]: https://www.rust-lang.org/tools/install?platform_override=win 49 | [custom toolchains]: #custom-toolchains 50 | 51 | ## Custom toolchains 52 | 53 | For convenience of developers working on Rust itself, `rustup` can manage 54 | local builds of the Rust toolchain. To teach `rustup` about your build, run: 55 | 56 | ```console 57 | $ rustup toolchain link my-toolchain path/to/my/toolchain/sysroot 58 | ``` 59 | 60 | For example, on Ubuntu you might clone `rust-lang/rust` into `~/rust`, build 61 | it, and then run: 62 | 63 | ```console 64 | $ rustup toolchain link my-toolchain ~/rust/build/x86_64-unknown-linux-gnu/stage2/ 65 | $ rustup default my-toolchain 66 | ``` 67 | 68 | Now you can name `my-toolchain` as any other `rustup` toolchain. Create a 69 | `rustup` toolchain for each of your `rust-lang/rust` workspaces and test them 70 | easily with `rustup run my-toolchain rustc`. 71 | 72 | Because the `rust-lang/rust` tree does not include Cargo, *when `cargo` is 73 | invoked for a custom toolchain and it is not available, `rustup` will attempt 74 | to use `cargo` from one of the release channels*, preferring 'nightly', then 75 | 'beta' or 'stable'. 76 | -------------------------------------------------------------------------------- /doc/user-guide/src/configuration.md: -------------------------------------------------------------------------------- 1 | # Configuration 2 | 3 | Rustup has a [TOML](https://github.com/toml-lang/toml) settings file at 4 | `${RUSTUP_HOME}/settings.toml` (which defaults to `~/.rustup` or 5 | `%USERPROFILE%/.rustup`). The schema for this file is not part of the public 6 | interface for rustup - the rustup CLI should be used to query and set settings. 7 | 8 | On Unix operating systems a fallback settings file is consulted for some 9 | settings. This fallback file is located at `/etc/rustup/settings.toml` and 10 | currently can define only `default_toolchain`. 11 | -------------------------------------------------------------------------------- /doc/user-guide/src/cross-compilation.md: -------------------------------------------------------------------------------- 1 | # Cross-compilation 2 | 3 | Rust [supports a great number of platforms][p]. For many of these platforms 4 | The Rust Project publishes binary releases of the standard library, and for 5 | some the full compiler. `rustup` gives easy access to all of them. 6 | 7 | [p]: https://doc.rust-lang.org/nightly/rustc/platform-support.html 8 | 9 | When you first install a toolchain, `rustup` installs only the standard 10 | library for your *host* platform - that is, the architecture and operating 11 | system you are presently running. To compile to other platforms you must 12 | install other *target* platforms. This is done with the `rustup target add` 13 | command. For example, to add the Android target: 14 | 15 | ```console 16 | $ rustup target add arm-linux-androideabi 17 | info: downloading component 'rust-std' for 'arm-linux-androideabi' 18 | info: installing component 'rust-std' for 'arm-linux-androideabi' 19 | ``` 20 | 21 | With the `arm-linux-androideabi` target installed you can then build for 22 | Android with Cargo by passing the `--target` flag, as in `cargo build 23 | --target=arm-linux-androideabi`. 24 | 25 | Note that `rustup target add` only installs the Rust standard library for a 26 | given target. There are typically other tools necessary to cross-compile, 27 | particularly a linker. For example, to cross compile to Android the [Android 28 | NDK] must be installed. In the future, `rustup` will provide assistance 29 | installing the NDK components as well. See the [target section] of the 30 | `cargo` configuration for how to setup a linker to use for a certain target. 31 | 32 | [Android NDK]: https://developer.android.com/tools/sdk/ndk/index.html 33 | [target section]: https://doc.rust-lang.org/cargo/reference/config.html#target 34 | 35 | To install a target for a toolchain that isn't the default toolchain use the 36 | `--toolchain` argument of `rustup target add`, like so: 37 | 38 | ```console 39 | $ rustup target add --toolchain ... 40 | ``` 41 | 42 | To see a list of available targets, `rustup target list`. To remove a 43 | previously-added target, `rustup target remove`. 44 | -------------------------------------------------------------------------------- /doc/user-guide/src/environment-variables.md: -------------------------------------------------------------------------------- 1 | # Environment variables 2 | 3 | - `RUSTUP_LOG` (default: none). Enables Rustup's "custom logging mode". In this mode, 4 | the verbosity of Rustup's log lines can be specified with `tracing_subscriber`'s 5 | [directive syntax]. For example, set `RUSTUP_LOG=rustup=DEBUG` to receive log lines 6 | from `rustup` itself with a maximal verbosity of `DEBUG`. 7 | 8 | - `RUSTUP_HOME` (default: `~/.rustup` or `%USERPROFILE%/.rustup`). Sets the 9 | root `rustup` folder, used for storing installed toolchains and 10 | configuration options. 11 | 12 | - `RUSTUP_TOOLCHAIN` (default: none). If set, will [override] the toolchain used 13 | for all rust tool invocations. A toolchain with this name should be installed, 14 | or invocations will fail. This can specify custom toolchains, installable 15 | toolchains, or the absolute path to a toolchain. 16 | 17 | - `RUSTUP_DIST_SERVER` (default: `https://static.rust-lang.org`). Sets the root 18 | URL for downloading static resources related to Rust. You can change this to 19 | instead use a local mirror, or to test the binaries from the staging 20 | directory. 21 | 22 | - ~~`RUSTUP_DIST_ROOT`~~ *deprecated* (default: `https://static.rust-lang.org/dist`). 23 | Use `RUSTUP_DIST_SERVER` instead. 24 | 25 | - `RUSTUP_UPDATE_ROOT` (default `https://static.rust-lang.org/rustup`). Sets 26 | the root URL for downloading self-update. 27 | 28 | - `RUSTUP_VERSION` (default: none). Overrides the rustup version (e.g. `1.27.1`) 29 | to be downloaded when executing `rustup-init.sh` or `rustup self update`. 30 | 31 | - `RUSTUP_IO_THREADS` *unstable* (defaults to reported cpu count). Sets the 32 | number of threads to perform close IO in. Set to `1` to force 33 | single-threaded IO for troubleshooting, or an arbitrary number to override 34 | automatic detection. 35 | 36 | - `RUSTUP_TRACE_DIR` *unstable* (default: no tracing). Enables tracing and 37 | determines the directory that traces will be written too. Traces are of the 38 | form PID.trace. Traces can be read by the Catapult project [tracing viewer]. 39 | 40 | - `RUSTUP_TERM_COLOR` (default: `auto`). Controls whether colored output is used in the terminal. 41 | Set to `auto` to use colors only in tty streams, to `always` to always enable colors, 42 | or to `never` to disable colors. 43 | 44 | - `RUSTUP_UNPACK_RAM` *unstable* (default free memory or 500MiB if unable to tell, min 210MiB). Caps the amount of 45 | RAM `rustup` will use for IO tasks while unpacking. 46 | 47 | - `RUSTUP_NO_BACKTRACE`. Disables backtraces on non-panic errors even when 48 | `RUST_BACKTRACE` is set. 49 | 50 | - `RUSTUP_PERMIT_COPY_RENAME` *unstable*. When set, allows rustup to fall-back 51 | to copying files if attempts to `rename` result in cross-device link 52 | errors. These errors occur on OverlayFS, which is used by [Docker][dc]. This 53 | feature sacrifices some transactions protections and may be removed at any 54 | point. Linux only. 55 | 56 | - `RUSTUP_AUTO_INSTALL` (default: 1) When set to `1`, installs the active 57 | toolchain when it is absent. Set this value to `0` to disable automatic 58 | installation. 59 | 60 | - `RUSTUP_HARDLINK_PROXIES` *unstable*. When set, rustup will not attempt to 61 | symlink proxies and instead always use hardlinks. If you find this fixes 62 | a problem, then please report the issue on the [rustup issue tracker]. 63 | 64 | [directive syntax]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives 65 | [dc]: https://docs.docker.com/storage/storagedriver/overlayfs-driver/#modifying-files-or-directories 66 | [override]: overrides.md 67 | [tracing viewer]: https://github.com/catapult-project/catapult/blob/master/tracing/README.md 68 | [rustup issue tracker]: https://github.com/rust-lang/rustup/issues 69 | -------------------------------------------------------------------------------- /doc/user-guide/src/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Command | Description 4 | ----------------------------------------------------------- | ------------------------------------------------------------ 5 | `rustup default nightly` | Set the [default toolchain] to the latest nightly 6 | `rustup set profile minimal` | Set the default [profile] 7 | `rustup target list` | List all available [targets] for the active toolchain 8 | `rustup target add arm-linux-androideabi` | Install the Android target 9 | `rustup target remove arm-linux-androideabi` | Remove the Android target 10 | `rustup run nightly rustc foo.rs` | Run the nightly regardless of the active toolchain 11 | `rustc +nightly foo.rs` | [Shorthand] way to run a nightly compiler 12 | `rustup run nightly bash` | Run a shell configured for the nightly compiler 13 | `rustup default stable-msvc` | On Windows, use the MSVC toolchain instead of GNU 14 | `rustup override set nightly-2015-04-01` | For the current directory, use a nightly from a specific date 15 | `rustup toolchain link my-toolchain "C:\RustInstallation"` | Install a custom toolchain by symlinking an existing installation 16 | `rustup show` | Show which toolchain will be used in the current directory 17 | `rustup toolchain uninstall nightly` | Uninstall a given toolchain 18 | `rustup toolchain help` | Show the `help` page for a subcommand (like `toolchain`) 19 | `rustup man cargo` | \(*Unix only*\) View the man page for a given command (like `cargo`) 20 | 21 | [default toolchain]: overrides.md#default-toolchain 22 | [profile]: concepts/profiles.md 23 | [shorthand]: overrides.md#toolchain-override-shorthand 24 | [targets]: cross-compilation.md 25 | -------------------------------------------------------------------------------- /doc/user-guide/src/faq.md: -------------------------------------------------------------------------------- 1 | # FAQ 2 | 3 | ### Is this an official Rust project? 4 | 5 | Yes. rustup is an official Rust project. It is the recommended way to install 6 | Rust at https://www.rust-lang.org. 7 | 8 | ### How is this related to multirust? 9 | 10 | rustup is the successor to [multirust]. rustup began as multirust-rs, a 11 | rewrite of multirust from shell script to Rust, by [Diggory Blake], and is now 12 | maintained by The Rust Project. 13 | 14 | [multirust]: https://github.com/brson/multirust 15 | [Diggory Blake]: https://github.com/Diggsey 16 | 17 | ### Can rustup download the Rust source code? 18 | 19 | The source for Rust's standard library can be obtained by running `rustup 20 | component add rust-src`. It will be downloaded to the `/lib/rustlib/src/rust` directory of the current toolchain. 22 | 23 | The source for the compiler and tools must be obtained from the [Rust 24 | repository] or the standalone [source tarballs]. 25 | 26 | [rust repository]: https://github.com/rust-lang/rust/ 27 | [source tarballs]: https://forge.rust-lang.org/infra/other-installation-methods.html#source-code 28 | 29 | ### rustup fails with Windows error 32 30 | 31 | If `rustup` fails with Windows error 32, it may be due to antivirus scanning 32 | in the background. Disable antivirus scanner and try again. 33 | 34 | ### I get "error: could not remove 'rustup-bin' file: 'C:\Users\USER\\.cargo\bin\rustup.exe'" 35 | 36 | If `rustup` fails to self-update in this way it's usually because RLS is 37 | running (your editor is open and running RLS). The solution is to stop RLS (by 38 | closing your editor) and try again. 39 | 40 | ### rustup exited successfully but I can't run `rustc --version` 41 | 42 | Restart your shell. This will reload your `PATH` environment 43 | variable to include Cargo's bin directory (`$CARGO_HOME/bin`). 44 | -------------------------------------------------------------------------------- /doc/user-guide/src/index.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | *rustup* installs [The Rust Programming Language][rustlang] from the official 4 | release channels, enabling you to easily switch between stable, beta, and 5 | nightly compilers and keep them updated. It makes cross-compiling simpler with 6 | binary builds of the standard library for common platforms. And it runs on all 7 | platforms Rust supports. 8 | 9 | Check out the [Concepts] chapter for an overview of how rustup works and some 10 | of the terminology it uses. The [Installation] chapter covers installing 11 | rustup and getting started. 12 | 13 | The source code of rustup and this manual may be found at 14 | . If you find a problem, check out the 15 | [issue tracker]. 16 | 17 | Release notes for rustup may be found in the [CHANGELOG]. 18 | 19 | [CHANGELOG]: https://github.com/rust-lang/rustup/blob/master/CHANGELOG.md 20 | [concepts]: concepts/index.md 21 | [installation]: installation/index.md 22 | [issue tracker]: https://github.com/rust-lang/rustup/issues 23 | [rustlang]: https://www.rust-lang.org 24 | -------------------------------------------------------------------------------- /doc/user-guide/src/installation/already-installed-rust.md: -------------------------------------------------------------------------------- 1 | # Already installed Rust? 2 | 3 | Other package managers also ship Rust, and you may wish to use the packaged 4 | toolchain, such as for distribution package development. You may also wish to 5 | use a `rustup`-managed toolchain such as nightly or beta. Normally, `rustup` 6 | will complain that you already have Rust installed in `/usr` and refuse to 7 | install. However, you can install Rust via `rustup` and have it coexist with 8 | your packaged Rust toolchain. 9 | 10 | ## Set up rustup with an existing Rust toolchain 11 | 12 | When you initially install Rust with `rustup`, pass the `-y` option to make it 13 | ignore the packaged Rust toolchain and install a `rustup`-managed toolchain 14 | into `~/.cargo/bin`. Add that directory to your `$PATH` (or let `rustup` do it 15 | for you by not passing `--no-modify-path`). Then, to tell `rustup` about your 16 | system toolchain, run: 17 | 18 | ```console 19 | rustup toolchain link system /usr 20 | ``` 21 | 22 | You can then use "system" as a `rustup` toolchain, just like "nightly". 23 | For example, using the [toolchain override shorthand], you can run `cargo +system build` 24 | to build with the system toolchain, or `cargo +nightly build` to build with nightly. 25 | 26 | If you wish to develop with the system toolchain (e.g. for distribution packages), 27 | you may want to make it your [default toolchain]: 28 | 29 | ```console 30 | rustup default system 31 | ``` 32 | 33 | ## Ensure the correct `$PATH` configuration 34 | 35 | There are times when the above steps don't work, and you may see strange error 36 | messages when running commands that should have been proxied by rustup. 37 | For example, when running `cargo +stable --version`, you may encounter the 38 | following error: 39 | 40 | ```text 41 | error: no such command: `+stable` 42 | 43 | Cargo does not handle `+toolchain` directives. 44 | Did you mean to invoke `cargo` through `rustup` instead? 45 | ``` 46 | 47 | This means `cargo` is currently not a `rustup` proxy, and your `$PATH` needs 48 | to be fixed. 49 | 50 | In fact, on any machine with rustup installed, you would like to have **rustup 51 | proxies showing up first in `$PATH`**, shadowing any other Rust installations. 52 | Don't worry: these shadowed installations can then be adopted by rustup with the 53 | `rustup toolchain link` command as mentioned above. 54 | 55 | The exact steps to be taken to make rustup proxies come first may vary according 56 | to your system environment, but usually it is about changing the evaluation 57 | order of certain lines in your shell configuration file(s). 58 | 59 | To make it clearer, let's look at the example of a Mac with both regular rustup 60 | fetched from [rustup.rs] and homebrew-installed `rust`. 61 | The **right way** to configure `.profile` in this environment would be: 62 | 63 | ```bash 64 | eval $(/opt/homebrew/bin/brew shellenv) 65 | . $HOME/.cargo/env 66 | ``` 67 | 68 | In this example, both of these lines all _prepend_ to `$PATH`, so the last one 69 | takes over, letting the rustup proxies shadow the homebrew-installed `rust`. 70 | On the other hand, putting these lines the other way around will cause the 71 | aforementioned error. 72 | 73 | When in doubt, you can always debug your shell configuration by printing the 74 | status of your current `$PATH` with `echo $PATH | xargs -n1` and paying 75 | attention to the order of `$CARGO_HOME/bin` (which defaults to 76 | `$HOME/.cargo/bin`) compared to your package manager's `bin` directory. 77 | 78 | After the fix, the output of `cargo +stable --version` should be similar to one 79 | of the following, depending on whether you have had the `stable` toolchain 80 | installed: 81 | 82 | - ```text 83 | cargo 1.85.1 (d73d2caf9 2024-12-31) 84 | ``` 85 | 86 | - ```text 87 | error: toolchain 'stable' is not installed 88 | ``` 89 | 90 | [rustup.rs]: https://rustup.rs 91 | [toolchain override shorthand]: ../overrides.md#toolchain-override-shorthand 92 | [default toolchain]: ../overrides.md#default-toolchain 93 | -------------------------------------------------------------------------------- /doc/user-guide/src/installation/images/component-msvc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/doc/user-guide/src/installation/images/component-msvc.png -------------------------------------------------------------------------------- /doc/user-guide/src/installation/images/component-sdk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/doc/user-guide/src/installation/images/component-sdk.png -------------------------------------------------------------------------------- /doc/user-guide/src/installation/images/step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/doc/user-guide/src/installation/images/step1.png -------------------------------------------------------------------------------- /doc/user-guide/src/installation/images/step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/doc/user-guide/src/installation/images/step2.png -------------------------------------------------------------------------------- /doc/user-guide/src/installation/images/step3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/doc/user-guide/src/installation/images/step3.png -------------------------------------------------------------------------------- /doc/user-guide/src/installation/images/step4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/doc/user-guide/src/installation/images/step4.png -------------------------------------------------------------------------------- /doc/user-guide/src/installation/images/step5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/doc/user-guide/src/installation/images/step5.png -------------------------------------------------------------------------------- /doc/user-guide/src/installation/index.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | Follow the instructions at . If that 4 | doesn't work for you there are [other installation methods]. 5 | 6 | `rustup` installs `rustc`, `cargo`, `rustup` and other standard tools to 7 | Cargo's `bin` directory. On Unix it is located at `$HOME/.cargo/bin` and on 8 | Windows at `%USERPROFILE%\.cargo\bin`. This is the same directory that `cargo 9 | install` will install Rust programs and Cargo plugins. 10 | 11 | This directory will be in your `$PATH` environment variable, which means you 12 | can run them from the shell without further configuration. Open a *new* shell 13 | and type the following: 14 | 15 | ```console 16 | rustc --version 17 | ``` 18 | 19 | If you see something like `rustc 1.19.0 (0ade33941 2017-07-17)` then you are 20 | ready to Rust. If you decide Rust isn't your thing, you can completely remove 21 | it from your system by running `rustup self uninstall`. 22 | 23 | [other installation methods]: other.md 24 | 25 | ## Choosing where to install 26 | 27 | `rustup` allows you to customise your installation by setting the environment 28 | variables `CARGO_HOME` and `RUSTUP_HOME` before running the `rustup-init` 29 | executable. As mentioned in the [Environment Variables] section, `RUSTUP_HOME` 30 | sets the root `rustup` folder, which is used for storing installed toolchains 31 | and configuration options. `CARGO_HOME` contains cache files used by [cargo]. 32 | 33 | Note that you will need to ensure these environment variables are always set 34 | and that `CARGO_HOME/bin` is in the `$PATH` environment variable when using 35 | the toolchain. 36 | 37 | [Environment Variables]: ../environment-variables.md 38 | [cargo]: https://doc.rust-lang.org/cargo/ 39 | 40 | ## Installing nightly 41 | 42 | If you specify the [nightly channel] when installing `rustup`, the 43 | `rustup-init` script will do a "forced" installation by default. A "forced" 44 | installation means it will install the nightly channel regardless of whether 45 | it might be missing [components] that you want. If you want to install rustup 46 | with the nightly channel, and ensure it has the components that you want, you 47 | will need to do this in two phases. For example, if you want to make a fresh 48 | installation of `rustup` and then install `nightly` along with `clippy` or 49 | `miri`, first install `rustup` without a toolchain: 50 | 51 | ```console 52 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y 53 | ``` 54 | 55 | Next you can install `nightly` allowing `rustup` to downgrade until it finds 56 | the components you need: 57 | 58 | ```console 59 | rustup toolchain install nightly --allow-downgrade --profile minimal --component clippy 60 | ``` 61 | 62 | This can be used to great effect in CI, to get you a toolchain rapidly which 63 | meets your criteria. 64 | 65 | [nightly channel]: ../concepts/channels.md 66 | [components]: ../concepts/components.md 67 | 68 | ## Enable tab completion for Bash, Fish, Zsh, or PowerShell 69 | 70 | `rustup` now supports generating completion scripts for Bash, Fish, Zsh, and 71 | PowerShell. See `rustup help completions` for full details, but the gist is as 72 | simple as using one of the following: 73 | 74 | ```console 75 | # Bash 76 | $ rustup completions bash > ~/.local/share/bash-completion/completions/rustup 77 | 78 | # Bash (macOS/Homebrew) 79 | $ rustup completions bash > $(brew --prefix)/etc/bash_completion.d/rustup.bash-completion 80 | 81 | # Fish 82 | $ mkdir -p ~/.config/fish/completions 83 | $ rustup completions fish > ~/.config/fish/completions/rustup.fish 84 | 85 | # Zsh 86 | $ rustup completions zsh > ~/.zfunc/_rustup 87 | 88 | # PowerShell v5.0+ 89 | $ rustup completions powershell >> $PROFILE.CurrentUserCurrentHost 90 | # or 91 | $ rustup completions powershell | Out-String | Invoke-Expression 92 | ``` 93 | 94 | **Note**: you may need to restart your shell in order for the changes to take 95 | effect. 96 | 97 | For `zsh`, you must then add the following line in your `~/.zshrc` before 98 | `compinit`: 99 | 100 | ```zsh 101 | fpath+=~/.zfunc 102 | ``` 103 | -------------------------------------------------------------------------------- /doc/user-guide/src/installation/windows-msvc.md: -------------------------------------------------------------------------------- 1 | # MSVC prerequisites 2 | 3 | To compile programs into an exe file, Rust requires a linker, libraries and Windows API import libraries. 4 | For `msvc` targets these can be acquired through Visual Studio. 5 | 6 | ## Automatic install 7 | 8 | If you don't have Visual Studio already installed then [rustup-init] will offer to automatically install the prerequisites. 9 | Doing so means you can skip the rest of this page. 10 | However, it installs Visual Studio Community edition which may not be appropriate for all users. 11 | It is free for individuals, academic and open source use, but not for other uses, such as in proprietary enterprise software. 12 | Users should ask their organisation which edition is right for them. 13 | See [licensing terms][vs licences] for more details. 14 | 15 | ## Manual install 16 | 17 | [Download Visual Studio][vs downloads]. 18 | Rust supports Visual Studio 2017 and later but it is recommended that you use the latest version (currently 2022) for new projects. 19 | You can opt to download only the Build Tools for Visual Studio, which does not include the IDE. 20 | However this requires you already have a license to the Community, Professional or Enterprise edition. 21 | 22 | Once you've downloaded and started the installer, the easiest way to get everything installed is to select "Desktop Development with C++". 23 | This will include the necessary components. 24 | On the "Language Packs" tab, make sure the English language pack is installed in addition to your preferred language. 25 | 26 | If you want more details on the installation process or want to further customize the install then follow the walkthrough below. 27 | Otherwise complete the Visual Studio install and continue with installing Rust. 28 | 29 | ## Walkthrough: Installing Visual Studio 2022 30 | 31 | This walkthrough uses the Community edition of Visual Studio but the Professional, Enterprise and the Build Tools all work the same way. 32 | 33 | The installer will start by linking to the [license][vs licences] and for your edition of Visual Studio and then preparing the installer. 34 | 35 | ![Accept the license](images/step1.png) 36 | ![Installing the installer](images/step2.png) 37 | 38 | Once this finishes, you can then select the components to be installed. 39 | Here we use the "Workload" tab to select the "Desktop Development with C++" workload. 40 | This will includes all needed components for Rust: 41 | ![Select the C++ Workload](images/step3.png) 42 | 43 | ### Installing only the required components (optional) 44 | 45 | If you'd like a more minimal install (and won't be doing C++ development) then you can use the "Individual Components" tab to select just the essentials, which are: 46 | 47 | * MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest) 48 | * Windows 11 SDK (10.0.22621.0) 49 | 50 | Note that the specific version of the Windows SDK doesn't matter for pure Rust code but if using C++ as well you'll likely want either the latest or whichever version is required by the C++ project (or both). 51 | 52 | ![Select the latest MSVC component](images/component-msvc.png) 53 | ![Select the Windows 11 SDK component](images/component-sdk.png) 54 | 55 | ### Adding Language Packs (optional) 56 | 57 | After choosing the components, you may also want to select the language packs to install. 58 | Switch to the "Language Packs" tab and add the languages. 59 | It is recommended that you add the English language pack in addition to your preferred language. 60 | This will provide English language error messages, which may help when reporting errors. 61 | 62 | ![Add the English language](images/step4.png) 63 | 64 | ### Completing the install 65 | 66 | Finally click the install button and wait for everything to be installed. 67 | 68 | ![Wait for the install to complete](images/step5.png) 69 | 70 | Once finished, you can continue on to installing Rust. 71 | 72 | [rustup-init]: https://rustup.rs 73 | [vs downloads]: https://visualstudio.microsoft.com/downloads/ 74 | [vs licences]: https://visualstudio.microsoft.com/license-terms/ 75 | -------------------------------------------------------------------------------- /doc/user-guide/src/installation/windows.md: -------------------------------------------------------------------------------- 1 | # Windows 2 | 3 | `rustup` works the same on Windows as it does on Unix, but there are some 4 | special considerations for Rust developers on Windows. As [mentioned on the 5 | Rust download page][msvc-toolchain], there are two [ABIs] in use on Windows: 6 | the native (MSVC) ABI used by [Visual Studio], and the GNU ABI used by the 7 | [GCC toolchain]. Which version of Rust you need depends largely on what C/C++ 8 | libraries you want to interoperate with: for interop with software produced by 9 | Visual Studio use the MSVC build of Rust; for interop with GNU software built 10 | using the [MinGW/MSYS2 toolchain][MSYS2] use the GNU build. 11 | 12 | When targeting the MSVC ABI, Rust additionally requires an [installation of 13 | Visual Studio][msvc install] so `rustc` can use its linker and libraries. 14 | 15 | When targeting the GNU ABI, no additional software is strictly required for basic use. 16 | However, many library crates will not be able to compile until the full [MSYS2] with MinGW has been installed. 17 | 18 | By default `rustup` on Windows configures Rust to target the MSVC ABI, that is 19 | a target triple of either `i686-pc-windows-msvc`, `x86_64-pc-windows-msvc`, or `aarch64-pc-windows-msvc` 20 | depending on the CPU architecture of the host Windows OS. The toolchains that 21 | `rustup` chooses to install, unless told otherwise through the [toolchain 22 | specification], will be compiled to run on that target triple host and will 23 | target that triple by default. 24 | 25 | You can change this behavior with `rustup set default-host` or during 26 | installation. 27 | 28 | For example, to explicitly select the 32-bit MSVC host: 29 | 30 | ```console 31 | $ rustup set default-host i686-pc-windows-msvc 32 | ``` 33 | 34 | Or to choose the 64 bit GNU toolchain: 35 | 36 | ```console 37 | $ rustup set default-host x86_64-pc-windows-gnu 38 | ``` 39 | 40 | Since the MSVC ABI provides the best interoperation with other Windows 41 | software it is recommended for most purposes. The GNU toolchain is always 42 | available, even if you don't use it by default. Just install it with `rustup 43 | toolchain install`: 44 | 45 | ```console 46 | $ rustup toolchain install stable-gnu 47 | ``` 48 | 49 | You don't need to switch toolchains to support all windows targets though; a 50 | single toolchain supports all four x86 windows targets: 51 | 52 | ```console 53 | $ rustup target add x86_64-pc-windows-msvc 54 | $ rustup target add x86_64-pc-windows-gnu 55 | $ rustup target add i686-pc-windows-msvc 56 | $ rustup target add i686-pc-windows-gnu 57 | ``` 58 | 59 | See the [Cross-compilation] chapter for more details on specifying different 60 | targets with the same compiler. 61 | 62 | [ABIs]: https://en.wikipedia.org/wiki/Application_binary_interface 63 | [cross-compilation]: ../cross-compilation.md 64 | [Visual Studio]: https://visualstudio.microsoft.com/ 65 | [GCC toolchain]: https://gcc.gnu.org/ 66 | [MSYS2]: https://www.msys2.org/ 67 | [msvc-toolchain]: https://www.rust-lang.org/tools/install?platform_override=win 68 | [toolchain specification]: ../concepts/toolchains.md#toolchain-specification 69 | [msvc install]: windows-msvc.html 70 | -------------------------------------------------------------------------------- /doc/user-guide/src/network-proxies.md: -------------------------------------------------------------------------------- 1 | # Network proxies 2 | 3 | Enterprise networks often don't have direct outside HTTP access, but enforce 4 | the use of proxies. If you're on such a network, you can request that `rustup` 5 | uses a proxy by setting its URL in the environment. In most cases, setting 6 | `https_proxy` should be sufficient. Commands may differ between different 7 | systems and shells: 8 | 9 | - On a Unix-like system with a shell like __bash__ or __zsh__: 10 | ```bash 11 | export https_proxy=socks5://proxy.example.com:1080 12 | ``` 13 | - On Windows [__Command Prompt (cmd)__][cmd]: 14 | ```cmd 15 | set https_proxy=socks5://proxy.example.com:1080 16 | ``` 17 | - On Windows [__PowerShell__][ps] (or __PowerShell Core__): 18 | ```cmd 19 | $env:https_proxy="socks5://proxy.example.com:1080" 20 | ``` 21 | - Replace `socks5://proxy.example.com:1080` with 22 | `http://proxy.example.com:8080` when an HTTP proxy is used instead. 23 | 24 | If you need a more complex setup, `rustup` supports the convention used by the 25 | __curl__ program, documented in the ENVIRONMENT section of [its manual 26 | page][curlman]. 27 | 28 | The use of `curl` is presently **deprecated**, however it can still be used by 29 | providing the `RUSTUP_USE_CURL` environment variable, for example: 30 | 31 | ```bash 32 | RUSTUP_USE_CURL=1 rustup update 33 | ``` 34 | 35 | Note that some versions of `libcurl` apparently require you to drop the 36 | `http://` or `https://` prefix in environment variables. For example, `export 37 | http_proxy=proxy.example.com:1080` (and likewise for HTTPS). If you are 38 | getting an SSL `unknown protocol` error from `rustup` via `libcurl` but the 39 | command-line `curl` command works fine, this may be the problem. 40 | 41 | [curlman]: https://curl.se/docs/manpage.html#:~:text=Environment,-The%20environment%20variables 42 | [cmd]: https://en.wikipedia.org/wiki/Cmd.exe 43 | [ps]: https://en.wikipedia.org/wiki/PowerShell 44 | -------------------------------------------------------------------------------- /doc/user-guide/src/security.md: -------------------------------------------------------------------------------- 1 | # Security 2 | 3 | `rustup` is secure enough for most people, but it [still needs work][s]. 4 | `rustup` performs all downloads over HTTPS, but does not yet validate 5 | signatures of downloads. 6 | 7 | [s]: https://github.com/rust-lang/rustup/issues?q=is%3Aopen+is%3Aissue+label%3Asecurity 8 | 9 | File modes on installation honor umask as of 1.18.4, use umask if very tight 10 | controls are desired. 11 | 12 | If you wish to report a security issue, please follow the [Rust security 13 | policy]. 14 | 15 | [Rust security policy]: https://www.rust-lang.org/policies/security 16 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | # This is a cheap nix flake for direnv use for developing 2 | # Rustup if you are running on NixOS. 3 | # 4 | # We deliberately don't commit a flake.lock because we only 5 | # provide this for developers, not as a way to have rustup 6 | # built for NixOS. 7 | 8 | { 9 | inputs = { flake-utils.url = "github:numtide/flake-utils"; }; 10 | 11 | outputs = { self, nixpkgs, flake-utils }: 12 | flake-utils.lib.eachDefaultSystem (system: 13 | let pkgs = nixpkgs.legacyPackages.${system}; 14 | in { 15 | devShell = pkgs.mkShell { 16 | buildInputs = with pkgs; [ 17 | stdenv 18 | openssl 19 | pkg-config 20 | ]; 21 | }; 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /src/cli.rs: -------------------------------------------------------------------------------- 1 | /// The CLI specific code lives in the cli module and sub-modules. 2 | #[macro_use] 3 | pub mod log; 4 | pub mod common; 5 | mod download_tracker; 6 | pub mod errors; 7 | mod help; 8 | mod job; 9 | mod markdown; 10 | pub mod proxy_mode; 11 | pub mod rustup_mode; 12 | pub mod self_update; 13 | pub mod setup_mode; 14 | mod topical_doc; 15 | -------------------------------------------------------------------------------- /src/cli/errors.rs: -------------------------------------------------------------------------------- 1 | #![allow(clippy::large_enum_variant)] 2 | #![allow(dead_code)] 3 | 4 | use std::io; 5 | use std::path::PathBuf; 6 | use std::sync::LazyLock; 7 | 8 | use regex::Regex; 9 | use strsim::damerau_levenshtein; 10 | use thiserror::Error as ThisError; 11 | 12 | #[derive(ThisError, Debug)] 13 | pub enum CLIError { 14 | #[error("couldn't determine self executable name")] 15 | NoExeName, 16 | #[error("rustup is not installed at '{}'", .p.display())] 17 | NotSelfInstalled { p: PathBuf }, 18 | #[error("failure reading directory {}", .p.display())] 19 | ReadDirError { p: PathBuf, source: io::Error }, 20 | #[error("failure during windows uninstall")] 21 | WindowsUninstallMadness, 22 | } 23 | 24 | fn maybe_suggest_toolchain(bad_name: &str) -> String { 25 | let bad_name = &bad_name.to_ascii_lowercase(); 26 | static VALID_CHANNELS: &[&str] = &["stable", "beta", "nightly"]; 27 | static NUMBERED: LazyLock = LazyLock::new(|| Regex::new(r"^[0-9]+\.[0-9]+$").unwrap()); 28 | if NUMBERED.is_match(bad_name) { 29 | return format!(". Toolchain numbers tend to have three parts, e.g. {bad_name}.0"); 30 | } 31 | 32 | // Suggest only for very small differences 33 | // High number can result in inaccurate suggestions for short queries e.g. `rls` 34 | const MAX_DISTANCE: usize = 3; 35 | 36 | let mut scored: Vec<_> = VALID_CHANNELS 37 | .iter() 38 | .filter_map(|s| { 39 | let distance = damerau_levenshtein(bad_name, s); 40 | if distance <= MAX_DISTANCE { 41 | Some((distance, s)) 42 | } else { 43 | None 44 | } 45 | }) 46 | .collect(); 47 | scored.sort(); 48 | if scored.is_empty() { 49 | String::new() 50 | } else { 51 | format!(". Did you mean '{}'?", scored[0].1) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/cli/proxy_mode.rs: -------------------------------------------------------------------------------- 1 | use std::{path::PathBuf, process::ExitStatus}; 2 | 3 | use anyhow::Result; 4 | 5 | use crate::{ 6 | cli::{common::set_globals, job, self_update}, 7 | command::run_command_for_dir, 8 | process::Process, 9 | toolchain::ResolvableLocalToolchainName, 10 | }; 11 | 12 | #[tracing::instrument(level = "trace", skip(process))] 13 | pub async fn main(arg0: &str, current_dir: PathBuf, process: &Process) -> Result { 14 | self_update::cleanup_self_updater(process)?; 15 | 16 | let _setup = job::setup(); 17 | let mut args = process.args_os().skip(1); 18 | 19 | // Check for a + toolchain specifier 20 | let arg1 = args.next(); 21 | let toolchain = arg1 22 | .as_ref() 23 | .map(|arg| arg.to_string_lossy()) 24 | .filter(|arg| arg.starts_with('+')) 25 | .map(|name| ResolvableLocalToolchainName::try_from(&name.as_ref()[1..])) 26 | .transpose()?; 27 | 28 | // Build command args now while we know whether or not to skip arg 1. 29 | let cmd_args: Vec<_> = process 30 | .args_os() 31 | .skip(1 + toolchain.is_some() as usize) 32 | .collect(); 33 | 34 | let cfg = set_globals(current_dir, true, process)?; 35 | let cmd = cfg 36 | .resolve_local_toolchain(toolchain) 37 | .await? 38 | .command(arg0)?; 39 | run_command_for_dir(cmd, arg0, &cmd_args) 40 | } 41 | -------------------------------------------------------------------------------- /src/cli/self_update/env.fish: -------------------------------------------------------------------------------- 1 | # rustup shell setup 2 | if not contains "{cargo_bin}" $PATH 3 | # Prepending path in case a system-installed rustc needs to be overridden 4 | set -x PATH "{cargo_bin}" $PATH 5 | end 6 | -------------------------------------------------------------------------------- /src/cli/self_update/env.nu: -------------------------------------------------------------------------------- 1 | use std/util "path add" 2 | path add $"{cargo_bin}" 3 | -------------------------------------------------------------------------------- /src/cli/self_update/env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # rustup shell setup 3 | # affix colons on either side of $PATH to simplify matching 4 | case ":${PATH}:" in 5 | *:"{cargo_bin}":*) 6 | ;; 7 | *) 8 | # Prepending path in case a system-installed rustc needs to be overridden 9 | export PATH="{cargo_bin}:$PATH" 10 | ;; 11 | esac 12 | -------------------------------------------------------------------------------- /src/cli/setup_mode.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | 3 | use anyhow::Result; 4 | use clap::Parser; 5 | use tracing::warn; 6 | use tracing_subscriber::{EnvFilter, Registry, reload::Handle}; 7 | 8 | use crate::{ 9 | cli::{ 10 | common::{self, update_console_filter}, 11 | self_update::{self, InstallOpts}, 12 | }, 13 | dist::Profile, 14 | process::Process, 15 | toolchain::MaybeOfficialToolchainName, 16 | utils, 17 | }; 18 | 19 | /// The installer for rustup 20 | #[derive(Debug, Parser)] 21 | #[command( 22 | name = "rustup-init", 23 | bin_name = "rustup-init[EXE]", 24 | version = common::version(), 25 | before_help = format!("rustup-init {}", common::version()), 26 | )] 27 | struct RustupInit { 28 | /// Set log level to 'DEBUG' if 'RUSTUP_LOG' is unset 29 | #[arg(short, long, conflicts_with = "quiet")] 30 | verbose: bool, 31 | 32 | /// Disable progress output, set log level to 'WARN' if 'RUSTUP_LOG' is unset 33 | #[arg(short, long, conflicts_with = "verbose")] 34 | quiet: bool, 35 | 36 | /// Disable confirmation prompt 37 | #[arg(short = 'y')] 38 | no_prompt: bool, 39 | 40 | /// Choose a default host triple 41 | #[arg(long)] 42 | default_host: Option, 43 | 44 | /// Choose a default toolchain to install. Use 'none' to not install any toolchains at all 45 | #[arg(long)] 46 | default_toolchain: Option, 47 | 48 | #[arg(long, value_enum, default_value_t)] 49 | profile: Profile, 50 | 51 | /// Comma-separated list of component names to also install 52 | #[arg(short, long, value_delimiter = ',')] 53 | component: Vec, 54 | 55 | /// Comma-separated list of target names to also install 56 | #[arg(short, long, value_delimiter = ',')] 57 | target: Vec, 58 | 59 | /// Don't update any existing default toolchain after install 60 | #[arg(long)] 61 | no_update_default_toolchain: bool, 62 | 63 | /// Don't configure the PATH environment variable 64 | #[arg(long)] 65 | no_modify_path: bool, 66 | 67 | /// Secret command used during self-update. Not for users 68 | #[arg(long, hide = true)] 69 | self_replace: bool, 70 | 71 | /// Internal testament dump used during CI. Not for users 72 | #[arg(long, hide = true)] 73 | dump_testament: bool, 74 | } 75 | 76 | #[tracing::instrument(level = "trace", skip(process, console_filter))] 77 | pub async fn main( 78 | current_dir: PathBuf, 79 | process: &Process, 80 | console_filter: Handle, 81 | ) -> Result { 82 | use clap::error::ErrorKind; 83 | 84 | let RustupInit { 85 | verbose, 86 | quiet, 87 | no_prompt, 88 | default_host, 89 | default_toolchain, 90 | profile, 91 | component, 92 | target, 93 | no_update_default_toolchain, 94 | no_modify_path, 95 | self_replace, 96 | dump_testament, 97 | } = match RustupInit::try_parse() { 98 | Ok(args) => args, 99 | Err(e) if [ErrorKind::DisplayHelp, ErrorKind::DisplayVersion].contains(&e.kind()) => { 100 | write!(process.stdout().lock(), "{e}")?; 101 | return Ok(utils::ExitCode(0)); 102 | } 103 | Err(e) => return Err(e.into()), 104 | }; 105 | 106 | if self_replace { 107 | return self_update::self_replace(process); 108 | } 109 | 110 | if dump_testament { 111 | return common::dump_testament(process); 112 | } 113 | 114 | if profile == Profile::Complete { 115 | warn!("{}", common::WARN_COMPLETE_PROFILE); 116 | } 117 | 118 | update_console_filter(process, &console_filter, quiet, verbose); 119 | 120 | let opts = InstallOpts { 121 | default_host_triple: default_host, 122 | default_toolchain, 123 | profile, 124 | no_modify_path, 125 | no_update_toolchain: no_update_default_toolchain, 126 | components: &component.iter().map(|s| &**s).collect::>(), 127 | targets: &target.iter().map(|s| &**s).collect::>(), 128 | }; 129 | 130 | self_update::install(current_dir, no_prompt, quiet, opts, process).await 131 | } 132 | -------------------------------------------------------------------------------- /src/command.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | ffi::OsStr, 3 | fmt::Debug, 4 | io, 5 | process::{self, Command, ExitStatus}, 6 | }; 7 | 8 | use anyhow::{Context, Result}; 9 | 10 | use crate::errors::*; 11 | 12 | #[tracing::instrument(level = "trace", err(level = "trace"))] 13 | pub(crate) fn run_command_for_dir + Debug>( 14 | mut cmd: Command, 15 | arg0: &str, 16 | args: &[S], 17 | ) -> Result { 18 | cmd.args(args); 19 | 20 | // FIXME rust-lang/rust#32254. It's not clear to me 21 | // when and why this is needed. 22 | // TODO: process support for mocked file descriptor inheritance here: until 23 | // then tests that depend on rustups stdin being inherited won't work in-process. 24 | cmd.stdin(process::Stdio::inherit()); 25 | 26 | return exec(&mut cmd).with_context(|| RustupError::RunningCommand { 27 | name: OsStr::new(arg0).to_owned(), 28 | }); 29 | 30 | #[cfg(unix)] 31 | fn exec(cmd: &mut Command) -> io::Result { 32 | use std::os::unix::prelude::*; 33 | Err(cmd.exec()) 34 | } 35 | 36 | #[cfg(windows)] 37 | fn exec(cmd: &mut Command) -> io::Result { 38 | use windows_sys::Win32::Foundation::{BOOL, FALSE, TRUE}; 39 | use windows_sys::Win32::System::Console::SetConsoleCtrlHandler; 40 | 41 | unsafe extern "system" fn ctrlc_handler(_: u32) -> BOOL { 42 | // Do nothing. Let the child process handle it. 43 | TRUE 44 | } 45 | unsafe { 46 | if SetConsoleCtrlHandler(Some(ctrlc_handler), TRUE) == FALSE { 47 | return Err(io::Error::other("Unable to set console handler")); 48 | } 49 | } 50 | 51 | cmd.status() 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/dist/component/mod.rs: -------------------------------------------------------------------------------- 1 | pub use self::components::*; 2 | pub use self::package::*; 3 | /// An interpreter for the rust-installer [1] installation format. 4 | /// 5 | /// https://github.com/rust-lang/rust-installer 6 | pub use self::transaction::*; 7 | 8 | // Transactional file system tools 9 | mod transaction; 10 | // The representation of a package, its components, and installation 11 | mod package; 12 | // The representation of *installed* components, and uninstallation 13 | mod components; 14 | 15 | #[cfg(test)] 16 | mod tests; 17 | -------------------------------------------------------------------------------- /src/dist/config.rs: -------------------------------------------------------------------------------- 1 | use std::fmt; 2 | use std::str::FromStr; 3 | 4 | use anyhow::{Context, Result}; 5 | use serde::{Deserialize, Serialize}; 6 | 7 | use super::manifest::Component; 8 | use crate::errors::*; 9 | 10 | #[derive(Clone, Debug, Default, Deserialize, Serialize)] 11 | pub struct Config { 12 | pub config_version: ConfigVersion, 13 | pub components: Vec, 14 | } 15 | 16 | impl Config { 17 | pub(crate) fn parse(data: &str) -> Result { 18 | toml::from_str(data).context("error parsing config") 19 | } 20 | 21 | pub(crate) fn stringify(&self) -> Result { 22 | Ok(toml::to_string(&self)?) 23 | } 24 | } 25 | 26 | #[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 27 | pub(crate) enum ConfigVersion { 28 | #[serde(rename = "1")] 29 | #[default] 30 | V1, 31 | } 32 | 33 | impl ConfigVersion { 34 | pub fn as_str(&self) -> &'static str { 35 | match self { 36 | Self::V1 => "1", 37 | } 38 | } 39 | } 40 | 41 | impl FromStr for ConfigVersion { 42 | type Err = RustupError; 43 | 44 | fn from_str(s: &str) -> Result { 45 | match s { 46 | "1" => Ok(Self::V1), 47 | _ => Err(RustupError::UnsupportedVersion(s.to_owned())), 48 | } 49 | } 50 | } 51 | 52 | impl fmt::Display for ConfigVersion { 53 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 54 | write!(f, "{}", self.as_str()) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/dist/manifest/tests/channel-rust-nightly-example.toml: -------------------------------------------------------------------------------- 1 | manifest-version = "2" 2 | date = "2015-10-10" 3 | [pkg.rust] 4 | version = "rustc 1.3.0 (9a92aaf19 2015-09-15)" 5 | [pkg.rust.target.x86_64-unknown-linux-gnu] 6 | available = true 7 | url = "example.com" 8 | hash = "..." 9 | [[pkg.rust.target.x86_64-unknown-linux-gnu.components]] 10 | pkg = "rustc" 11 | target = "x86_64-unknown-linux-gnu" 12 | [[pkg.rust.target.x86_64-unknown-linux-gnu.components]] 13 | pkg = "rust-docs" 14 | target = "x86_64-unknown-linux-gnu" 15 | [[pkg.rust.target.x86_64-unknown-linux-gnu.components]] 16 | pkg = "cargo" 17 | target = "x86_64-unknown-linux-gnu" 18 | [[pkg.rust.target.x86_64-unknown-linux-gnu.components]] 19 | pkg = "rust-std" 20 | target = "x86_64-unknown-linux-gnu" 21 | # extensions are rust-std or rust-docs that aren't in the rust tarball's component list 22 | [[pkg.rust.target.x86_64-unknown-linux-gnu.extensions]] 23 | pkg = "rust-std" 24 | target = "x86_64-unknown-linux-musl" 25 | [[pkg.rust.target.x86_64-unknown-linux-gnu.extensions]] 26 | pkg = "rust-std" 27 | target = "i686-unknown-linux-gnu" 28 | [pkg.rustc] 29 | version = "rustc 1.3.0 (9a92aaf19 2015-09-15)" 30 | [pkg.rustc.target.x86_64-unknown-linux-gnu] 31 | available = true 32 | url = "example.com" 33 | hash = "..." 34 | [pkg.cargo] 35 | version = "cargo 0.4.0-nightly (553b363 2015-08-03)" 36 | [pkg.cargo.target.x86_64-unknown-linux-gnu] 37 | available = true 38 | url = "example.com" 39 | hash = "..." 40 | [pkg.rust-std] 41 | version = "rustc 1.3.0 (9a92aaf19 2015-09-15)" 42 | [pkg.rust-std.target.x86_64-unknown-linux-gnu] 43 | available = true 44 | url = "example.com" 45 | hash = "..." 46 | [pkg.rust-std.target.x86_64-unknown-linux-musl] 47 | available = true 48 | url = "example.com" 49 | hash = "..." 50 | [pkg.rust-std.target.i686-unknown-linux-gnu] 51 | available = true 52 | url = "example.com" 53 | hash = "..." 54 | [pkg.rust-docs] 55 | version = "rustc 1.3.0 (9a92aaf19 2015-09-15)" 56 | [pkg.rust-docs.target.x86_64-unknown-linux-gnu] 57 | available = true 58 | url = "example.com" 59 | hash = "..." 60 | -------------------------------------------------------------------------------- /src/dist/prefix.rs: -------------------------------------------------------------------------------- 1 | use std::path::{Path, PathBuf}; 2 | 3 | use crate::utils; 4 | 5 | /// The relative path to the manifest directory in a Rust installation, 6 | /// with path components separated by [`std::path::MAIN_SEPARATOR`]. 7 | const REL_MANIFEST_DIR: &str = match std::path::MAIN_SEPARATOR { 8 | '/' => "lib/rustlib", 9 | '\\' => r"lib\rustlib", 10 | _ => panic!("unknown `std::path::MAIN_SEPARATOR`"), 11 | }; 12 | 13 | static V1_COMMON_COMPONENT_LIST: &[&str] = &["cargo", "rustc", "rust-docs"]; 14 | 15 | #[derive(Clone, Debug)] 16 | pub struct InstallPrefix { 17 | path: PathBuf, 18 | } 19 | impl InstallPrefix { 20 | pub fn path(&self) -> &Path { 21 | &self.path 22 | } 23 | 24 | pub(crate) fn abs_path>(&self, path: P) -> PathBuf { 25 | self.path.join(path) 26 | } 27 | 28 | pub(crate) fn manifest_dir(&self) -> PathBuf { 29 | let mut path = self.path.clone(); 30 | path.push(REL_MANIFEST_DIR); 31 | path 32 | } 33 | 34 | pub fn manifest_file(&self, name: &str) -> PathBuf { 35 | let mut path = self.manifest_dir(); 36 | path.push(name); 37 | path 38 | } 39 | 40 | pub(crate) fn rel_manifest_file(&self, name: &str) -> PathBuf { 41 | let mut path = PathBuf::from(REL_MANIFEST_DIR); 42 | path.push(name); 43 | path 44 | } 45 | 46 | /// Guess whether this is a V1 or V2 manifest distribution. 47 | pub(crate) fn guess_v1_manifest(&self) -> bool { 48 | // If all the v1 common components are present this is likely to be 49 | // a v1 manifest install. The v1 components are not called the same 50 | // in a v2 install. 51 | for component in V1_COMMON_COMPONENT_LIST { 52 | let manifest = format!("manifest-{component}"); 53 | let manifest_path = self.manifest_file(&manifest); 54 | if !utils::path_exists(manifest_path) { 55 | return false; 56 | } 57 | } 58 | // It's reasonable to assume this is a v1 manifest installation 59 | true 60 | } 61 | } 62 | 63 | impl From<&Path> for InstallPrefix { 64 | fn from(value: &Path) -> Self { 65 | Self { path: value.into() } 66 | } 67 | } 68 | 69 | impl From for InstallPrefix { 70 | fn from(path: PathBuf) -> Self { 71 | Self { path } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/dist/triple.rs: -------------------------------------------------------------------------------- 1 | use std::sync::LazyLock; 2 | 3 | use regex::Regex; 4 | 5 | pub mod known; 6 | 7 | #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] 8 | pub struct PartialTargetTriple { 9 | pub arch: Option, 10 | pub os: Option, 11 | pub env: Option, 12 | } 13 | 14 | impl PartialTargetTriple { 15 | pub(crate) fn new(name: &str) -> Option { 16 | if name.is_empty() { 17 | return Some(Self { 18 | arch: None, 19 | os: None, 20 | env: None, 21 | }); 22 | } 23 | 24 | // Prepending `-` makes this next regex easier since 25 | // we can count on all triple components being 26 | // delineated by it. 27 | let name = format!("-{name}"); 28 | static RE: LazyLock = LazyLock::new(|| { 29 | Regex::new(&format!( 30 | r"^(?:-({}))?(?:-({}))?(?:-({}))?$", 31 | known::LIST_ARCHS.join("|"), 32 | known::LIST_OSES.join("|"), 33 | known::LIST_ENVS.join("|") 34 | )) 35 | .unwrap() 36 | }); 37 | 38 | RE.captures(&name).map(|c| { 39 | fn fn_map(s: &str) -> Option { 40 | if s.is_empty() { 41 | None 42 | } else { 43 | Some(s.to_owned()) 44 | } 45 | } 46 | 47 | Self { 48 | arch: c.get(1).map(|s| s.as_str()).and_then(fn_map), 49 | os: c.get(2).map(|s| s.as_str()).and_then(fn_map), 50 | env: c.get(3).map(|s| s.as_str()).and_then(fn_map), 51 | } 52 | }) 53 | } 54 | } 55 | 56 | #[cfg(test)] 57 | mod test { 58 | use super::*; 59 | 60 | #[test] 61 | fn test_partial_target_triple_new() { 62 | let success_cases = vec![ 63 | ("", (None, None, None)), 64 | ("i386", (Some("i386"), None, None)), 65 | ("pc-windows", (None, Some("pc-windows"), None)), 66 | ("gnu", (None, None, Some("gnu"))), 67 | ("i386-gnu", (Some("i386"), None, Some("gnu"))), 68 | ("pc-windows-gnu", (None, Some("pc-windows"), Some("gnu"))), 69 | ("i386-pc-windows", (Some("i386"), Some("pc-windows"), None)), 70 | ( 71 | "i386-pc-windows-gnu", 72 | (Some("i386"), Some("pc-windows"), Some("gnu")), 73 | ), 74 | ]; 75 | 76 | for (input, (arch, os, env)) in success_cases { 77 | let partial_target_triple = PartialTargetTriple::new(input); 78 | assert!( 79 | partial_target_triple.is_some(), 80 | "expected `{input}` to create some partial target triple; got None" 81 | ); 82 | 83 | let expected = PartialTargetTriple { 84 | arch: arch.map(String::from), 85 | os: os.map(String::from), 86 | env: env.map(String::from), 87 | }; 88 | 89 | assert_eq!(partial_target_triple.unwrap(), expected, "input: `{input}`"); 90 | } 91 | 92 | let failure_cases = vec![ 93 | "anything", 94 | "any-other-thing", 95 | "-", 96 | "--", 97 | "i386-", 98 | "i386-pc-", 99 | "i386-pc-windows-", 100 | "-pc-windows", 101 | "i386-pc-windows-anything", 102 | "0000-00-00-", 103 | "00000-000-000", 104 | ]; 105 | 106 | for input in failure_cases { 107 | let partial_target_triple = PartialTargetTriple::new(input); 108 | assert!( 109 | partial_target_triple.is_none(), 110 | "expected `{input}` to be `None`, was: `{partial_target_triple:?}`" 111 | ); 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/dist/triple/known.rs: -------------------------------------------------------------------------------- 1 | pub static LIST_ARCHS: &[&str] = &[ 2 | "aarch64", 3 | "aarch64_be", 4 | "arm", 5 | "arm64_32", 6 | "arm64e", 7 | "arm64ec", 8 | "armeb", 9 | "armebv7r", 10 | "armv4t", 11 | "armv5te", 12 | "armv6", 13 | "armv6k", 14 | "armv7", 15 | "armv7a", 16 | "armv7k", 17 | "armv7r", 18 | "armv7s", 19 | "armv8r", 20 | "avr", 21 | "bpfeb", 22 | "bpfel", 23 | "csky", 24 | "hexagon", 25 | "i386", 26 | "i586", 27 | "i686", 28 | "loongarch64", 29 | "m68k", 30 | "mips", 31 | "mips64", 32 | "mips64el", 33 | "mipsel", 34 | "mipsisa32r6", 35 | "mipsisa32r6el", 36 | "mipsisa64r6", 37 | "mipsisa64r6el", 38 | "msp430", 39 | "nvptx64", 40 | "powerpc", 41 | "powerpc64", 42 | "powerpc64le", 43 | "riscv32", 44 | "riscv32e", 45 | "riscv32em", 46 | "riscv32emc", 47 | "riscv32gc", 48 | "riscv32i", 49 | "riscv32im", 50 | "riscv32ima", 51 | "riscv32imac", 52 | "riscv32imafc", 53 | "riscv32imc", 54 | "riscv64", 55 | "riscv64gc", 56 | "riscv64imac", 57 | "s390x", 58 | "sparc", 59 | "sparc64", 60 | "sparcv9", 61 | "thumbv4t", 62 | "thumbv5te", 63 | "thumbv6m", 64 | "thumbv7a", 65 | "thumbv7em", 66 | "thumbv7m", 67 | "thumbv7neon", 68 | "thumbv8m.base", 69 | "thumbv8m.main", 70 | "wasm32", 71 | "wasm32v1", 72 | "wasm64", 73 | "x86_64", 74 | "x86_64h", 75 | "xtensa", 76 | ]; 77 | pub static LIST_OSES: &[&str] = &[ 78 | "apple-darwin", 79 | "apple-ios", 80 | "apple-tvos", 81 | "apple-visionos", 82 | "apple-watchos", 83 | "esp-espidf", 84 | "esp32-espidf", 85 | "esp32-none", 86 | "esp32s2-espidf", 87 | "esp32s2-none", 88 | "esp32s3-espidf", 89 | "esp32s3-none", 90 | "fortanix-unknown", 91 | "ibm-aix", 92 | "kmc-solid_asp3", 93 | "linux", 94 | "nintendo-3ds", 95 | "nintendo-switch", 96 | "none", 97 | "nuttx-eabi", 98 | "nuttx-eabihf", 99 | "nvidia-cuda", 100 | "openwrt-linux", 101 | "pc-nto", 102 | "pc-solaris", 103 | "pc-windows", 104 | "risc0-zkvm", 105 | "rtems-eabihf", 106 | "sony-psp", 107 | "sony-psx", 108 | "sony-vita", 109 | "sun-solaris", 110 | "unikraft-linux", 111 | "unknown-dragonfly", 112 | "unknown-emscripten", 113 | "unknown-freebsd", 114 | "unknown-fuchsia", 115 | "unknown-gnu", 116 | "unknown-haiku", 117 | "unknown-hermit", 118 | "unknown-hurd", 119 | "unknown-illumos", 120 | "unknown-l4re", 121 | "unknown-linux", 122 | "unknown-netbsd", 123 | "unknown-none", 124 | "unknown-nto", 125 | "unknown-nuttx", 126 | "unknown-openbsd", 127 | "unknown-redox", 128 | "unknown-teeos", 129 | "unknown-trusty", 130 | "unknown-uefi", 131 | "unknown-unknown", 132 | "unknown-xous", 133 | "uwp-windows", 134 | "wasi", 135 | "wasip1", 136 | "wasip1-threads", 137 | "wasip2", 138 | "win7-windows", 139 | "wrs-vxworks", 140 | ]; 141 | pub static LIST_ENVS: &[&str] = &[ 142 | "android", 143 | "androideabi", 144 | "atmega328", 145 | "eabi", 146 | "eabihf", 147 | "elf", 148 | "freestanding", 149 | "gnu", 150 | "gnu_ilp32", 151 | "gnuabi64", 152 | "gnuabiv2", 153 | "gnuabiv2hf", 154 | "gnueabi", 155 | "gnueabihf", 156 | "gnullvm", 157 | "gnuspe", 158 | "gnux32", 159 | "macabi", 160 | "msvc", 161 | "musl", 162 | "muslabi64", 163 | "musleabi", 164 | "musleabihf", 165 | "muslspe", 166 | "newlibeabihf", 167 | "none", 168 | "ohos", 169 | "qnx700", 170 | "qnx710", 171 | "sgx", 172 | "sim", 173 | "softfloat", 174 | "spe", 175 | "uclibc", 176 | "uclibceabi", 177 | "uclibceabihf", 178 | ]; 179 | -------------------------------------------------------------------------------- /src/fallback_settings.rs: -------------------------------------------------------------------------------- 1 | #[cfg(unix)] 2 | use std::{io, path::Path}; 3 | 4 | #[cfg(unix)] 5 | use anyhow::{Context, Result}; 6 | use serde::Deserialize; 7 | 8 | #[cfg(unix)] 9 | use crate::utils; 10 | 11 | #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Default)] 12 | pub struct FallbackSettings { 13 | pub default_toolchain: Option, 14 | } 15 | 16 | impl FallbackSettings { 17 | #[cfg(unix)] 18 | pub(crate) fn new>(path: P) -> Result> { 19 | // Users cannot fix issues with missing/unreadable/invalid centralised files, but logging isn't setup early so 20 | // we can't simply trap all errors and log diagnostics. Ideally we would, and then separate these into different 21 | // sorts of issues, logging messages about errors that should be fixed. Instead we trap some conservative errors 22 | // that hopefully won't lead to too many tickets. 23 | match utils::read_file("fallback settings", path.as_ref()) { 24 | Err(e) => match e.downcast_ref::() { 25 | Some(io_err) => match io_err.kind() { 26 | io::ErrorKind::NotFound | io::ErrorKind::PermissionDenied => Ok(None), 27 | _ => Err(e), 28 | }, 29 | None => Err(e), 30 | }, 31 | Ok(file_contents) => Ok(Some( 32 | toml::from_str(&file_contents).context("error parsing settings")?, 33 | )), 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | #![allow( 2 | clippy::type_complexity, 3 | clippy::result_large_err, // 288 bytes is our 'large' variant today, which is unlikely to be a performance problem 4 | clippy::arc_with_non_send_sync, // will get resolved as we move further into async 5 | )] 6 | #![cfg_attr(not(test), warn( 7 | // We use the logging system instead of printing directly. 8 | clippy::print_stdout, 9 | clippy::print_stderr, 10 | ))] 11 | #![recursion_limit = "1024"] 12 | 13 | use anyhow::{Result, anyhow}; 14 | use errors::RustupError; 15 | use itertools::{Itertools, chain}; 16 | 17 | #[macro_use] 18 | extern crate rs_tracing; 19 | 20 | // A list of all binaries which Rustup will proxy. 21 | pub static TOOLS: &[&str] = &[ 22 | "rustc", 23 | "rustdoc", 24 | "cargo", 25 | "rust-lldb", 26 | "rust-gdb", 27 | "rust-gdbgui", 28 | "rls", 29 | "cargo-clippy", 30 | "clippy-driver", 31 | "cargo-miri", 32 | ]; 33 | 34 | // Tools which are commonly installed by Cargo as well as rustup. We take a bit 35 | // more care with these to ensure we don't overwrite the user's previous 36 | // installation. 37 | pub static DUP_TOOLS: &[&str] = &["rust-analyzer", "rustfmt", "cargo-fmt"]; 38 | 39 | // If the given name is one of the tools we proxy. 40 | pub fn is_proxyable_tools(tool: &str) -> Result<()> { 41 | if chain!(TOOLS, DUP_TOOLS).contains(&tool) { 42 | Ok(()) 43 | } else { 44 | Err(anyhow!( 45 | "unknown proxy name: '{tool}'; valid proxy names are {}", 46 | chain!(TOOLS, DUP_TOOLS) 47 | .map(|s| format!("'{s}'")) 48 | .join(", "), 49 | )) 50 | } 51 | } 52 | 53 | fn component_for_bin(binary: &str) -> Option<&'static str> { 54 | use std::env::consts::EXE_SUFFIX; 55 | 56 | let binary_without_suffix = binary.strip_suffix(EXE_SUFFIX).unwrap_or(binary); 57 | 58 | match binary_without_suffix { 59 | "rustc" | "rustdoc" => Some("rustc"), 60 | "cargo" => Some("cargo"), 61 | "rust-lldb" | "rust-gdb" | "rust-gdbgui" => Some("rustc"), // These are not always available 62 | "rls" => Some("rls"), 63 | "cargo-clippy" => Some("clippy"), 64 | "clippy-driver" => Some("clippy"), 65 | "cargo-miri" => Some("miri"), 66 | "rustfmt" | "cargo-fmt" => Some("rustfmt"), 67 | _ => None, 68 | } 69 | } 70 | 71 | #[macro_use] 72 | pub mod cli; 73 | mod command; 74 | mod config; 75 | mod diskio; 76 | pub mod dist; 77 | mod download; 78 | pub mod env_var; 79 | pub mod errors; 80 | mod fallback_settings; 81 | mod install; 82 | pub mod notifications; 83 | pub mod process; 84 | mod settings; 85 | #[cfg(feature = "test")] 86 | pub mod test; 87 | mod toolchain; 88 | pub mod utils; 89 | 90 | #[cfg(test)] 91 | mod tests { 92 | use crate::{DUP_TOOLS, TOOLS, is_proxyable_tools}; 93 | 94 | #[test] 95 | fn test_is_proxyable_tools() { 96 | for tool in TOOLS { 97 | assert!(is_proxyable_tools(tool).is_ok()); 98 | } 99 | for tool in DUP_TOOLS { 100 | assert!(is_proxyable_tools(tool).is_ok()); 101 | } 102 | let message = "unknown proxy name: 'unknown-tool'; valid proxy names are 'rustc', \ 103 | 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', 'rls', \ 104 | 'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rust-analyzer', 'rustfmt', 'cargo-fmt'"; 105 | assert_eq!( 106 | is_proxyable_tools("unknown-tool").unwrap_err().to_string(), 107 | message 108 | ); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/utils/notify.rs: -------------------------------------------------------------------------------- 1 | use std::fmt; 2 | 3 | use tracing::Level; 4 | 5 | #[derive(Debug)] 6 | pub(crate) enum NotificationLevel { 7 | Trace, 8 | Debug, 9 | Info, 10 | Warn, 11 | Error, 12 | } 13 | 14 | impl fmt::Display for NotificationLevel { 15 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> fmt::Result { 16 | f.write_str(match self { 17 | NotificationLevel::Trace => "trace", 18 | NotificationLevel::Debug => "debug", 19 | NotificationLevel::Info => "info", 20 | NotificationLevel::Warn => "warn", 21 | NotificationLevel::Error => "error", 22 | }) 23 | } 24 | } 25 | 26 | impl From for NotificationLevel { 27 | fn from(level: Level) -> Self { 28 | match level { 29 | Level::TRACE => Self::Trace, 30 | Level::DEBUG => Self::Debug, 31 | Level::INFO => Self::Info, 32 | Level::WARN => Self::Warn, 33 | Level::ERROR => Self::Error, 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup-init" 2 | args = ["--help"] 3 | status.code = 0 4 | stdout = """ 5 | rustup-init [..] 6 | 7 | The installer for rustup 8 | 9 | Usage: rustup-init[EXE] [OPTIONS] 10 | 11 | Options: 12 | -v, --verbose 13 | Set log level to 'DEBUG' if 'RUSTUP_LOG' is unset 14 | -q, --quiet 15 | Disable progress output, set log level to 'WARN' if 'RUSTUP_LOG' is unset 16 | -y 17 | Disable confirmation prompt 18 | --default-host 19 | Choose a default host triple 20 | --default-toolchain 21 | Choose a default toolchain to install. Use 'none' to not install any toolchains at all 22 | --profile 23 | [default: default] [possible values: minimal, default, complete] 24 | -c, --component 25 | Comma-separated list of component names to also install 26 | -t, --target 27 | Comma-separated list of target names to also install 28 | --no-update-default-toolchain 29 | Don't update any existing default toolchain after install 30 | --no-modify-path 31 | Don't configure the PATH environment variable 32 | -h, --help 33 | Print help 34 | -V, --version 35 | Print version 36 | """ 37 | stderr = "" 38 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup-init.sh" 2 | args = ["--help"] 3 | status.code = 0 4 | stdout = """ 5 | rustup-init [..] 6 | 7 | The installer for rustup 8 | 9 | Usage: rustup-init[EXE] [OPTIONS] 10 | 11 | Options: 12 | -v, --verbose 13 | Set log level to 'DEBUG' if 'RUSTUP_LOG' is unset 14 | -q, --quiet 15 | Disable progress output, set log level to 'WARN' if 'RUSTUP_LOG' is unset 16 | -y 17 | Disable confirmation prompt 18 | --default-host 19 | Choose a default host triple 20 | --default-toolchain 21 | Choose a default toolchain to install. Use 'none' to not install any toolchains at all 22 | --profile 23 | [default: default] [possible values: minimal, default, complete] 24 | -c, --component 25 | Comma-separated list of component names to also install 26 | -t, --target 27 | Comma-separated list of target names to also install 28 | --no-update-default-toolchain 29 | Don't update any existing default toolchain after install 30 | --no-modify-path 31 | Don't configure the PATH environment variable 32 | -h, --help 33 | Print help 34 | -V, --version 35 | Print version 36 | """ 37 | stderr = "" 38 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_check_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["check", "--help"] 3 | stdout = """ 4 | ... 5 | Check for updates to Rust toolchains and rustup 6 | 7 | Usage: rustup[EXE] check [OPTIONS] 8 | 9 | Options: 10 | --no-self-update Don't check for self update when running the `rustup check` command 11 | -h, --help Print help 12 | """ 13 | stderr = "" 14 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_component_cmd_add_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["component", "add", "--help"] 3 | stdout = """ 4 | ... 5 | Add a component to a Rust toolchain 6 | 7 | Usage: rustup[EXE] component add [OPTIONS] ... 8 | 9 | Arguments: 10 | ... 11 | 12 | Options: 13 | --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more 14 | information see `rustup help toolchain` 15 | --target 16 | -h, --help Print help 17 | """ 18 | stderr = "" 19 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_component_cmd_list_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["component", "list", "--help"] 3 | stdout = """ 4 | ... 5 | List installed and available components 6 | 7 | Usage: rustup[EXE] component list [OPTIONS] 8 | 9 | Options: 10 | --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more 11 | information see `rustup help toolchain` 12 | --installed List only installed components 13 | -q, --quiet Force the output to be a single column 14 | -h, --help Print help 15 | """ 16 | stderr = "" 17 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_component_cmd_remove_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["component", "remove", "--help"] 3 | stdout = """ 4 | ... 5 | Remove a component from a Rust toolchain 6 | 7 | Usage: rustup[EXE] component remove [OPTIONS] ... 8 | 9 | Arguments: 10 | ... 11 | 12 | Options: 13 | --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more 14 | information see `rustup help toolchain` 15 | --target 16 | -h, --help Print help 17 | """ 18 | stderr = "" 19 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["default", "--help"] 3 | stdout = """ 4 | ... 5 | Set the default toolchain 6 | 7 | Usage: rustup[EXE] default [OPTIONS] [TOOLCHAIN] 8 | 9 | Arguments: 10 | [TOOLCHAIN] 'none', a toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain 11 | name. For more information see `rustup help toolchain` 12 | 13 | Options: 14 | --force-non-host Install toolchains that require an emulator. See 15 | https://github.com/rust-lang/rustup/wiki/Non-host-toolchains 16 | -h, --help Print help 17 | 18 | Discussion: 19 | Sets the default toolchain to the one specified. If the toolchain 20 | is not already installed then it is installed first. 21 | """ 22 | stderr = "" 23 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["doc", "--help"] 3 | stdout = """ 4 | ... 5 | Open the documentation for the current toolchain 6 | 7 | Usage: rustup[EXE] doc [OPTIONS] [TOPIC] 8 | 9 | Arguments: 10 | [TOPIC] Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 11 | 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 12 | 'std::io::error::Result' etc... 13 | 14 | Options: 15 | --path Only print the path to the documentation 16 | --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more 17 | information see `rustup help toolchain` 18 | --alloc The Rust core allocation and collections library 19 | --book The Rust Programming Language book 20 | --cargo The Cargo Book 21 | --clippy The Clippy Documentation 22 | --core The Rust Core Library 23 | --edition-guide The Rust Edition Guide 24 | --embedded-book The Embedded Rust Book 25 | --error-codes The Rust Error Codes Index 26 | --nomicon The Dark Arts of Advanced and Unsafe Rust Programming 27 | --proc_macro A support library for macro authors when defining new macros 28 | --reference The Rust Reference 29 | --rust-by-example A collection of runnable examples that illustrate various Rust 30 | concepts and standard libraries 31 | --rustc The compiler for the Rust programming language 32 | --rustdoc Documentation generator for Rust projects 33 | --std Standard library API documentation 34 | --style-guide The Rust Style Guide 35 | --test Support code for rustc's built in unit-test and micro-benchmarking 36 | framework 37 | --unstable-book The Unstable Book 38 | -h, --help Print help 39 | 40 | Discussion: 41 | Opens the documentation for the currently active toolchain with 42 | the default browser. 43 | 44 | By default, it opens the documentation index. Use the various 45 | flags to open specific pieces of documentation. 46 | """ 47 | stderr = "" 48 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["help"] 3 | status.code = 0 4 | stdout = """ 5 | rustup [..] 6 | 7 | The Rust toolchain installer 8 | 9 | Usage: rustup[EXE] [OPTIONS] [+toolchain] [COMMAND] 10 | 11 | Commands: 12 | toolchain Install, uninstall, or list toolchains 13 | default Set the default toolchain 14 | show Show the active and installed toolchains or profiles 15 | update Update Rust toolchains and rustup 16 | check Check for updates to Rust toolchains and rustup 17 | target Modify a toolchain's supported targets 18 | component Modify a toolchain's installed components 19 | override Modify toolchain overrides for directories 20 | run Run a command with an environment configured for a given toolchain 21 | which Display which binary will be run for a given command 22 | doc Open the documentation for the current toolchain 23 | ... 24 | self Modify the rustup installation 25 | set Alter rustup settings 26 | completions Generate tab-completion scripts for your shell 27 | help Print this message or the help of the given subcommand(s) 28 | 29 | Arguments: 30 | [+toolchain] Release channel (e.g. +stable) or custom toolchain to set override 31 | 32 | Options: 33 | -v, --verbose Set log level to 'DEBUG' if 'RUSTUP_LOG' is unset 34 | -q, --quiet Disable progress output, set log level to 'WARN' if 'RUSTUP_LOG' is unset 35 | -h, --help Print help 36 | -V, --version Print version 37 | 38 | Discussion: 39 | Rustup installs The Rust Programming Language from the official 40 | release channels, enabling you to easily switch between stable, 41 | beta, and nightly compilers and keep them updated. It makes 42 | cross-compiling simpler with binary builds of the standard library 43 | for common platforms. 44 | 45 | If you are new to Rust consider running `rustup doc --book` to 46 | learn Rust. 47 | """ 48 | stderr = "" 49 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["--help"] 3 | status.code = 0 4 | stdout = """ 5 | rustup [..] 6 | 7 | The Rust toolchain installer 8 | 9 | Usage: rustup[EXE] [OPTIONS] [+toolchain] [COMMAND] 10 | 11 | Commands: 12 | toolchain Install, uninstall, or list toolchains 13 | default Set the default toolchain 14 | show Show the active and installed toolchains or profiles 15 | update Update Rust toolchains and rustup 16 | check Check for updates to Rust toolchains and rustup 17 | target Modify a toolchain's supported targets 18 | component Modify a toolchain's installed components 19 | override Modify toolchain overrides for directories 20 | run Run a command with an environment configured for a given toolchain 21 | which Display which binary will be run for a given command 22 | doc Open the documentation for the current toolchain 23 | ... 24 | self Modify the rustup installation 25 | set Alter rustup settings 26 | completions Generate tab-completion scripts for your shell 27 | help Print this message or the help of the given subcommand(s) 28 | 29 | Arguments: 30 | [+toolchain] Release channel (e.g. +stable) or custom toolchain to set override 31 | 32 | Options: 33 | -v, --verbose Set log level to 'DEBUG' if 'RUSTUP_LOG' is unset 34 | -q, --quiet Disable progress output, set log level to 'WARN' if 'RUSTUP_LOG' is unset 35 | -h, --help Print help 36 | -V, --version Print version 37 | 38 | Discussion: 39 | Rustup installs The Rust Programming Language from the official 40 | release channels, enabling you to easily switch between stable, 41 | beta, and nightly compilers and keep them updated. It makes 42 | cross-compiling simpler with binary builds of the standard library 43 | for common platforms. 44 | 45 | If you are new to Rust consider running `rustup doc --book` to 46 | learn Rust. 47 | """ 48 | stderr = "" 49 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["man", "--help"] 3 | stdout = """ 4 | ... 5 | View the man page for a given command 6 | 7 | Usage: rustup[EXE] man [OPTIONS] 8 | 9 | Arguments: 10 | 11 | 12 | Options: 13 | --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more 14 | information see `rustup help toolchain` 15 | -h, --help Print help 16 | """ 17 | stderr = "" 18 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml: -------------------------------------------------------------------------------- 1 | args = ["-q"] 2 | bin.name = "rustup" 3 | status.code = 1 4 | stderr = """ 5 | rustup [..] 6 | 7 | The Rust toolchain installer 8 | 9 | Usage: rustup[EXE] [OPTIONS] [+toolchain] [COMMAND] 10 | 11 | Commands: 12 | toolchain Install, uninstall, or list toolchains 13 | default Set the default toolchain 14 | show Show the active and installed toolchains or profiles 15 | update Update Rust toolchains and rustup 16 | check Check for updates to Rust toolchains and rustup 17 | target Modify a toolchain's supported targets 18 | component Modify a toolchain's installed components 19 | override Modify toolchain overrides for directories 20 | run Run a command with an environment configured for a given toolchain 21 | which Display which binary will be run for a given command 22 | doc Open the documentation for the current toolchain 23 | ... 24 | self Modify the rustup installation 25 | set Alter rustup settings 26 | completions Generate tab-completion scripts for your shell 27 | help Print this message or the help of the given subcommand(s) 28 | 29 | Arguments: 30 | [+toolchain] 31 | Release channel (e.g. +stable) or custom toolchain to set override 32 | 33 | Options: 34 | -v, --verbose 35 | Set log level to 'DEBUG' if 'RUSTUP_LOG' is unset 36 | 37 | -q, --quiet 38 | Disable progress output, set log level to 'WARN' if 'RUSTUP_LOG' is unset 39 | 40 | -h, --help 41 | Print help 42 | 43 | -V, --version 44 | Print version 45 | 46 | Discussion: 47 | Rustup installs The Rust Programming Language from the official 48 | release channels, enabling you to easily switch between stable, 49 | beta, and nightly compilers and keep them updated. It makes 50 | cross-compiling simpler with binary builds of the standard library 51 | for common platforms. 52 | 53 | If you are new to Rust consider running `rustup doc --book` to 54 | learn Rust. 55 | 56 | """ 57 | stdout = "" 58 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["override", "add", "--help"] 3 | stdout = """ 4 | ... 5 | Set the override toolchain for a directory 6 | 7 | Usage: rustup[EXE] override set [OPTIONS] 8 | 9 | Arguments: 10 | Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name. For 11 | more information see `rustup help toolchain` 12 | 13 | Options: 14 | --path Path to the directory 15 | -h, --help Print help 16 | """ 17 | stderr = "" 18 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["override", "--help"] 3 | stdout = """ 4 | ... 5 | Modify toolchain overrides for directories 6 | 7 | Usage: rustup[EXE] override 8 | 9 | Commands: 10 | list List directory toolchain overrides 11 | set Set the override toolchain for a directory 12 | unset Remove the override toolchain for a directory 13 | help Print this message or the help of the given subcommand(s) 14 | 15 | Options: 16 | -h, --help Print help 17 | 18 | Discussion: 19 | Overrides configure Rustup to use a specific toolchain when 20 | running in a specific directory. 21 | 22 | Directories can be assigned their own Rust toolchain with `rustup 23 | override`. When a directory has an override then any time `rustc` 24 | or `cargo` is run inside that directory, or one of its child 25 | directories, the override toolchain will be invoked. 26 | 27 | To pin to a specific nightly: 28 | 29 | $ rustup override set nightly-2014-12-18 30 | 31 | Or a specific stable release: 32 | 33 | $ rustup override set 1.0.0 34 | 35 | To see the active toolchain use `rustup show`. To remove the 36 | override and use the default toolchain again, `rustup override 37 | unset`. 38 | """ 39 | stderr = "" 40 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_override_cmd_list_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["override", "list", "--help"] 3 | stdout = """ 4 | ... 5 | List directory toolchain overrides 6 | 7 | Usage: rustup[EXE] override list 8 | 9 | Options: 10 | -h, --help Print help 11 | """ 12 | stderr = "" 13 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["override", "remove", "--help"] 3 | stdout = """ 4 | ... 5 | Remove the override toolchain for a directory 6 | 7 | Usage: rustup[EXE] override unset [OPTIONS] 8 | 9 | Options: 10 | --path Path to the directory 11 | --nonexistent Remove override toolchain for all nonexistent directories 12 | -h, --help Print help 13 | 14 | Discussion: 15 | If `--path` argument is present, removes the override toolchain 16 | for the specified directory. If `--nonexistent` argument is 17 | present, removes the override toolchain for all nonexistent 18 | directories. Otherwise, removes the override toolchain for the 19 | current directory. 20 | """ 21 | stderr = "" 22 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["override", "set", "--help"] 3 | stdout = """ 4 | ... 5 | Set the override toolchain for a directory 6 | 7 | Usage: rustup[EXE] override set [OPTIONS] 8 | 9 | Arguments: 10 | Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name. For 11 | more information see `rustup help toolchain` 12 | 13 | Options: 14 | --path Path to the directory 15 | -h, --help Print help 16 | """ 17 | stderr = "" 18 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["override", "unset", "--help"] 3 | stdout = """ 4 | ... 5 | Remove the override toolchain for a directory 6 | 7 | Usage: rustup[EXE] override unset [OPTIONS] 8 | 9 | Options: 10 | --path Path to the directory 11 | --nonexistent Remove override toolchain for all nonexistent directories 12 | -h, --help Print help 13 | 14 | Discussion: 15 | If `--path` argument is present, removes the override toolchain 16 | for the specified directory. If `--nonexistent` argument is 17 | present, removes the override toolchain for all nonexistent 18 | directories. Otherwise, removes the override toolchain for the 19 | current directory. 20 | """ 21 | stderr = "" 22 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | args = ["run", "--help"] 2 | bin.name = "rustup" 3 | stderr = "" 4 | stdout = """ 5 | ... 6 | Run a command with an environment configured for a given toolchain 7 | 8 | Usage: rustup[EXE] run [OPTIONS] ... 9 | 10 | Arguments: 11 | Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name, or 12 | an absolute path. For more information see `rustup help toolchain` 13 | ... 14 | 15 | Options: 16 | --install Install the requested toolchain if needed 17 | -h, --help Print help 18 | 19 | Discussion: 20 | Configures an environment to use the given toolchain and then runs 21 | the specified program. The command may be any program, not just 22 | rustc or cargo. This can be used for testing arbitrary toolchains 23 | without setting an override. 24 | 25 | Commands explicitly proxied by `rustup` (such as `rustc` and 26 | `cargo`) also have a shorthand for this available. The toolchain 27 | can be set by using `+toolchain` as the first argument. These are 28 | equivalent: 29 | 30 | $ cargo +nightly build 31 | 32 | $ rustup run nightly cargo build 33 | """ 34 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_self_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["self", "--help"] 3 | stdout = """ 4 | ... 5 | Modify the rustup installation 6 | 7 | Usage: rustup[EXE] self 8 | 9 | Commands: 10 | update Download and install updates to rustup 11 | uninstall Uninstall rustup 12 | upgrade-data Upgrade the internal data format 13 | help Print this message or the help of the given subcommand(s) 14 | 15 | Options: 16 | -h, --help Print help 17 | """ 18 | stderr = "" 19 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_self_cmd_uninstall_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["self", "uninstall", "--help"] 3 | stdout = """ 4 | ... 5 | Uninstall rustup 6 | 7 | Usage: rustup[EXE] self uninstall [OPTIONS] 8 | 9 | Options: 10 | -y 11 | -h, --help Print help 12 | """ 13 | stderr = "" 14 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_self_cmd_update_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["self", "update", "--help"] 3 | stdout = """ 4 | ... 5 | Download and install updates to rustup 6 | 7 | Usage: rustup[EXE] self update 8 | 9 | Options: 10 | -h, --help Print help 11 | """ 12 | stderr = "" 13 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_self_cmd_upgrade-data _cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["self", "upgrade-data", "--help"] 3 | stdout = """ 4 | ... 5 | Upgrade the internal data format 6 | 7 | Usage: rustup[EXE] self upgrade-data 8 | 9 | Options: 10 | -h, --help Print help 11 | """ 12 | stderr = "" 13 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_set_cmd_auto-install_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["set", "auto-install", "--help"] 3 | stdout = """ 4 | ... 5 | The auto toolchain install mode 6 | 7 | Usage: rustup[EXE] set auto-install [AUTO_INSTALL_MODE] 8 | 9 | Arguments: 10 | [AUTO_INSTALL_MODE] [default: enable] [possible values: enable, disable] 11 | 12 | Options: 13 | -h, --help Print help 14 | """ 15 | stderr = "" 16 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_set_cmd_auto-self-update_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["set", "auto-self-update", "--help"] 3 | stdout = """ 4 | ... 5 | The rustup auto self update mode 6 | 7 | Usage: rustup[EXE] set auto-self-update [AUTO_SELF_UPDATE_MODE] 8 | 9 | Arguments: 10 | [AUTO_SELF_UPDATE_MODE] [default: enable] [possible values: enable, disable, check-only] 11 | 12 | Options: 13 | -h, --help Print help 14 | """ 15 | stderr = "" 16 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_set_cmd_default-host_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["set", "default-host", "--help"] 3 | stdout = """ 4 | ... 5 | The triple used to identify toolchains when not specified 6 | 7 | Usage: rustup[EXE] set default-host 8 | 9 | Arguments: 10 | 11 | 12 | Options: 13 | -h, --help Print help 14 | """ 15 | stderr = "" 16 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["set", "--help"] 3 | stdout = """ 4 | ... 5 | Alter rustup settings 6 | 7 | Usage: rustup[EXE] set 8 | 9 | Commands: 10 | default-host The triple used to identify toolchains when not specified 11 | profile The default components installed with a toolchain 12 | auto-self-update The rustup auto self update mode 13 | auto-install The auto toolchain install mode 14 | help Print this message or the help of the given subcommand(s) 15 | 16 | Options: 17 | -h, --help Print help 18 | """ 19 | stderr = "" 20 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["set", "profile", "--help"] 3 | stdout = """ 4 | ... 5 | The default components installed with a toolchain 6 | 7 | Usage: rustup[EXE] set profile [PROFILE_NAME] 8 | 9 | Arguments: 10 | [PROFILE_NAME] [default: default] [possible values: minimal, default, complete] 11 | 12 | Options: 13 | -h, --help Print help 14 | """ 15 | stderr = "" 16 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["show", "active-toolchain", "--help"] 3 | stdout = """ 4 | ... 5 | Show the active toolchain 6 | 7 | Usage: rustup[EXE] show active-toolchain [OPTIONS] 8 | 9 | Options: 10 | -v, --verbose Enable verbose output with rustc information 11 | -h, --help Print help 12 | 13 | Discussion: 14 | Shows the name of the active toolchain. 15 | 16 | This is useful for figuring out the active tool chain from 17 | scripts. 18 | 19 | You should use `rustc --print sysroot` to get the sysroot, or 20 | `rustc --version` to get the toolchain version. 21 | """ 22 | stderr = "" 23 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["show", "--help"] 3 | stdout = """ 4 | ... 5 | Show the active and installed toolchains or profiles 6 | 7 | Usage: rustup[EXE] show [OPTIONS] [COMMAND] 8 | 9 | Commands: 10 | active-toolchain Show the active toolchain 11 | home Display the computed value of RUSTUP_HOME 12 | profile Show the default profile used for the `rustup install` command 13 | help Print this message or the help of the given subcommand(s) 14 | 15 | Options: 16 | -v, --verbose Enable verbose output with rustc information for all installed toolchains 17 | -h, --help Print help 18 | 19 | Discussion: 20 | Shows the name of the active toolchain and the version of `rustc`. 21 | 22 | If the active toolchain has installed support for additional 23 | compilation targets, then they are listed as well. 24 | 25 | If there are multiple toolchains installed then all installed 26 | toolchains are listed as well. 27 | """ 28 | stderr = "" 29 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_show_cmd_home_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["show", "home", "--help"] 3 | stdout = """ 4 | ... 5 | Display the computed value of RUSTUP_HOME 6 | 7 | Usage: rustup[EXE] show home 8 | 9 | Options: 10 | -h, --help Print help 11 | """ 12 | stderr = "" 13 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["show", "profile", "--help"] 3 | stdout = """ 4 | ... 5 | Show the default profile used for the `rustup install` command 6 | 7 | Usage: rustup[EXE] show profile 8 | 9 | Options: 10 | -h, --help Print help 11 | """ 12 | stderr = "" 13 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_target_cmd_add_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["target", "add", "--help"] 3 | stdout = """ 4 | ... 5 | Add a target to a Rust toolchain 6 | 7 | Usage: rustup[EXE] target add [OPTIONS] ... 8 | 9 | Arguments: 10 | ... List of targets to install; \"all\" installs all available targets 11 | 12 | Options: 13 | --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more 14 | information see `rustup help toolchain` 15 | -h, --help Print help 16 | """ 17 | stderr = "" 18 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_target_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["target", "--help"] 3 | stdout = """ 4 | ... 5 | Modify a toolchain's supported targets 6 | 7 | Usage: rustup[EXE] target 8 | 9 | Commands: 10 | list List installed and available targets 11 | add Add a target to a Rust toolchain 12 | remove Remove a target from a Rust toolchain 13 | help Print this message or the help of the given subcommand(s) 14 | 15 | Options: 16 | -h, --help Print help 17 | """ 18 | stderr = "" 19 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_target_cmd_list_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["target", "list", "--help"] 3 | stdout = """ 4 | ... 5 | List installed and available targets 6 | 7 | Usage: rustup[EXE] target list [OPTIONS] 8 | 9 | Options: 10 | --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more 11 | information see `rustup help toolchain` 12 | --installed List only installed targets 13 | -q, --quiet Force the output to be a single column 14 | -h, --help Print help 15 | """ 16 | stderr = "" 17 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_target_cmd_remove_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["target", "remove", "--help"] 3 | stdout = """ 4 | ... 5 | Remove a target from a Rust toolchain 6 | 7 | Usage: rustup[EXE] target remove [OPTIONS] ... 8 | 9 | Arguments: 10 | ... List of targets to uninstall 11 | 12 | Options: 13 | --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more 14 | information see `rustup help toolchain` 15 | -h, --help Print help 16 | """ 17 | stderr = "" 18 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["toolchain", "--help"] 3 | stdout = """ 4 | ... 5 | Install, uninstall, or list toolchains 6 | 7 | Usage: rustup[EXE] toolchain 8 | 9 | Commands: 10 | list List installed toolchains 11 | install Install or update the given toolchains, or by default the active toolchain 12 | uninstall Uninstall the given toolchains 13 | link Create a custom toolchain by symlinking to a directory 14 | help Print this message or the help of the given subcommand(s) 15 | 16 | Options: 17 | -h, --help Print help 18 | 19 | Discussion: 20 | Many `rustup` commands deal with *toolchains*, a single 21 | installation of the Rust compiler. `rustup` supports multiple 22 | types of toolchains. The most basic track the official release 23 | channels: 'stable', 'beta' and 'nightly'; but `rustup` can also 24 | install specific toolchains from the official archives, toolchains for 25 | alternate host platforms, and from local builds ('custom toolchains'). 26 | 27 | Standard release channel toolchain names have the following form: 28 | 29 | [-][-] 30 | 31 | = stable|beta|nightly|[-] 32 | = | 33 | = beta[.] 34 | = YYYY-MM-DD 35 | = 36 | 37 | 'channel' is a named release channel, a major and minor version 38 | number such as `1.42`, or a fully specified version number, such 39 | as `1.42.0`. Channel names can be optionally appended with an 40 | archive date, as in `nightly-2014-12-18`, in which case the 41 | toolchain is downloaded from the archive for that date. 42 | 43 | The host may be specified as a target triple. This is most useful 44 | for installing a 32-bit compiler on a 64-bit platform, or for 45 | installing the [MSVC-based toolchain] on Windows. For example: 46 | 47 | $ rustup toolchain install stable-x86_64-pc-windows-msvc 48 | 49 | For convenience, omitted elements of the target triple will be 50 | inferred, so the above could be written: 51 | 52 | $ rustup toolchain install stable-msvc 53 | 54 | The `rustup default` command may be used to both install and set 55 | the desired toolchain as default in a single command: 56 | 57 | $ rustup default stable-msvc 58 | 59 | rustup can also manage symlinked local toolchain builds, which are 60 | often used for developing Rust itself. For more information see 61 | `rustup toolchain help link`. 62 | """ 63 | stderr = "" 64 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["toolchain", "install", "--help"] 3 | stdout = """ 4 | Install or update the given toolchains, or by default the active toolchain 5 | 6 | Usage: rustup[EXE] toolchain install [OPTIONS] [TOOLCHAIN]... 7 | 8 | Arguments: 9 | [TOOLCHAIN]... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see 10 | `rustup help toolchain` 11 | 12 | Options: 13 | --profile [possible values: minimal, default, complete] 14 | -c, --component Comma-separated list of components to be added on installation 15 | -t, --target Comma-separated list of targets to be added on installation 16 | --no-self-update Don't perform self update when running the `rustup toolchain install` 17 | command 18 | --force Force an update, even if some components are missing 19 | --allow-downgrade Allow rustup to downgrade the toolchain to satisfy your component 20 | choice 21 | --force-non-host Install toolchains that require an emulator. See 22 | https://github.com/rust-lang/rustup/wiki/Non-host-toolchains 23 | -h, --help Print help 24 | """ 25 | stderr = "" 26 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["toolchain", "link", "--help"] 3 | stdout = """ 4 | ... 5 | Create a custom toolchain by symlinking to a directory 6 | 7 | Usage: rustup[EXE] toolchain link 8 | 9 | Arguments: 10 | Custom toolchain name 11 | Path to the directory 12 | 13 | Options: 14 | -h, --help Print help 15 | 16 | Discussion: 17 | 'toolchain' is the custom name to be assigned to the new toolchain. 18 | Any name is permitted as long as: 19 | - it does not include '/' or '/' except as the last character 20 | - it is not equal to 'none' 21 | - it does not fully match an initialsubstring of a standard release channel. 22 | For example, you can use the names 'latest' or '2017-04-01' but you cannot 23 | use 'stable' or 'beta-i686' or 'nightly-x86_64-unknown-linux-gnu'. 24 | 25 | 'path' specifies the directory where the binaries and libraries for 26 | the custom toolchain can be found. For example, when used for 27 | development of Rust itself, toolchains can be linked directly out of 28 | the build directory. After building, you can test out different 29 | compiler versions as follows: 30 | 31 | $ rustup toolchain link latest-stage1 build/x86_64-unknown-linux-gnu/stage1 32 | $ rustup override set latest-stage1 33 | 34 | If you now compile a crate in the current directory, the custom 35 | toolchain 'latest-stage1' will be used. 36 | """ 37 | stderr = "" 38 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_toolchain_cmd_list_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["toolchain", "list", "--help"] 3 | stdout = """ 4 | ... 5 | List installed toolchains 6 | 7 | Usage: rustup[EXE] toolchain list [OPTIONS] 8 | 9 | Options: 10 | -v, --verbose Enable verbose output with toolchain information 11 | -q, --quiet Force the output to be a single column 12 | -h, --help Print help 13 | """ 14 | stderr = "" 15 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["toolchain", "uninstall", "--help"] 3 | stdout = """ 4 | Uninstall the given toolchains 5 | 6 | Usage: rustup[EXE] toolchain uninstall ... 7 | 8 | Arguments: 9 | ... Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name. 10 | For more information see `rustup help toolchain` 11 | 12 | Options: 13 | -h, --help Print help 14 | """ 15 | stderr = "" 16 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["random"] 3 | status.code = 1 4 | stdout = "" 5 | stderr = """ 6 | error: invalid value 'random' for '[+toolchain]': error: \"random\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. To override the toolchain using the 'rustup +toolchain' syntax, make sure to prefix the toolchain override with a '+' 7 | 8 | For more information, try '--help'. 9 | """ 10 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["up", "--help"] 3 | stdout = """ 4 | ... 5 | Update Rust toolchains and rustup 6 | 7 | Usage: rustup[EXE] update [OPTIONS] [TOOLCHAIN]... 8 | 9 | Arguments: 10 | [TOOLCHAIN]... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see 11 | `rustup help toolchain` 12 | 13 | Options: 14 | --no-self-update Don't perform self update when running the `rustup update` command 15 | --force Force an update, even if some components are missing 16 | --force-non-host Install toolchains that require an emulator. See 17 | https://github.com/rust-lang/rustup/wiki/Non-host-toolchains 18 | -h, --help Print help 19 | 20 | Discussion: 21 | With no toolchain specified, the `update` command updates each of 22 | the installed toolchains from the official release channels, then 23 | updates rustup itself. 24 | 25 | If given a toolchain argument then `update` updates that 26 | toolchain, the same as `rustup toolchain install`. 27 | """ 28 | stderr = "" 29 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["update", "--help"] 3 | stdout = """ 4 | ... 5 | Update Rust toolchains and rustup 6 | 7 | Usage: rustup[EXE] update [OPTIONS] [TOOLCHAIN]... 8 | 9 | Arguments: 10 | [TOOLCHAIN]... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see 11 | `rustup help toolchain` 12 | 13 | Options: 14 | --no-self-update Don't perform self update when running the `rustup update` command 15 | --force Force an update, even if some components are missing 16 | --force-non-host Install toolchains that require an emulator. See 17 | https://github.com/rust-lang/rustup/wiki/Non-host-toolchains 18 | -h, --help Print help 19 | 20 | Discussion: 21 | With no toolchain specified, the `update` command updates each of 22 | the installed toolchains from the official release channels, then 23 | updates rustup itself. 24 | 25 | If given a toolchain argument then `update` updates that 26 | toolchain, the same as `rustup toolchain install`. 27 | """ 28 | stderr = "" 29 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | bin.name = "rustup" 2 | args = ["upgrade", "--help"] 3 | stdout = """ 4 | ... 5 | Update Rust toolchains and rustup 6 | 7 | Usage: rustup[EXE] update [OPTIONS] [TOOLCHAIN]... 8 | 9 | Arguments: 10 | [TOOLCHAIN]... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see 11 | `rustup help toolchain` 12 | 13 | Options: 14 | --no-self-update Don't perform self update when running the `rustup update` command 15 | --force Force an update, even if some components are missing 16 | --force-non-host Install toolchains that require an emulator. See 17 | https://github.com/rust-lang/rustup/wiki/Non-host-toolchains 18 | -h, --help Print help 19 | 20 | Discussion: 21 | With no toolchain specified, the `update` command updates each of 22 | the installed toolchains from the official release channels, then 23 | updates rustup itself. 24 | 25 | If given a toolchain argument then `update` updates that 26 | toolchain, the same as `rustup toolchain install`. 27 | """ 28 | stderr = "" 29 | -------------------------------------------------------------------------------- /tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml: -------------------------------------------------------------------------------- 1 | args = ["which", "--help"] 2 | bin.name = "rustup" 3 | stderr = "" 4 | stdout = """ 5 | ... 6 | Display which binary will be run for a given command 7 | 8 | Usage: rustup[EXE] which [OPTIONS] 9 | 10 | Arguments: 11 | 12 | 13 | Options: 14 | --toolchain Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom 15 | toolchain name. For more information see `rustup help toolchain` 16 | -h, --help Print help 17 | """ 18 | -------------------------------------------------------------------------------- /tests/suite/cli_ui.rs: -------------------------------------------------------------------------------- 1 | use std::{fs, path::PathBuf}; 2 | 3 | #[test] 4 | fn rustup_ui_doc_text_tests() { 5 | let t = trycmd::TestCases::new(); 6 | let home = tempfile::TempDir::new().unwrap(); 7 | let rustup_init = trycmd::cargo::cargo_bin("rustup-init"); 8 | let rustup = trycmd::cargo::cargo_bin("rustup"); 9 | // Copy rustup-init to rustup so that the tests can run it. 10 | fs::copy(rustup_init, &rustup).unwrap(); 11 | t.register_bin("rustup", &rustup); 12 | t.case("tests/suite/cli-ui/rustup/*.toml"); 13 | // once installed rustup asserts the presence of ~/.rustup/settings.toml if 14 | // Config is instantiated. 15 | t.env("HOME", home.path().to_string_lossy()); 16 | #[cfg(target_os = "windows")] 17 | { 18 | // On windows, we don't have man command, so skip the test. 19 | t.skip("tests/suite/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml"); 20 | } 21 | } 22 | 23 | #[test] 24 | fn rustup_init_ui_doc_text_tests() { 25 | let t = trycmd::TestCases::new(); 26 | let rustup_init = trycmd::cargo::cargo_bin("rustup-init"); 27 | let project_root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); 28 | t.register_bin("rustup-init", &rustup_init); 29 | t.register_bin("rustup-init.sh", project_root.join("rustup-init.sh")); 30 | t.case("tests/suite/cli-ui/rustup-init/*.toml"); 31 | #[cfg(target_os = "windows")] 32 | { 33 | // On windows, we don't use rustup-init.sh, so skip the test. 34 | t.skip("tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml"); 35 | } 36 | 37 | // On non-windows, we don't use rustup-init.sh, so skip the test. 38 | #[cfg(not(target_os = "windows"))] 39 | { 40 | let rustup_init_help_toml = 41 | project_root.join("tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml"); 42 | let rustup_init_sh_help_toml = project_root 43 | .join("tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml"); 44 | 45 | #[derive(Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)] 46 | struct Stdout { 47 | #[serde(default)] 48 | pub(crate) stdout: Option, 49 | } 50 | let rustup_init_help_std_out: Stdout = 51 | toml::from_str(fs::read_to_string(rustup_init_help_toml).unwrap().as_str()).unwrap(); 52 | let rustup_init_sh_help_std_out: Stdout = toml::from_str( 53 | fs::read_to_string(rustup_init_sh_help_toml) 54 | .unwrap() 55 | .as_str(), 56 | ) 57 | .unwrap(); 58 | 59 | // Make sure that the help output of rustup-init and rustup-init.sh are the same. 60 | assert_eq!( 61 | rustup_init_help_std_out.stdout.unwrap(), 62 | rustup_init_sh_help_std_out.stdout.unwrap() 63 | ) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/suite/known_triples.rs: -------------------------------------------------------------------------------- 1 | use std::{collections::BTreeSet, io::Write}; 2 | 3 | use platforms::Platform; 4 | 5 | #[test] 6 | fn gen_known_triples() { 7 | let out_path = "src/dist/triple/known.rs"; 8 | let existing = std::fs::read_to_string(out_path).unwrap(); 9 | 10 | let (mut archs, mut oses, mut envs) = (BTreeSet::new(), BTreeSet::new(), BTreeSet::new()); 11 | for (arch, os, env) in Platform::ALL.iter().map(|p| parse_triple(p.target_triple)) { 12 | archs.insert(arch); 13 | oses.insert(os); 14 | if !env.is_empty() { 15 | envs.insert(env); 16 | } 17 | } 18 | 19 | let expected = { 20 | let mut buf = String::new(); 21 | 22 | buf.push_str("pub static LIST_ARCHS: &[&str] = &[\n"); 23 | for arch in archs { 24 | buf.push_str(&format!(" \"{arch}\",\n")); 25 | } 26 | buf.push_str("];\n"); 27 | 28 | buf.push_str("pub static LIST_OSES: &[&str] = &[\n"); 29 | for os in oses { 30 | buf.push_str(&format!(" \"{os}\",\n")); 31 | } 32 | buf.push_str("];\n"); 33 | 34 | buf.push_str("pub static LIST_ENVS: &[&str] = &[\n"); 35 | for env in envs { 36 | buf.push_str(&format!(" \"{env}\",\n")); 37 | } 38 | buf.push_str("];\n"); 39 | 40 | buf 41 | }; 42 | 43 | if expected != existing { 44 | let mut tmp_file = tempfile::NamedTempFile::new().unwrap(); 45 | tmp_file.write_all(expected.as_bytes()).unwrap(); 46 | std::fs::rename(tmp_file.path(), out_path).unwrap(); 47 | panic!( 48 | "outdated generated code detected at `{out_path}`, the file has been updated in place" 49 | ); 50 | } 51 | } 52 | 53 | /// Parses the given triple into 3 parts (target architecture, OS and environment). 54 | /// 55 | /// # Discussion 56 | /// 57 | /// The current model of target triples in Rustup requires some non-code knowledge to correctly generate the list. 58 | /// For example, the parsing results of two 2-dash triples can be different: 59 | /// 60 | /// ```jsonc 61 | /// { arch: aarch64, os: linux, env: android } 62 | /// { arch: aarch64, os: unknown-freebsd} 63 | /// ``` 64 | /// 65 | /// Thus, the following parsing scheme is used: 66 | /// 67 | /// ```jsonc 68 | /// // for `x-y` 69 | /// { arch: x, os: y } 70 | /// 71 | /// // special case for `x-y-w` where `y` is `none` or `linux` 72 | /// // e.g. `thumbv4t-none-eabi`, `i686-linux-android` 73 | /// // (should've been called `x-unknown-y-w`, but alas) 74 | /// { arch: x, os: y, env: w } 75 | /// 76 | /// // for `x-y-z` 77 | /// { arch: x, os: y-z } 78 | /// 79 | /// // for `x-y-z-w` 80 | /// { arch: x, os: y-z, env: w } 81 | /// ``` 82 | fn parse_triple(triple: &str) -> (&str, &str, &str) { 83 | match triple.split('-').collect::>()[..] { 84 | [arch, os] => (arch, os, ""), 85 | [arch, os @ ("none" | "linux"), env] => (arch, os, env), 86 | [arch, _, _] => (arch, &triple[(arch.len() + 1)..], ""), 87 | [arch, _, _, env] => ( 88 | arch, 89 | &triple[(arch.len() + 1)..(triple.len() - env.len() - 1)], 90 | env, 91 | ), 92 | _ => panic!( 93 | "Internal error while parsing target triple `{triple}`, please file an issue at https://github.com/rust-lang/rustup/issues" 94 | ), 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /tests/suite/mod.rs: -------------------------------------------------------------------------------- 1 | mod cli_exact; 2 | mod cli_inst_interactive; 3 | mod cli_misc; 4 | mod cli_paths; 5 | mod cli_rustup; 6 | mod cli_self_upd; 7 | mod cli_ui; 8 | mod cli_v1; 9 | mod cli_v2; 10 | mod dist_install; 11 | mod known_triples; 12 | -------------------------------------------------------------------------------- /tests/test_bonanza.rs: -------------------------------------------------------------------------------- 1 | #![recursion_limit = "256"] 2 | 3 | mod suite; 4 | -------------------------------------------------------------------------------- /triagebot.toml: -------------------------------------------------------------------------------- 1 | [relabel] 2 | 3 | allow-unauthenticated = [ 4 | "bug", 5 | "duplicate", 6 | "enhancement", 7 | "forwarded", 8 | "performance", 9 | "question", 10 | "security", 11 | "tracking", 12 | "website", 13 | "O-*", 14 | "A-*", 15 | ] 16 | 17 | [assign] 18 | 19 | # Enable issue transfers within the org 20 | # Documentation at: https://forge.rust-lang.org/triagebot/transfer.html 21 | [transfer] 22 | -------------------------------------------------------------------------------- /www/fonts/AlfaSlabOne-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/www/fonts/AlfaSlabOne-Regular.woff -------------------------------------------------------------------------------- /www/fonts/AlfaSlabOne-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/www/fonts/AlfaSlabOne-Regular.woff2 -------------------------------------------------------------------------------- /www/fonts/FiraMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/www/fonts/FiraMono-Regular.ttf -------------------------------------------------------------------------------- /www/fonts/FiraSans-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/www/fonts/FiraSans-Light.woff -------------------------------------------------------------------------------- /www/fonts/FiraSans-Medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/www/fonts/FiraSans-Medium.woff -------------------------------------------------------------------------------- /www/fonts/FiraSans-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/www/fonts/FiraSans-Regular.woff -------------------------------------------------------------------------------- /www/fonts/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Raph Levien (firstname.lastname@gmail.com), Copyright (c) 2012, Cyreal (cyreal.org) 2 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 3 | This license is copied below, and is also available with a FAQ at: 4 | http://scripts.sil.org/OFL 5 | 6 | 7 | ----------------------------------------------------------- 8 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 9 | ----------------------------------------------------------- 10 | 11 | PREAMBLE 12 | The goals of the Open Font License (OFL) are to stimulate worldwide 13 | development of collaborative font projects, to support the font creation 14 | efforts of academic and linguistic communities, and to provide a free and 15 | open framework in which fonts may be shared and improved in partnership 16 | with others. 17 | 18 | The OFL allows the licensed fonts to be used, studied, modified and 19 | redistributed freely as long as they are not sold by themselves. The 20 | fonts, including any derivative works, can be bundled, embedded, 21 | redistributed and/or sold with any software provided that any reserved 22 | names are not used by derivative works. The fonts and derivatives, 23 | however, cannot be released under any other type of license. The 24 | requirement for fonts to remain under this license does not apply 25 | to any document created using the fonts or their derivatives. 26 | 27 | DEFINITIONS 28 | "Font Software" refers to the set of files released by the Copyright 29 | Holder(s) under this license and clearly marked as such. This may 30 | include source files, build scripts and documentation. 31 | 32 | "Reserved Font Name" refers to any names specified as such after the 33 | copyright statement(s). 34 | 35 | "Original Version" refers to the collection of Font Software components as 36 | distributed by the Copyright Holder(s). 37 | 38 | "Modified Version" refers to any derivative made by adding to, deleting, 39 | or substituting -- in part or in whole -- any of the components of the 40 | Original Version, by changing formats or by porting the Font Software to a 41 | new environment. 42 | 43 | "Author" refers to any designer, engineer, programmer, technical 44 | writer or other person who contributed to the Font Software. 45 | 46 | PERMISSION & CONDITIONS 47 | Permission is hereby granted, free of charge, to any person obtaining 48 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 49 | redistribute, and sell modified and unmodified copies of the Font 50 | Software, subject to the following conditions: 51 | 52 | 1) Neither the Font Software nor any of its individual components, 53 | in Original or Modified Versions, may be sold by itself. 54 | 55 | 2) Original or Modified Versions of the Font Software may be bundled, 56 | redistributed and/or sold with any software, provided that each copy 57 | contains the above copyright notice and this license. These can be 58 | included either as stand-alone text files, human-readable headers or 59 | in the appropriate machine-readable metadata fields within text or 60 | binary files as long as those fields can be easily viewed by the user. 61 | 62 | 3) No Modified Version of the Font Software may use the Reserved Font 63 | Name(s) unless explicit written permission is granted by the corresponding 64 | Copyright Holder. This restriction only applies to the primary font name as 65 | presented to the users. 66 | 67 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 68 | Software shall not be used to promote, endorse or advertise any 69 | Modified Version, except to acknowledge the contribution(s) of the 70 | Copyright Holder(s) and the Author(s) or with their explicit written 71 | permission. 72 | 73 | 5) The Font Software, modified or unmodified, in part or in whole, 74 | must be distributed entirely under this license, and must not be 75 | distributed under any other license. The requirement for fonts to 76 | remain under this license does not apply to any document created 77 | using the Font Software. 78 | 79 | TERMINATION 80 | This license becomes null and void if any of the above conditions are 81 | not met. 82 | 83 | DISCLAIMER 84 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 85 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 86 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 87 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 88 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 89 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 90 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 91 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 92 | OTHER DEALINGS IN THE FONT SOFTWARE. 93 | -------------------------------------------------------------------------------- /www/fonts/WorkSans-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustup/5cabb50dddf3cf77050df892d28aa32cd0a4159a/www/fonts/WorkSans-Medium.ttf -------------------------------------------------------------------------------- /www/website_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "headers": { 3 | "Strict-Transport-Security": "max-age=63072000; includeSubDomains; preload", 4 | "X-Content-Type-Options": "nosniff", 5 | "X-Frame-Options": "DENY", 6 | "X-XSS-Protection": "1; mode=block", 7 | "Referrer-Policy": "no-referrer, strict-origin-when-cross-origin", 8 | "Content-Security-Policy": "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' https://www.rust-lang.org; font-src 'self'" 9 | } 10 | } 11 | --------------------------------------------------------------------------------