Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rust-toolchain.toml #953

Open
TheAlgorythm opened this issue Jan 26, 2023 · 13 comments
Open

add rust-toolchain.toml #953

TheAlgorythm opened this issue Jan 26, 2023 · 13 comments
Labels
good first issue Good for newcomers • kbuild Related to building the kernel, `make`, `Kbuild`, `Kconfig` options...

Comments

@TheAlgorythm
Copy link

I'm not sure if it works with this setup, but it should make the setup process easier.
The setup of Documentation/rust/quick-start.rst includes the following commands:

rustup override set $(scripts/min-tool-version.sh rustc)
rustup component add rust-src

An equivalent rust-toolchain.toml should be:

[toolchain]
channel = "1.66.0"
components = [ "rust-src" ]

This should setup the environment automatically and therefore reduce the steps for building the kernel.
The documentation for this can be found here

(I am not a kernel developer (yet) and therefore don't know if it works with its infrastructure)

@TheAlgorythm TheAlgorythm added the • kbuild Related to building the kernel, `make`, `Kbuild`, `Kconfig` options... label Jan 26, 2023
@ojeda
Copy link
Member

ojeda commented Jan 26, 2023

The directory override will take priority over that file, so users giving an override (in the root folder) would still be able to use their own toolchain, right? e.g. @nbdd0121 often uses a newer toolchain, IIRC.

@bjorn3
Copy link
Member

bjorn3 commented Jan 26, 2023

Indeed. rust-toolchain.toml is the last thing checked before falling back to the global default. Directory overrides happen before that. See https://rust-lang.github.io/rustup/overrides.html

@ojeda
Copy link
Member

ojeda commented Jan 26, 2023

Thanks @bjorn3! I wanted to make sure I read the docs correctly. In that case, I think we can do this.

Would you like to submit the patch @TheAlgorythm or do you prefer somebody else does it (with e.g. a Suggested-by from you)?

If you want to send it yourself, please see https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin for details (the kernel requires using the real name and signing your work under the DCO).

I will mark this as a good first issue too.

@ojeda ojeda added the good first issue Good for newcomers label Jan 26, 2023
@nbdd0121
Copy link
Member

I wanted to do this earlier, but then it feels ugly having to name it rust-toolchain.toml and place it in the git root directory. I would probably send the patch long while ago if the file could be named .rust-toolchain.toml.

@ojeda
Copy link
Member

ojeda commented Jan 26, 2023

Ah, yeah, if it does not allow to be hidden, that is indeed quite painful. Then we should request that to rustup first.

@ojeda
Copy link
Member

ojeda commented Jan 26, 2023

Done! rust-lang/rustup#3182

@TheAlgorythm
Copy link
Author

Would you like to submit the patch @TheAlgorythm or do you prefer somebody else does it?

I can do that, but probably we should wait for rustup to add the support as I can understand, that such file shouldn't clutter the root. If they will change it I can create a PR.
In the meantime I will try if it's possible to place the file in another directory than the root.

@ojeda
Copy link
Member

ojeda commented Jan 27, 2023

For reference, @aliceinwire sent a PR about this before you answered but after I asked you #954. Maybe you could please talk to each other about how to handle this when the time comes to send it upstream :)

@TheAlgorythm
Copy link
Author

Ah ok. I haven't seen the PR before. I'm fine with it :)

@TheAlgorythm
Copy link
Author

I've created a PR at rustup. But is this the normal procedure?

@ojeda
Copy link
Member

ojeda commented Feb 12, 2023

Thanks! Referenced it at #396.

But is this the normal procedure?

What do you mean?

@TheAlgorythm
Copy link
Author

What do you mean?

Is there a RFC or something else needed? Or is it enough when the maintainers like it.

@ojeda
Copy link
Member

ojeda commented Feb 12, 2023

https://github.com/rust-lang/rustup/blob/master/CONTRIBUTING.md does not seem to refer to it, though I do see a couple mentions of "RFCs" for rustup from a quick search. I guess they will let you know in the PR if that is the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers • kbuild Related to building the kernel, `make`, `Kbuild`, `Kconfig` options...
Development

No branches or pull requests

4 participants