rust-lang / rustlings

:crab: Small exercises to get you used to reading and writing Rust code!
https://rustlings.cool
MIT License
54.01k stars 10.15k forks source link

Clippy: Cannot generate Clippy Cargo.toml file #2003

Closed chiffonng closed 4 months ago

chiffonng commented 4 months ago

Hello, I'm doing rustlings exercise on Mac (M1 Pro, Sonoma 14.5). For Clippy exercises, rustlings couldn't write to Cargo.toml file inside 22_clippy folder. I verified that clippy is installed since I could run cargo clippy

Checking rustlings v5.6.1 (path/to/rustlings)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.38s

Error message

When running RUST_BACKTRACE=full rustlings run clippy1, the output to the terminal is:

⠁ Compiling exercises/22_clippy/clippy1.rs...                                                                 stack backtrace:
   0:        0x10222f318 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1f3776e0b5c7517d
   1:        0x10224cc80 - core::fmt::write::heedef092c8c0962e
   2:        0x10222c40c - std::io::Write::write_fmt::h7178e8e2ea928914
   3:        0x10222f170 - std::sys_common::backtrace::print::h417292deb95532ed
   4:        0x1022302cc - std::panicking::default_hook::{{closure}}::h0cb68f1228c4613a
   5:        0x10222ffc0 - std::panicking::default_hook::h24535936bc1f51de
   6:        0x102230b84 - std::panicking::rust_panic_with_hook::h5db4d2345b297bed
   7:        0x1022305b4 - std::panicking::begin_panic_handler::{{closure}}::h3fd558f09a0d5492
   8:        0x10222f7a0 - std::sys_common::backtrace::__rust_end_short_backtrace::hfc76eebe1ce501b2
   9:        0x102230324 - _rust_begin_unwind
  10:        0x10225a404 - core::panicking::panic_fmt::hc2b459a5bd3dce66
  11:        0x10225a760 - core::result::unwrap_failed::h88d7eb352f20b747
  12:        0x102120074 - rustlings::exercise::Exercise::compile::h1e02ff442596582f
  13:        0x102122850 - rustlings::run::compile_and_run::hcfc4939b7076778b
  14:        0x1020fe6f0 - rustlings::main::hacb8d0646bd481cc
  15:        0x102104c08 - std::sys_common::backtrace::__rust_begin_short_backtrace::he98b09927eb940a3
  16:        0x10211cdfc - std::rt::lang_start::{{closure}}::h53d3f4634488a4bc
  17:        0x102226b94 - std::rt::lang_start_internal::hecc68fef83c8f44d
  18:        0x102103b84 - _main

The code panicked at this part:

https://github.com/rust-lang/rustlings/blob/42b5c0a1f7d4bb5c58a1535092d29c1b49df41de/src/exercise.rs#L138C1-L155C92

What I tried

const CLIPPY_CARGO_TOML_PATH: &str = "./exercises/22_clippy/Cargo.toml";
mo8it commented 4 months ago

Unfortunately, this is a known issue that will be fixed in the upcoming version 6. I will try my best to release it as soon as possible. Until then, please skip the Clippy exercises.