2023-12-08 10:18:19

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH] docs: rust: Clarify that 'rustup override' applies to build directory

Rustup override is required to be set for the build directory and not
necessarily the kernel source tree (unless the build directory is its
subdir).

Clarify the same in quick-start guide.

Signed-off-by: Viresh Kumar <[email protected]>
---
Documentation/rust/quick-start.rst | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst
index f382914f4191..a7a08955fe46 100644
--- a/Documentation/rust/quick-start.rst
+++ b/Documentation/rust/quick-start.rst
@@ -39,8 +39,13 @@ If ``rustup`` is being used, enter the checked out source code directory
rustup override set $(scripts/min-tool-version.sh rustc)

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:
+``rustc`` without affecting your default toolchain.
+
+Note that the override applies to the build directory (and its sub-directories).
+If the kernel is built with `O=<build directory>`, the override must be set for
+the build directory instead.
+
+If you are not using ``rustup``, fetch a standalone installer from:

https://forge.rust-lang.org/infra/other-installation-methods.html#standalone

--
2.31.1.272.g89b43f80a514


2023-12-08 10:33:28

by Alice Ryhl

[permalink] [raw]
Subject: Re: [PATCH] docs: rust: Clarify that 'rustup override' applies to build directory

On Fri, Dec 8, 2023 at 11:18 AM Viresh Kumar <[email protected]> wrote:
>
> Rustup override is required to be set for the build directory and not
> necessarily the kernel source tree (unless the build directory is its
> subdir).
>
> Clarify the same in quick-start guide.
>
> Signed-off-by: Viresh Kumar <[email protected]>

Reviewed-by: Alice Ryhl <[email protected]>

2023-12-08 15:07:12

by Miguel Ojeda

[permalink] [raw]
Subject: Re: [PATCH] docs: rust: Clarify that 'rustup override' applies to build directory

On Fri, Dec 8, 2023 at 11:18 AM Viresh Kumar <[email protected]> wrote:
>
> @@ -39,8 +39,13 @@ If ``rustup`` is being used, enter the checked out source code directory
> rustup override set $(scripts/min-tool-version.sh rustc)
>
> 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:
> +``rustc`` without affecting your default toolchain.
> +
> +Note that the override applies to the build directory (and its sub-directories).
> +If the kernel is built with `O=<build directory>`, the override must be set for
> +the build directory instead.
> +
> +If you are not using ``rustup``, fetch a standalone installer from:

Thanks Viresh!

I think it may be a bit more clear/compact if we simply change the
"enter the checked out source code directory" sentence instead above?
What do you think?

Cheers,
Miguel

2023-12-08 18:04:42

by Benno Lossin

[permalink] [raw]
Subject: Re: [PATCH] docs: rust: Clarify that 'rustup override' applies to build directory

On 12/8/23 11:18, Viresh Kumar wrote:
> Rustup override is required to be set for the build directory and not
> necessarily the kernel source tree (unless the build directory is its
> subdir).
>
> Clarify the same in quick-start guide.
>
> Signed-off-by: Viresh Kumar <[email protected]>
> ---
> Documentation/rust/quick-start.rst | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst
> index f382914f4191..a7a08955fe46 100644
> --- a/Documentation/rust/quick-start.rst
> +++ b/Documentation/rust/quick-start.rst
> @@ -39,8 +39,13 @@ If ``rustup`` is being used, enter the checked out source code directory
> rustup override set $(scripts/min-tool-version.sh rustc)
>
> 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:
> +``rustc`` without affecting your default toolchain.
> +
> +Note that the override applies to the build directory (and its sub-directories).

Shouldn't this be "Note that the override only applies to the current
working directory (and its sub-directories)."?
I think it would also be useful to continue with this: "But in order
to build the kernel, this override must affect the build directory.".

And then you could also mention that in the default location for the
build directory is in the repository.

--
Cheers,
Benno

> +If the kernel is built with `O=<build directory>`, the override must be set for
> +the build directory instead.
> +
> +If you are not using ``rustup``, fetch a standalone installer from:
>
> https://forge.rust-lang.org/infra/other-installation-methods.html#standalone

2023-12-11 06:48:03

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH] docs: rust: Clarify that 'rustup override' applies to build directory

On 08-12-23, 18:04, Benno Lossin wrote:
> Shouldn't this be "Note that the override only applies to the current
> working directory (and its sub-directories)."?
> I think it would also be useful to continue with this: "But in order
> to build the kernel, this override must affect the build directory.".
>
> And then you could also mention that in the default location for the
> build directory is in the repository.

Based on feedback from Miguel and Benno, how about this instead ?

diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst
index f382914f4191..dee787f92d26 100644
--- a/Documentation/rust/quick-start.rst
+++ b/Documentation/rust/quick-start.rst
@@ -33,14 +33,17 @@ A particular version of the Rust compiler is required. Newer versions may or
may not work because, for the moment, the kernel depends on some unstable
Rust features.

-If ``rustup`` is being used, enter the checked out source code directory
-and run::
+If ``rustup`` is being used, enter the kernel build directory and run::

rustup override set $(scripts/min-tool-version.sh rustc)

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:
+``rustc`` without affecting your default toolchain.
+
+Note that the override applies to the current working directory (and its
+sub-directories).
+
+If you are not using ``rustup``, fetch a standalone installer from:

https://forge.rust-lang.org/infra/other-installation-methods.html#standalone

--
viresh

2023-12-11 08:11:49

by Andreas Hindborg

[permalink] [raw]
Subject: Re: [PATCH] docs: rust: Clarify that 'rustup override' applies to build directory


Thanks for fixing this Viresh!

Viresh Kumar <[email protected]> writes:

> diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst
> index f382914f4191..dee787f92d26 100644
> --- a/Documentation/rust/quick-start.rst
> +++ b/Documentation/rust/quick-start.rst
> @@ -33,14 +33,17 @@ A particular version of the Rust compiler is required. Newer versions may or
> may not work because, for the moment, the kernel depends on some unstable
> Rust features.
>
> -If ``rustup`` is being used, enter the checked out source code directory
> -and run::
> +If ``rustup`` is being used, enter the kernel build directory and run::
>
> rustup override set $(scripts/min-tool-version.sh rustc)

How about just specifying the path here:

rustup override set --path=<build-dir> $(scripts/min-tool-version.sh rustc)

Best regards,
Andreas

2023-12-11 08:23:58

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH] docs: rust: Clarify that 'rustup override' applies to build directory

On 11-12-23, 09:09, Andreas Hindborg (Samsung) wrote:
>
> Thanks for fixing this Viresh!
>
> Viresh Kumar <[email protected]> writes:
>
> > diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst
> > index f382914f4191..dee787f92d26 100644
> > --- a/Documentation/rust/quick-start.rst
> > +++ b/Documentation/rust/quick-start.rst
> > @@ -33,14 +33,17 @@ A particular version of the Rust compiler is required. Newer versions may or
> > may not work because, for the moment, the kernel depends on some unstable
> > Rust features.
> >
> > -If ``rustup`` is being used, enter the checked out source code directory
> > -and run::
> > +If ``rustup`` is being used, enter the kernel build directory and run::
> >
> > rustup override set $(scripts/min-tool-version.sh rustc)
>
> How about just specifying the path here:
>
> rustup override set --path=<build-dir> $(scripts/min-tool-version.sh rustc)

Hmm, this sounds good too. In that case the above line can be changed to:

"If ``rustup`` is being used, run::"

Looks okay ?

--
viresh

2023-12-11 10:13:06

by Benno Lossin

[permalink] [raw]
Subject: Re: [PATCH] docs: rust: Clarify that 'rustup override' applies to build directory

On 12/11/23 09:23, Viresh Kumar wrote:
> On 11-12-23, 09:09, Andreas Hindborg (Samsung) wrote:
>>
>> Thanks for fixing this Viresh!
>>
>> Viresh Kumar <[email protected]> writes:
>>
>>> diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst
>>> index f382914f4191..dee787f92d26 100644
>>> --- a/Documentation/rust/quick-start.rst
>>> +++ b/Documentation/rust/quick-start.rst
>>> @@ -33,14 +33,17 @@ A particular version of the Rust compiler is required. Newer versions may or
>>> may not work because, for the moment, the kernel depends on some unstable
>>> Rust features.
>>>
>>> -If ``rustup`` is being used, enter the checked out source code directory
>>> -and run::
>>> +If ``rustup`` is being used, enter the kernel build directory and run::
>>>
>>> rustup override set $(scripts/min-tool-version.sh rustc)
>>
>> How about just specifying the path here:
>>
>> rustup override set --path=<build-dir> $(scripts/min-tool-version.sh rustc)
>
> Hmm, this sounds good too. In that case the above line can be changed to:
>
> "If ``rustup`` is being used, run::"
>
> Looks okay ?

I think it should also mention that you do not need the
`--path=<build-dir>`. It might be confusing for new users who do not
know where the build directory is.
It might also work to put both commands there (i.e. with
`--path=<build-dir>` and without) and explaining what each of them do.

--
Cheers,
Benno

2023-12-12 03:06:10

by John Hubbard

[permalink] [raw]
Subject: Re: [PATCH] docs: rust: Clarify that 'rustup override' applies to build directory

On 12/10/23 22:47, Viresh Kumar wrote:
> On 08-12-23, 18:04, Benno Lossin wrote:
>> Shouldn't this be "Note that the override only applies to the current
>> working directory (and its sub-directories)."?
>> I think it would also be useful to continue with this: "But in order
>> to build the kernel, this override must affect the build directory.".
>>
>> And then you could also mention that in the default location for the
>> build directory is in the repository.
>
> Based on feedback from Miguel and Benno, how about this instead ?
>
> diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst
> index f382914f4191..dee787f92d26 100644
> --- a/Documentation/rust/quick-start.rst
> +++ b/Documentation/rust/quick-start.rst
> @@ -33,14 +33,17 @@ A particular version of the Rust compiler is required. Newer versions may or
> may not work because, for the moment, the kernel depends on some unstable
> Rust features.
>
> -If ``rustup`` is being used, enter the checked out source code directory
> -and run::
> +If ``rustup`` is being used, enter the kernel build directory and run::

That "enter the kernel build directory" phrase is much better than the
"enter the checked out source code directory".

I feel confident saying this, because I just read this document over the
weekend, while getting set up to build rust for Linux. And this phrase
was a little jarring and weird to me.

This is after all a minor point, but it's nice to polish up this getting
started guide. It's already a concise and excellent guide, by the way.


thanks,
--
John Hubbard
NVIDIA

>
> rustup override set $(scripts/min-tool-version.sh rustc)
>
> 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:
> +``rustc`` without affecting your default toolchain.
> +
> +Note that the override applies to the current working directory (and its
> +sub-directories).
> +
> +If you are not using ``rustup``, fetch a standalone installer from:
>
> https://forge.rust-lang.org/infra/other-installation-methods.html#standalone
>