Skip to content

Self-contained installation #1919

Closed
@mo8it

Description

@mo8it

I was thinking about the possibility of installing Rustlings without the installation scripts that are piped into a shell. Wouldn't it be nice if we could just offer cargo install rustlings?

Why?

  • No piping of a script from the internet into a shell. This is often perceived as a security threat. Yes, the script is tiny and can be read, but avoiding it altogether would not scare anyone off.
  • No requirement on git
  • No requirement on Python
  • No shell scripts to maintain
  • One installation method for all platforms (currently, there is a separate script for Windows)
  • Less to download (no cloning of the whole repository)
  • No need to look for the latest git tag during installation
  • Make beginners familiar with cargo install
  • Reduce the confusion with files not related to the exercises (I observed this during my course).
  • Reduce the countless PRs of people submitting their solutions by mistake.

How?

My suggestion is to include the exercises in the binary using something like include_bytes! on the whole exercises directory. Then, the directory is extracted to the filesystem on first run. Something similar to this. This initialization would also automatically generate the rust-project.json file for Rust-Analyzer. So the lsp command would be eliminated and users don't forget to run it.

Many of the students in my course forgot to run the lsp command and got no language server support until I noticed it.

Changes

Resetting an exercise would not be done using git stash push -- EXERCISE anymore. The exercise would be completely nuked and replaced by the original file in the binary.

crates.io

Currently, rustlings is taken on crates.io… But we can try to contact the author.


@shadows-withal what do you think? I would take care of the implementation. That would be version 6.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions