[PATCH v2] scripts: generate_rust_analyzer: Add message to sysroot assertion

Maurice Hieronymus posted 1 patch 1 day, 2 hours ago
There is a newer version of this series
scripts/generate_rust_analyzer.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
[PATCH v2] scripts: generate_rust_analyzer: Add message to sysroot assertion
Posted by Maurice Hieronymus 1 day, 2 hours ago
The assertion that checks whether sysroot lies within sysroot_src
currently fails without explaining why. Add an error message that
prints both paths to make diagnosing toolchain issues easier.

Signed-off-by: Maurice Hieronymus <mhi@mailbox.org>
---
Changes since v2:
- Rebase to current rust/for-next
- Send patch to all people received from scripts/get_maintainer.pl

 scripts/generate_rust_analyzer.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index d2bc63cde8c6..06c220c9ceee 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -156,7 +156,13 @@ def main():
     )
 
     # Making sure that the `sysroot` and `sysroot_src` belong to the same toolchain.
-    assert args.sysroot in args.sysroot_src.parents
+    assert args.sysroot in args.sysroot_src.parents, \
+        f"""
+        It seems like your sysroot and sysroot_src do not belong to the same toolchain.
+        The sysroot folder must be inside sysroot_src.
+        sysroot={args.sysroot}
+        sysroot_src={args.sysroot_src}
+        """
 
     rust_project = {
         "crates": generate_crates(args.srctree, args.objtree, args.sysroot_src, args.exttree, args.cfgs),

base-commit: 8af7a50167833b6b22e30c008bbf95ab3ff1a5fb
-- 
2.50.1
Re: [PATCH v2] scripts: generate_rust_analyzer: Add message to sysroot assertion
Posted by Miguel Ojeda 21 hours ago
On Sun, Nov 30, 2025 at 8:15 PM Maurice Hieronymus <mhi@mailbox.org> wrote:
>
> - Send patch to all people received from scripts/get_maintainer.pl

Thanks for that!

>      # Making sure that the `sysroot` and `sysroot_src` belong to the same toolchain.

I guess we could now remove the comment since it is a bit redundant,
but it is fine either way.

Cheers,
Miguel
Re: [PATCH v2] scripts: generate_rust_analyzer: Add message to sysroot assertion
Posted by Maurice Hieronymus 4 hours ago
On Mon, Dec 01, 2025 at 12:50:44AM +0100, Miguel Ojeda wrote:

> On Sun, Nov 30, 2025 at 8:15 PM Maurice Hieronymus <mhi@mailbox.org>
> wrote:
>
> > - Send patch to all people received from scripts/get_maintainer.pl
>
> Thanks for that!

I’m still getting familiar with the mailing list workflow, so I have
Ia question regarding this. You mentioned that keeping or removing the
Icomment is fine. In cases like this, if I decide not to change the
Ipatch, should I still send a reply, or would it be picked up as-is
Ieventually? 'm just curious since I plan to contribute more in the near
Ifuture.

> >      # Making sure that the `sysroot` and `sysroot_src` belong to
> >      the same toolchain.
>
> I guess we could now remove the comment since it is a bit redundant,
> but it is fine either way.

Sure, I will resend a v3 in a moment.

> Cheers, Miguel
Re: [PATCH v2] scripts: generate_rust_analyzer: Add message to sysroot assertion
Posted by Miguel Ojeda 4 hours ago
On Mon, Dec 1, 2025 at 5:49 PM Maurice Hieronymus <mhi@mailbox.org> wrote:
>
> I’m still getting familiar with the mailing list workflow, so I have
> Ia question regarding this. You mentioned that keeping or removing the
> Icomment is fine. In cases like this, if I decide not to change the
> Ipatch, should I still send a reply, or would it be picked up as-is
> Ieventually? 'm just curious since I plan to contribute more in the near
> Ifuture.

Sometimes maintainers can fix things when they apply a patch, but in
general it always helps to send a new version to reduce their workload
and the risk of making a mistake last minute (and usually saying what
they modified in a [ ...]  comment etc.), so thanks for the v3 :)

(By the way, there is a "I" in each line after the first in your reply.)

Cheers,
Miguel