pre-commit-ci / issues

public issues for https://pre-commit.ci
17 stars 3 forks source link

Rust does not work with `language_version: nightly` #212

Closed pxeger closed 4 months ago

pxeger commented 4 months ago

I'm using the hooks defined at https://github.com/pxeger/pre-commit-rust.

I am specifying a rust version because rustfmt for the version of Rust pre-commit.ci appears to use by default differs in output from my workstation, but I don't want to have to constantly keep my hook definition up to date, so I specified language_version: nightly. But this caused an error:

fmt......................................................................Failed
- hook id: fmt
- exit code: 1

info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
error: could not create temp file /opt/rust/rustup/tmp/q7g35x_vp9vm4q_x_file: Read-only file system (os error 30)
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
error: could not create temp file /opt/rust/rustup/tmp/6o8kv5zh3e9mm2ip_file: Read-only file system (os error 30)

(See https://results.pre-commit.ci/run/github/346793498/1715375621.R1vd2JLtRieC1YAcjF_D-g)

asottile commented 4 months ago

nightly isn't a valid value in general as it's rolling so I don't think this will be supported

asottile commented 4 months ago

this may also be failing due to the problem being fixed in https://github.com/pre-commit/pre-commit/pull/3201 -- though I still don't expect nightly to be a valid version -- or at the very least it probably does not cache properly

pxeger commented 4 months ago

I understand the problem with caching, but pinning a specific version of nightly rust doesn't work either, presumably because that version also hasn't already been downloaded on the pre-commit.ci servers. https://results.pre-commit.ci/run/github/346793498/1715415471.4nYKmU1KTfyXGZ4JKVEM2Q

Is there any way to get a nightly version of rust?

asottile commented 4 months ago

I think your problem is you're running it through cargo which always reaches out to the network. ime I've had to call rustfmt directly