Skip to content

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jul 18, 2022

I keep forgetting to run rustup-toolchain on rebases across toolchain updates

I also keep forgetting to run rustfmt and clippy. The former isn't run by vscode if I don't explicitly save (I have autosave on).

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not entirely convinced by this. It seems like the kind of thing that I would solve by just having a local file xmiri like this:

#!/bin/sh
set -e
./rustup-toolchain
./miri fmt
./miri clippy
./miri "$@"

Why do we need this upstream? Is this a common problem? @saethlin might be good to ask about this.

Also the name "check-everything" is not very apt IMO, since ./rustup-toolchain is not just a check. I personally might want the fmt and clippy parts of this but I certainly never would want the rustup part of this; I do regularly use other toolchains than the one given in that file.

We could have files .auto-fmt, .auto-clippy, .auto-toolchain to control the three aspects of this separately. 😂 and/or .auto-everything for what it says on the tin.

miri Outdated
clippy() {
$CARGO clippy $CARGO_EXTRA_FLAGS --manifest-path "$MIRIDIR"/Cargo.toml --all-targets "$@"
$CARGO clippy $CARGO_EXTRA_FLAGS --manifest-path "$MIRIDIR"/ui_test/Cargo.toml --all-targets "$@"
$CARGO clippy $CARGO_EXTRA_FLAGS --manifest-path "$MIRIDIR"/cargo-miri/Cargo.toml "$@"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can avoid this refactoring by actually calling $0 recursively, with some environment variable to avoid endless loops.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk... that seems more roundabout/fragile to me, but if you prefer, I can do that.

Copy link
Member

@RalfJung RalfJung Jul 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion either way, but your current implementation is incorrect. So I think what I suggested is actually less fragile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done that now

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 19, 2022

Why do we need this upstream?

@saethlin, a mentee of mine and I myself all run into ./rustup-toolchain issues after rebasing. It's a papercut, but an annyoing one.

The other things (fmt and checks) are something that I do locally with ./miri fmt && ./miri clippy -Dwarnings && ./miri whatever I wanted to do. Yea I could have a local script, but I assumed others want this, too

@RalfJung
Copy link
Member

RalfJung commented Jul 19, 2022

Hm okay, fair. So what about the .auto-X scheme I proposed?

Also the part of the docs that talks about building Miri against a locally built rustc should warn to remove the .auto-* files before doing this.

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bash scripts are terrible... we should really rewrite this in Python or Rust or whatever. :/

# Run this first, so that the toolchain doesn't change after
# other code has run.
if [ -f ".auto-everything" ] || [ -f ".auto-toolchain" ] ; then
"$MIRIDIR"/rustup-toolchain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was too far up. 😂 now MIRIDIR is not defined yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh... I tested it and it seemed to work. Maybe bash just makes unknown env vars be empty?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe bash just makes unknown env vars be empty?

Yes it definitely does that. That is "expected" behavior in shell script land. ;)

@RalfJung
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 21, 2022

📌 Commit 4d4eeca has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jul 21, 2022

⌛ Testing commit 4d4eeca with merge 9ecdc9e...

@bors
Copy link
Contributor

bors commented Jul 21, 2022

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 9ecdc9e to master...

@bors bors merged commit 9ecdc9e into master Jul 21, 2022
@oli-obk oli-obk deleted the infra branch July 21, 2022 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants