Skip to content

Commit 8cb4012

Browse files
tgross35ojeda
authored andcommitted
docs: rust: update instructions for obtaining 'core' source
The source for Rust's 'core' library is needed to build the kernel with Rust support. This sometimes needs to be obtained by hand when using a standalone version of 'rustc' not managed by 'rustup'. Currently, the documentation suggests cloning the 'rust' repository to obtain these sources, but this is quite slow (on the order of a multiple minutes). Change this documentation to suggest using the source tarball instead. The tarball includes only needed files (<5M) and is significantly faster to download; this is more in line with what 'rustup' does. Also simplify wording of the relevant section. Link: #1024 Signed-off-by: Trevor Gross <[email protected]> Reviewed-by: Martin Rodriguez Reboredo <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent b603c6c commit 8cb4012

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Documentation/rust/quick-start.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,17 @@ If ``rustup`` is being used, run::
5656
The components are installed per toolchain, thus upgrading the Rust compiler
5757
version later on requires re-adding the component.
5858

59-
Otherwise, if a standalone installer is used, the Rust repository may be cloned
60-
into the installation folder of the toolchain::
59+
Otherwise, if a standalone installer is used, the Rust source tree may be
60+
downloaded into the toolchain's installation folder::
6161

62-
git clone --recurse-submodules \
63-
--branch $(scripts/min-tool-version.sh rustc) \
64-
https://github.com/rust-lang/rust \
65-
$(rustc --print sysroot)/lib/rustlib/src/rust
62+
curl -L "https://static.rust-lang.org/dist/rust-src-$(scripts/min-tool-version.sh rustc).tar.gz" |
63+
tar -xzf - -C "$(rustc --print sysroot)/lib" \
64+
"rust-src-$(scripts/min-tool-version.sh rustc)/rust-src/lib/" \
65+
--strip-components=3
6666

6767
In this case, upgrading the Rust compiler version later on requires manually
68-
updating this clone.
68+
updating the source tree (this can be done by removing ``$(rustc --print
69+
sysroot)/lib/rustlib/src/rust`` then rerunning the above command).
6970

7071

7172
libclang

0 commit comments

Comments
 (0)