-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tidy watcher #114209
base: master
Are you sure you want to change the base?
tidy watcher #114209
Conversation
This comment has been minimized.
This comment has been minimized.
8b8f8f8
to
434286f
Compare
Added few more entries a49ed53, but i don't know if all of them actually sync as of now, this should be reviewed. |
a49ed53
to
ca2cbb3
Compare
☔ The latest upstream changes (presumably #114294) made this pull request unmergeable. Please resolve the merge conflicts. |
ca2cbb3
to
3f2a374
Compare
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #115795) made this pull request unmergeable. Please resolve the merge conflicts. |
3f2a374
to
e4c6a7c
Compare
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri Some changes might have occurred in exhaustiveness checking cc @Nadrieril Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
Okay. Implementation is trivial, but most of asserted pieces of code in compiler, so r? compiler. Didn't checked if current state is sync, as i don't always understand whats functions do. |
@@ -149,6 +149,7 @@ where | |||
None => { | |||
// For unsized types with an extern type tail we perform no adjustments. | |||
// NOTE: keep this in sync with `PlaceRef::project_field` in the codegen backend. | |||
// FIXME: that one? compiler/rustc_codegen_ssa/src/mir/place.rs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically this:
rust/compiler/rustc_codegen_ssa/src/mir/place.rs
Lines 148 to 154 in 79bfd93
_ if self.llextra.is_none() => { | |
debug!( | |
"unsized field `{}`, of `{:?}` has no metadata for adjustment", | |
ix, self.llval | |
); | |
return simple(); | |
} |
I don't see how an automatic checker can help here. This is about keeping the semantics in sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just run over codebase, found few comments like "keep in sync with" and wrapped them in tags. Of course this check can't say if two places is valid, only ping author to give it chance to check things manually.
This needs to give very clear guidance on what I should do now, otherwise it will be very frustrating. |
It slightly more descriptive, forgot to update first message, but can be improved. |
@@ -1144,6 +1150,7 @@ impl<'p, 'tcx> Fields<'p, 'tcx> { | |||
}) | |||
} | |||
|
|||
// tidy-ticket-wildcards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected that we reuse the tag for all the places that need to be in sync. E.g. if I modify wildcards()
here and not arity()
, it would ping me "you should also check arity
".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added grouping for tags, should write
tidy error: hash for tag `tidy-ticket-ast-from_token` in path `compiler/rustc_ast/src/token.rs` mismatch:
actual: `eecacc0fe4c615f7c71409c3ebfcff80`, expected: `70666de80ab0194a67524deeda3c01b8`
Verify that tags `["tidy-ticket-ast-from_token", "tidy-ticket-ast-can_begin_literal_maybe_minus", "tidy-ticket-rustc_p
arse-can_begin_literal_maybe_minus"]` in sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Could you make it explain what it's about for those who don't know? Something like: "the code block tagged with tidy-ticket-ast-from_token
has changed. It's likely that code blocks with the following tags need to be changed too. Once that is done, run tidy
again with the --blessed
flag to update the hashes. The related tags are ["tidy-ticket-ast-from_token", "tidy-ticket-ast-can_begin_literal_maybe_minus", "tidy-ticket-rustc_parse-can_begin_literal_maybe_minus"]
"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tidy-keep-sync-with=
and updated error message with parts from your suggestion.
The tag should have a name that explains what it's for if we encounter it in code. Something like |
e4c6a7c
to
fa7b8ae
Compare
Don't want to implement smarter parsing for tags (at least for now), can just make it longer, like Anyway, accidental removing of tag from code will enrage tidy, which will say something special about it. |
You don't need to do any parsing, just allow "=" in the list of allowed symbols in a tag. I just think it's more legible |
You might want to wait and see if compiler contributors actually want this before investing more time in it though. As far as I am concerned this adds unnecessary friction; I'm waiting to hear from ppl who work on files where this would be helpful. |
Yes, this is for code that will not emit errors; for example git hash for rustc-perf in dockerfile and opt-dist, or code commented in style "please keep me in sync", which will not immediately cause errors, but will silently do wrong things; or assert pieces in rust, bash, python code simultaneously (which will hard to sync other way).
This is tidy lint, so works only when tidy runs; this lint reads only specifically listed files (not all files in repo), so cost should be almost zero. |
fa7b8ae
to
82932d1
Compare
T-compiler visited this PR during the weekly triage meeting (Zulip notes). The idea is really cool and worth pursuing. Though the question could be where this static list could reside. Maybe at the LLVM level? We have our fork of LLVM, so tagging @rust-lang/wg-llvm for a comment. @rustbot label -I-compiler-nominated |
There's nothing specific to LLVM here, but what I got from that discussion is that there are also some things that we want to keep in sync with LLVM -- and maybe we could annotate those in our rust-lang/llvm-project fork. |
Yes, I was specifically thinking of this bit of feedback I had put onto a recent code review I was doing: #113923 (comment) |
☔ The latest upstream changes (presumably #117309) made this pull request unmergeable. Please resolve the merge conflicts. |
82932d1
to
275c2b1
Compare
This comment has been minimized.
This comment has been minimized.
275c2b1
to
0b311d0
Compare
☔ The latest upstream changes (presumably #118494) made this pull request unmergeable. Please resolve the merge conflicts. |
r? compiler |
r? compiler |
r? wesleywiser |
@klensy in the meanwhile, could you please rebase this? thanks |
@klensy |
MVP of tidy watcher:
Allows to check that changes to some pieces of text synced in different files (or at least warn about it). Should resolve situations like: "Oh no, I've changed that constant here and here, but forgot to update it in other 3 places."
Current state is very MVP'ish, so it simply works and nothing more, posted to get some feedback.
Usage: wrap text that need to be synced with arbitrarily chosen tags:
some.rs:
some.sh:
and add them to
watcher.rs
in tidy, adding into one group:If hashes differs, actual and expected ones will be printed:
Added check for
PERF_COMMIT
and few others as example.r? @ghost