-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Incremental compilation auto assert (with except) #45104
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @arielb1 (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@michaelwoerister let me know how "complete" you want the DepNode detection. I'm thinking of leavig it as a WIP. FIXME: I need to do better assertions (using the |
I think this looks very good. If you have time to keep working on it, I would suggest implementing support for other kinds of items (methods/associated items, type definitions) in the auto-detection code now. Since individual PRs can take quite a while to go from approval to merging, it would be better to do everything in one larger PR, I think. If you think you won't find the time or motivation to finish this in the short-term then we can also just land the current state and I (or someone else) would take it from there. But I don't think there's that much work left. |
|
||
// Base and Extra labels to build up the labels | ||
|
||
/// DefNodes for Hir, which is pretty much everything |
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.
It's DepNode
, not DefNode
. It is, however, DefPath
, which can be rather confusing. "Dep" is for "dependency", "Def" is for "definition".
@michaelwoerister no, I can flush it out. I'll have to take several of the test-case refactors though, hopefully that is okay with you :) |
@vitiral O sure, no problem! |
@michaelwoerister I'm getting pretty close to groups for all of these and will push up shortly. There is a major difference that I did: I split up |
@michaelwoerister can you specify which DepNodes to assert for:
|
Looks correct to me. |
None. These declarations are more or less erased before incremental compilation kicks in.
I don't know what you mean by that.
Currently, only the entire
|
What about `use` declarations?
|
@vitiral |
leaving a comment here: hit a issue which causes ICE when testing trait declarations. @michaelwoerister and I are looking into ways to solve. |
I wanted to put the script I am using to make this easier in case anyone finds it useful. Once this merges I will post it on the main issue:
I run it by changing all assertions for the file I want to fix to
And the output looks like:
while is |
@michaelwoerister I made the changes you requested and am seeing 32/34 failed with things like this:
I'm changing it so it only calls force when the DepKind is one of the trait DepNodes, we'll see if that works... |
@michaelwoerister I'm getting ICE from even trying to query the Hir (and pretty much everything else) on this line: Also note: I have added this: https://github.com/vitiral/rust/blob/incr_ICE2/src/librustc_incremental/persist/dirty_clean.rs#L502
good news is that I can confirm that forcing only the trait-specific DepNodes doesn't itself cause an ICE 😄 |
ff38a3e
to
81bb1c2
Compare
@michaelwoerister I have completed what I can do on this and added a FIXME for you. This should be ready for review+merge |
81bb1c2
to
f7fe970
Compare
This adds auto-assertion to `rustc_clean/dirty` and also implements more comprehensive testing for - src/test/incremental/hashes/enum_constructors.rs - src/test/incremental/hashes/enum_defs.rs - src/test/incremental/hashes/extern_mods.rs - src/test/incremental/hashes/inherent_impls.rs - src/test/incremental/hashes/statics.rs - src/test/incremental/hashes/struct_constructors.rs - src/test/incremental/hashes/type_defs.rs trait_defs.rs and trait_impl.rs are blocked on a hard to triage compiler ICE (at least hard for a newbie like me) having to do with some DepNodes not getting computed for traits. A FIXME has been added in the source to reflect this continued work.
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.
Thank you so much, @vitiral! I've just read through the PR and you've clearly put a lot of work and time into this. I think the extension to the framework turned out very nice and make test definitions much more concise and readable.
I've left some comments. The requested changes should be rather quick to do. I'll then take care of the trait definition problems.
@@ -39,10 +39,15 @@ | |||
//! previous revision to compare things to. | |||
//! | |||
|
|||
#![allow(dead_code)] |
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 assume this is because of some yet to be used constants below? I think you can attach the attribute directly to the item that you want to ignore.
let (name, mut auto) = self.auto_labels(item_id, attr); | ||
let except = self.except(attr); | ||
for e in except.iter() { | ||
if !auto.remove(e) { |
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.
Yes, this is a good check to have 👍
HirItem::ItemGlobalAsm(..) => ("ItemGlobalAsm", LABELS_HIR_ONLY), | ||
|
||
// A type alias, e.g. `type Foo = Bar<u8>` | ||
HirItem::ItemTy(..) => ("ItemTy", LABELS_CONST), |
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.
Interesting. I'll need to check this. For now let's rather make it LABELS_HIR_ONLY
.
HirItem::ItemTy(..) => ("ItemTy", LABELS_CONST), | ||
|
||
// An enum definition, e.g. `enum Foo<A, B> {C<A>, D<B>}` | ||
HirItem::ItemEnum(..) => ("ItemEnum", LABELS_STRUCT), |
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.
Could you rename LABELS_STRUCT
to LABELS_ADT
(as in Abstract Data Type)? That's what structs/enums/unions are called in the compiler.
]; | ||
|
||
/// Trait-Method DepNodes | ||
const LABELS_FN_TRAIT: &[&[&str]] = &[ |
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.
and finally LABELS_FN_IN_TRAIT
.
#[rustc_clean(label="Hir", cfg="cfail3")] | ||
#[rustc_dirty(label="HirBody", cfg="cfail2")] | ||
#[rustc_clean(label="HirBody", cfg="cfail3")] | ||
#[rustc_clean(cfg="cfail2", except="HirBody,TypeckTables")] |
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.
Interesting. I would have thought that that changes the MIR. And it would if it were not all constants.
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.
left a FIXME for you
#[rustc_clean(label="HirBody", cfg="cfail3")] | ||
#[rustc_clean( | ||
cfg="cfail2", | ||
except="FnSignature,Hir,HirBody,MirOptimized,MirValidated,TypeckTables" |
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.
One could probably split this string with a \
and it would still work.
#[rustc_dirty(label="Hir", cfg="cfail2")] | ||
#[rustc_clean(label="Hir", cfg="cfail3")] | ||
#[rustc_dirty(cfg="cfail2")] | ||
#[rustc_clean(cfg="cfail3")] | ||
#[rustc_metadata_dirty(cfg="cfail2")] | ||
#[rustc_metadata_clean(cfg="cfail3")] | ||
#[repr(C)] |
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.
The #[repr(C)]
here seems to be an oversight.
#[rustc_dirty(label="Hir", cfg="cfail2")] | ||
#[rustc_clean(label="Hir", cfg="cfail3")] | ||
#[rustc_dirty(cfg="cfail2")] | ||
#[rustc_clean(cfg="cfail3")] | ||
#[rustc_metadata_dirty(cfg="cfail2")] | ||
#[rustc_metadata_clean(cfg="cfail3")] | ||
#[repr(C)] |
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.
Another stray #[repr(C)]
.
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.
And a few more below. All of these tests seem to be broken :(
Should have caught that during review a the time...
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.
the only one I left was the test with the header // Add #[repr(C)] to the enum ----...
(someone probably copy/pasted that test and forgot to remove the repr
).
#[rustc_metadata_clean(cfg="cfail2")] | ||
#[rustc_metadata_clean(cfg="cfail3")] | ||
impl Foo { | ||
#[rustc_dirty(label="Hir", cfg="cfail2")] | ||
#[rustc_clean(label="Hir", cfg="cfail3")] | ||
#[rustc_clean(cfg="cfail2", except="Hir,HirBody")] |
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.
This is curious but an unused lifetime parameter doesn't seem to show up in any of the derived data structures.
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.
left a FIXME for you
Thanks @michaelwoerister! Do you want me to do anything about your "this is interesting" comments, i.e. leave a FIXME for you to look at later? Edit: and yes, those changes should be easy to implement |
@michaelwoerister your comments should all be fixed. I added FIXME for your personal "I'm confused" comments, I'll let you figure those out and delete the FIXME's 😄 |
3b3334e
to
80c13ce
Compare
Thanks for removing those @bors r+ |
📌 Commit 80c13ce has been approved by |
Incremental compilation auto assert (with except) cc @michaelwoerister bors merged part 1, so this is a WIP of part 2 of #45009 -- auto asserting DepNodes depending on the type of node rustc_clean/dirty is attached to Framework: - [x] finish auto-detection for specified DepNodes - [x] finish auto-detection for remaining DepNodes Test Refactors: - [x] consts.rs - [x] enum_constructors.rs - [x] extern_mods.rs - [x] inherent_impls.rs - [x] statics.rs - [x] struct_constructors.rs - ~~**BLOCKED** trait_defs.rs, see FIXME~~ - ~~**BLOCKED** trait_impls.rs~~ - [x] type_defs.rs - [x] enum_defs.rs
☀️ Test successful - status-appveyor, status-travis |
🎉 |
cc @michaelwoerister
bors merged part 1, so this is a WIP of part 2 of #45009 -- auto asserting DepNodes depending on the type of node rustc_clean/dirty is attached to
Framework:
Test Refactors:
BLOCKED trait_defs.rs, see FIXMEBLOCKED trait_impls.rs