rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] docs: rust: update instructions for obtaining 'core' source
@ 2023-08-03  6:04 Trevor Gross
  2023-08-03  6:04 ` [PATCH v2 1/2] " Trevor Gross
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Trevor Gross @ 2023-08-03  6:04 UTC (permalink / raw)
  To: ojeda, alex.gaynor, wedsonaf
  Cc: boqun.feng, gary, bjorn3_gh, benno.lossin, corbet, yakoyoku,
	aliceryhl, tmgross, linux-doc, rust-for-linux, linux-kernel

This changes the suggested method of obtaining Rust's source to using the
tarball rather than a full clone, and adds a clarification about 'rustup
override'.

v1: https://lore.kernel.org/rust-for-linux/CANiq72=L+_1OctE_fgeXfmzL2PCZmmMLW9i0GJZyCcf=B_=pRQ@mail.gmail.com/T/#me4f16f7383491549da9fe73a0274d8e7caacab0d

v1 -> v2:
- Added quotes as suggested by Alice [1]
- Reword commit messages as suggested by Miguel [2]

[1]: https://lore.kernel.org/rust-for-linux/20230720134428.3547917-1-aliceryhl@google.com/
[2]: https://lore.kernel.org/rust-for-linux/CANiq72=L+_1OctE_fgeXfmzL2PCZmmMLW9i0GJZyCcf=B_=pRQ@mail.gmail.com/#t

(Sorry for those who got this twice, I accidentally got the reviewers with
my test email.)

Trevor Gross (2):
  docs: rust: update instructions for obtaining 'core' source
  docs: rust: clarify what 'rustup override' does

 Documentation/rust/quick-start.rst | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

-- 
2.34.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] docs: rust: update instructions for obtaining 'core' source
  2023-08-03  6:04 [PATCH v2 0/2] docs: rust: update instructions for obtaining 'core' source Trevor Gross
@ 2023-08-03  6:04 ` Trevor Gross
  2023-08-03  6:04 ` [PATCH v2 2/2] docs: rust: clarify what 'rustup override' does Trevor Gross
  2023-08-20 23:14 ` [PATCH v2 0/2] docs: rust: update instructions for obtaining 'core' source Miguel Ojeda
  2 siblings, 0 replies; 4+ messages in thread
From: Trevor Gross @ 2023-08-03  6:04 UTC (permalink / raw)
  To: ojeda, alex.gaynor, wedsonaf
  Cc: boqun.feng, gary, bjorn3_gh, benno.lossin, corbet, yakoyoku,
	aliceryhl, tmgross, linux-doc, rust-for-linux, linux-kernel

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: https://github.com/Rust-for-Linux/linux/pull/1024
Signed-off-by: Trevor Gross <tmgross@umich.edu>
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
---
 Documentation/rust/quick-start.rst | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst
index a8931512ed98..632b115dd20d 100644
--- a/Documentation/rust/quick-start.rst
+++ b/Documentation/rust/quick-start.rst
@@ -56,16 +56,17 @@ If ``rustup`` is being used, run::
 The components are installed per toolchain, thus upgrading the Rust compiler
 version later on requires re-adding the component.
 
-Otherwise, if a standalone installer is used, the Rust repository may be cloned
-into the installation folder of the toolchain::
+Otherwise, if a standalone installer is used, the Rust source tree may be
+downloaded into the toolchain's installation folder::
 
-	git clone --recurse-submodules \
-		--branch $(scripts/min-tool-version.sh rustc) \
-		https://github.com/rust-lang/rust \
-		$(rustc --print sysroot)/lib/rustlib/src/rust
+	curl -L "https://static.rust-lang.org/dist/rust-src-$(scripts/min-tool-version.sh rustc).tar.gz" |
+		tar -xzf - -C "$(rustc --print sysroot)/lib" \
+		"rust-src-$(scripts/min-tool-version.sh rustc)/rust-src/lib/" \
+		--strip-components=3
 
 In this case, upgrading the Rust compiler version later on requires manually
-updating this clone.
+updating the source tree (this can be done by removing ``$(rustc --print
+sysroot)/lib/rustlib/src/rust`` then rerunning the above command).
 
 
 libclang
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] docs: rust: clarify what 'rustup override' does
  2023-08-03  6:04 [PATCH v2 0/2] docs: rust: update instructions for obtaining 'core' source Trevor Gross
  2023-08-03  6:04 ` [PATCH v2 1/2] " Trevor Gross
@ 2023-08-03  6:04 ` Trevor Gross
  2023-08-20 23:14 ` [PATCH v2 0/2] docs: rust: update instructions for obtaining 'core' source Miguel Ojeda
  2 siblings, 0 replies; 4+ messages in thread
From: Trevor Gross @ 2023-08-03  6:04 UTC (permalink / raw)
  To: ojeda, alex.gaynor, wedsonaf
  Cc: boqun.feng, gary, bjorn3_gh, benno.lossin, corbet, yakoyoku,
	aliceryhl, tmgross, linux-doc, rust-for-linux, linux-kernel

The behavior of 'rustup override' is not very well known. Add a small
note about what it does, so users have a better understanding of how it
affects their system toolchain (i.e., it does not affect system
toolchain and only sets a directory-specific override).

Signed-off-by: Trevor Gross <tmgross@umich.edu>
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
---
 Documentation/rust/quick-start.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst
index 632b115dd20d..0612ea517bc1 100644
--- a/Documentation/rust/quick-start.rst
+++ b/Documentation/rust/quick-start.rst
@@ -38,7 +38,9 @@ and run::
 
 	rustup override set $(scripts/min-tool-version.sh rustc)
 
-Otherwise, fetch a standalone installer from:
+This will configure your working directory to use the correct version of
+``rustc`` without affecting your default toolchain. If you are not using
+``rustup``, fetch a standalone installer from::
 
 	https://forge.rust-lang.org/infra/other-installation-methods.html#standalone
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] docs: rust: update instructions for obtaining 'core' source
  2023-08-03  6:04 [PATCH v2 0/2] docs: rust: update instructions for obtaining 'core' source Trevor Gross
  2023-08-03  6:04 ` [PATCH v2 1/2] " Trevor Gross
  2023-08-03  6:04 ` [PATCH v2 2/2] docs: rust: clarify what 'rustup override' does Trevor Gross
@ 2023-08-20 23:14 ` Miguel Ojeda
  2 siblings, 0 replies; 4+ messages in thread
From: Miguel Ojeda @ 2023-08-20 23:14 UTC (permalink / raw)
  To: Trevor Gross
  Cc: ojeda, alex.gaynor, wedsonaf, boqun.feng, gary, bjorn3_gh,
	benno.lossin, corbet, yakoyoku, aliceryhl, linux-doc,
	rust-for-linux, linux-kernel

On Thu, Aug 3, 2023 at 8:12 AM Trevor Gross <tmgross@umich.edu> wrote:
>
> This changes the suggested method of obtaining Rust's source to using the
> tarball rather than a full clone, and adds a clarification about 'rustup
> override'.

Applied to `rust-next`, thanks!

In the second patch, I undid the `:` to `::` change -- the latter is
meant to create a literal block.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-20 23:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-03  6:04 [PATCH v2 0/2] docs: rust: update instructions for obtaining 'core' source Trevor Gross
2023-08-03  6:04 ` [PATCH v2 1/2] " Trevor Gross
2023-08-03  6:04 ` [PATCH v2 2/2] docs: rust: clarify what 'rustup override' does Trevor Gross
2023-08-20 23:14 ` [PATCH v2 0/2] docs: rust: update instructions for obtaining 'core' source Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).