"c:check all" causes clippy3 crash
Hello,
when I select "c:check all" from the Rustlings menu, I get notified of a crash in the clippy3 executable. I haven't worked on clippy3 yet, and perhaps the crash is due to a deliberate error in the file. Nevertheless the fact that I get a crash report from my OS in this case seems undesirable as it cannot be inferred if this is intended behaviour.
Or am I missing something?
Anyway, here's the stack trace:
#0 0x00007f46990a8fbb pthread_kill (libc.so.6 + 0xa8fbb)
#1 0x00007f46990470a6 raise (libc.so.6 + 0x470a6)
#2 0x00007f46990292db abort (libc.so.6 + 0x292db)
#3 0x0000564472716c1a _RNvNtNtNtCs6ZjlLoI6YmX_3std3sys3pal4unix14abort_internal (clippy3 + 0x3dc1a)
#4 0x00005644727158d9 _RNvNtCs6ZjlLoI6YmX_3std7process5abort (clippy3 + 0x3c8d9)
#5 0x00005644727056da _RNvCs6rREvFdRhLb_7___rustc12___rust_abort (clippy3 + 0x2c6da)
#6 0x00005644726efafa _RNvCs6rREvFdRhLb_7___rustc18___rust_start_panic (clippy3 + 0x16afa)
#7 0x000056447270562e _RNvCs6rREvFdRhLb_7___rustc10rust_panic (clippy3 + 0x2c62e)
#8 0x0000564472715b95 _RNvNtCs6ZjlLoI6YmX_3std9panicking15panic_with_hook (clippy3 + 0x3cb95)
#9 0x0000564472705064 _RNCNvNtCs6ZjlLoI6YmX_3std9panicking13panic_handler0B5_ (clippy3 + 0x2c064)
#10 0x00005644726fa629 _RINvNtNtCs6ZjlLoI6YmX_3std3sys9backtrace26___rust_end_short_backtraceNCNvNtB6_9panicking13panic_handler0zEB6_ (clippy3 + 0x21629)
#11 0x00005644727057bd _RNvCs6rREvFdRhLb_7___rustc17rust_begin_unwind (clippy3 + 0x2c7bd)
#12 0x000056447272a50c _RNvNtCsc36rpYXAlPq_4core9panicking9panic_fmt (clippy3 + 0x5150c)
#13 0x000056447272a4d2 _RNvNtCsc36rpYXAlPq_4core9panicking5panic (clippy3 + 0x514d2)
#14 0x000056447272a229 _RNvNtCsc36rpYXAlPq_4core6option13unwrap_failed (clippy3 + 0x51229)
#15 0x00005644726ef65a _RNvCsk5GCxd0OoC6_7clippy34main (clippy3 + 0x1665a)
#16 0x00005644726ef45b _RNvYFEuINtNtNtCsc36rpYXAlPq_4core3ops8function6FnOnceuE9call_onceCsk5GCxd0OoC6_7clippy3 (clippy3 + 0x1645b)
#17 0x00005644726eeb8e _RINvNtNtCs6ZjlLoI6YmX_3std3sys9backtrace28___rust_begin_short_backtraceFEuuECsk5GCxd0OoC6_7clippy3 (clippy3 + 0x15b8e)
#18 0x00005644726ef581 _RNCINvNtCs6ZjlLoI6YmX_3std2rt10lang_startuE0Csk5GCxd0OoC6_7clippy3 (clippy3 + 0x16581)
#19 0x00005644727150c7 _RNvNtCs6ZjlLoI6YmX_3std2rt19lang_start_internal (clippy3 + 0x3c0c7)
#20 0x00005644726ef567 _RINvNtCs6ZjlLoI6YmX_3std2rt10lang_startuECsk5GCxd0OoC6_7clippy3 (clippy3 + 0x16567)
#21 0x00005644726ef9fe main (clippy3 + 0x169fe)
#22 0x00007f469902b5ac n/a (libc.so.6 + 0x2b5ac)
#23 0x00007f469902b6ca __libc_start_main (libc.so.6 + 0x2b6ca)
#24 0x00005644726ee8e5 _start (clippy3 + 0x158e5)
ELF object binary architecture: AMD x86-64
Can you reproduce this on main? I believe there have been some changes to the "check all" functionality. It is now triggered in the CLI, not interactively anymore. rustlings check-all is the command.
In a newly init-ed rustlings directory, I can't reproduce. Have you changed anything in the clippy3 exercise already?
Yes, I can reproduce it on main. The "check all" functionality is gone from the interactive menu as you have mentioned. But running
cargo run --bin rustlings check-all
still causes the crash with essentially the same stack trace. I have not touched clippy3. I don't get any error message by Rust or Rustlings (the terminal is still responsive afterwards too), but my OS reports the crash.
What OS are you using?
Can you please post the output of the following commands in the initialized rustlings/ directory?
cargo --version
cat exercises/22_clippy/clippy3.rs
cargo c --bin clippy3
cargo clippy --bin clippy3
cargo r --bin clippy3
Hi, of course! My OS is the latest version of Solus KDE.
Version:
cargo 1.98.1 (797e8a9bc 2026-08-05)
File:
// Here are some more easy Clippy fixes so you can see its utility 📎
// TODO: Fix all the Clippy lints.
#[rustfmt::skip]
#[allow(unused_variables, unused_assignments)]
fn main() {
let my_option: Option<&str> = None;
// Assume that you don't know the value of `my_option`.
// In the case of `Some`, we want to print its value.
if my_option.is_none() {
println!("{}", my_option.unwrap());
}
let my_arr = &[
-1, -2, -3
-4, -5, -6
];
println!("My array! Here it is: {my_arr:?}");
let my_empty_vec = vec![1, 2, 3, 4, 5].resize(0, 5);
println!("This Vec is empty, see? {my_empty_vec:?}");
let mut value_a = 45;
let mut value_b = 66;
// Let's swap these two!
value_a = value_b;
value_b = value_a;
println!("value a: {value_a}; value b: {value_b}");
}
Check:
Finisheddev profile [unoptimized + debuginfo] target(s) in 0.00s
Clippy:
Checking exercises v0.0.0 (/home/moritz/Desktop/Development/RustProjects/rustlings)
error: possibly missing a comma here
--> exercises/22_clippy/clippy3.rs:15:19
|
15 | -1, -2, -3
| ^
|
= note: to remove this lint, add a comma or write the expr in a single line
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#possible_missing_comma
= note: #[deny(clippy::possible_missing_comma)] on by default
error: this call to unwrap() will always panic
--> exercises/22_clippy/clippy3.rs:11:24
|
10 | if my_option.is_none() {
| ------------------- because of this check
11 | println!("{}", my_option.unwrap());
| ^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#panicking_unwrap
= note: #[deny(clippy::panicking_unwrap)] on by default
error: this looks like you are trying to swap value_a and value_b
--> exercises/22_clippy/clippy3.rs:26:5
|
26 | / value_a = value_b;
27 | | value_b = value_a;
| |_____________________^ help: try: std::mem::swap(&mut value_a, &mut value_b)
|
= note: or maybe you should use std::mem::replace?
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#almost_swapped
= note: #[deny(clippy::almost_swapped)] on by default
warning: used unwrap() on None value
--> exercises/22_clippy/clippy3.rs:11:24
|
11 | println!("{}", my_option.unwrap());
| ^^^^^^^^^^^^^^^^^^
|
help: remove the None and unwrap()
--> exercises/22_clippy/clippy3.rs:7:35
|
7 | let my_option: Option<&str> = None;
| ^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#unnecessary_literal_unwrap
= note: #[warn(clippy::unnecessary_literal_unwrap)] on by default
warning: this let-binding has unit value
--> exercises/22_clippy/clippy3.rs:20:5
|
20 | let my_empty_vec = vec![1, 2, 3, 4, 5].resize(0, 5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#let_unit_value
= note: #[warn(clippy::let_unit_value)] on by default
help: replace variable usages with ()
|
20 ~ let my_empty_vec = ();
21 ~ vec![1, 2, 3, 4, 5].resize(0, 5);
|
warning: exercises (bin "clippy3") generated 2 warnings
error: could not compile exercises (bin "clippy3") due to 3 previous errors; 2 warnings emitted
Run:
Finished dev profile [unoptimized + debuginfo] target(s) in 0.02s
Running target/debug/clippy3
thread 'main' (110679) panicked at exercises/22_clippy/clippy3.rs:11:34:
called Option::unwrap() on a None value
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
fish: Job 1, 'cargo run --bin clippy3' terminated by signal SIGABRT (Abort)
(and the crash warning from my OS with the stack trace I posted initially.)
I get the same output without a crash and a stack trace.
Do you get the stack trace after fish: Job 1, 'cargo run --bin clippy3' terminated by signal SIGABRT (Abort) or when exactly?
The application crash warning pops up right after that fish message is printed to the terminal. Could it be that this is more of an issue with how fish (or the OS) handle a SIGABRT ?