Skip to content

Commit 609424f

Browse files
Use stable toolchain for RISC-V devices (#487)
* feat: Use stable toolchain * docs: Update changelog
1 parent f2b35ce commit 609424f

File tree

5 files changed

+27
-22
lines changed

5 files changed

+27
-22
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
### Fixed
1313

1414
### Changed
15+
- Install `stable` Rust toolchain instead of `nightly` for RISC-V devices (#487)
1516

1617
### Removed
1718

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,12 @@ Options:
161161
162162
[default: esp]
163163
164-
-n, --nightly-version <NIGHTLY_VERSION>
165-
Nightly Rust toolchain version
164+
-b, --stable-version <STABLE_VERSION>
165+
Stable Rust toolchain version.
166166
167-
[default: nightly]
167+
Note that only RISC-V targets use stable Rust channel.
168+
169+
[default: stable]
168170
169171
-k, --skip-version-parse
170172
Skips parsing Xtensa Rust version
@@ -229,10 +231,12 @@ Options:
229231
230232
[default: esp]
231233
232-
-n, --nightly-version <NIGHTLY_VERSION>
233-
Nightly Rust toolchain version
234+
-b, --stable-version <STABLE_VERSION>
235+
Stable Rust toolchain version.
236+
237+
Note that only RISC-V targets use stable Rust channel.
234238
235-
[default: nightly]
239+
[default: stable]
236240
237241
-k, --skip-version-parse
238242
Skips parsing Xtensa Rust version

src/cli.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ pub struct InstallOpts {
3838
/// Xtensa Rust toolchain name.
3939
#[arg(short = 'a', long, default_value = "esp")]
4040
pub name: String,
41-
/// Nightly Rust toolchain version.
41+
/// Stable Rust toolchain version.
4242
///
43-
/// Note that only RISC-V targets use nightly Rust channel.
44-
#[arg(short = 'n', long, default_value = "nightly")]
45-
pub nightly_version: String,
43+
/// Note that only RISC-V targets use stable Rust channel.
44+
#[arg(short = 'b', long, default_value = "stable")]
45+
pub stable_version: String,
4646
/// Skips parsing Xtensa Rust version.
4747
#[arg(short = 'k', long, requires = "toolchain_version")]
4848
pub skip_version_parse: bool,

src/toolchain/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ pub async fn install(args: InstallOpts, install_mode: InstallMode) -> Result<()>
268268
- Export file: {:?}
269269
- Host triple: {}
270270
- LLVM Toolchain: {:?}
271-
- Nightly version: {:?}
271+
- Stable version: {:?}
272272
- Rust Toolchain: {:?}
273273
- Skip version parsing: {}
274274
- Targets: {:?}
@@ -277,7 +277,7 @@ pub async fn install(args: InstallOpts, install_mode: InstallMode) -> Result<()>
277277
&export_file,
278278
host_triple,
279279
&llvm,
280-
&args.nightly_version,
280+
&args.stable_version,
281281
xtensa_rust,
282282
&args.skip_version_parse,
283283
targets,
@@ -301,7 +301,7 @@ pub async fn install(args: InstallOpts, install_mode: InstallMode) -> Result<()>
301301
}
302302

303303
if targets.iter().any(|t| t.is_riscv()) {
304-
let riscv_target = RiscVTarget::new(&args.nightly_version);
304+
let riscv_target = RiscVTarget::new(&args.stable_version);
305305
to_install.push(Box::new(riscv_target));
306306
}
307307

src/toolchain/rust.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,28 +319,28 @@ impl Installable for XtensaRust {
319319

320320
#[derive(Debug, Clone)]
321321
pub struct RiscVTarget {
322-
/// Nightly version.
323-
pub nightly_version: String,
322+
/// Stable Rust toolchain version.
323+
pub stable_version: String,
324324
}
325325

326326
impl RiscVTarget {
327327
/// Create a crate instance.
328-
pub fn new(nightly_version: &str) -> Self {
328+
pub fn new(stable_version: &str) -> Self {
329329
RiscVTarget {
330-
nightly_version: nightly_version.to_string(),
330+
stable_version: stable_version.to_string(),
331331
}
332332
}
333333

334334
/// Uninstalls the RISC-V target.
335-
pub fn uninstall(nightly_version: &str) -> Result<(), Error> {
335+
pub fn uninstall(stable_version: &str) -> Result<(), Error> {
336336
info!("Uninstalling RISC-V target");
337337

338338
if !Command::new("rustup")
339339
.args([
340340
"target",
341341
"remove",
342342
"--toolchain",
343-
nightly_version,
343+
stable_version,
344344
"riscv32imc-unknown-none-elf",
345345
"riscv32imac-unknown-none-elf",
346346
"riscv32imafc-unknown-none-elf",
@@ -359,14 +359,14 @@ impl RiscVTarget {
359359
impl Installable for RiscVTarget {
360360
async fn install(&self) -> Result<Vec<String>, Error> {
361361
info!(
362-
"Installing RISC-V Rust targets ('riscv32imc-unknown-none-elf', 'riscv32imac-unknown-none-elf' and 'riscv32imafc-unknown-none-elf') for '{}' toolchain", &self.nightly_version
362+
"Installing RISC-V Rust targets ('riscv32imc-unknown-none-elf', 'riscv32imac-unknown-none-elf' and 'riscv32imafc-unknown-none-elf') for '{}' toolchain", &self.stable_version
363363
);
364364

365365
if !Command::new("rustup")
366366
.args([
367367
"toolchain",
368368
"install",
369-
&self.nightly_version,
369+
&self.stable_version,
370370
"--profile",
371371
"minimal",
372372
"--component",
@@ -383,7 +383,7 @@ impl Installable for RiscVTarget {
383383
.status()?
384384
.success()
385385
{
386-
return Err(Error::InstallRiscvTarget(self.nightly_version.clone()));
386+
return Err(Error::InstallRiscvTarget(self.stable_version.clone()));
387387
}
388388

389389
Ok(vec![]) // No exports

0 commit comments

Comments
 (0)