Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upIncremental compilation auto assert (with except) #45104
Conversation
rust-highfive
assigned
arielb1
Oct 8, 2017
This comment has been minimized.
This comment has been minimized.
|
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. |
This was referenced Oct 8, 2017
This comment has been minimized.
This comment has been minimized.
|
@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 |
This comment has been minimized.
This comment has been minimized.
|
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. |
michaelwoerister
reviewed
Oct 9, 2017
|
|
||
| // Base and Extra labels to build up the labels | ||
|
|
||
| /// DefNodes for Hir, which is pretty much everything |
This comment has been minimized.
This comment has been minimized.
michaelwoerister
Oct 9, 2017
Contributor
It's DepNode, not DefNode. It is, however, DefPath, which can be rather confusing. "Dep" is for "dependency", "Def" is for "definition".
This comment has been minimized.
This comment has been minimized.
|
@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 :) |
This comment has been minimized.
This comment has been minimized.
|
@vitiral O sure, no problem! |
carols10cents
added
the
S-waiting-on-author
label
Oct 9, 2017
This comment has been minimized.
This comment has been minimized.
|
@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 |
This comment has been minimized.
This comment has been minimized.
|
@michaelwoerister can you specify which DepNodes to assert for:
|
This comment has been minimized.
This comment has been minimized.
Looks correct to me. |
This comment has been minimized.
This comment has been minimized.
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
|
This comment has been minimized.
This comment has been minimized.
|
What about `use` declarations?
|
This comment has been minimized.
This comment has been minimized.
|
@vitiral |
This comment has been minimized.
This comment has been minimized.
|
leaving a comment here: hit a issue which causes ICE when testing trait declarations. @michaelwoerister and I are looking into ways to solve. |
This comment has been minimized.
This comment has been minimized.
rust-highfive
assigned
michaelwoerister
and unassigned
arielb1
Oct 11, 2017
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
@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... |
This comment has been minimized.
This comment has been minimized.
|
@michaelwoerister I'm getting ICE from even trying to query the Hir (and pretty much everything else) on this line: https://github.com/vitiral/rust/blob/incr_ICE2/src/test/incremental/hashes/trait_defs.rs#L446 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 |
vitiral
force-pushed the
vitiral:incr_auto_assert2
branch
from
ff38a3e
to
81bb1c2
Oct 13, 2017
This comment has been minimized.
This comment has been minimized.
|
@michaelwoerister I have completed what I can do on this and added a FIXME for you. This should be ready for review+merge |
vitiral
force-pushed the
vitiral:incr_auto_assert2
branch
from
81bb1c2
to
f7fe970
Oct 13, 2017
kennytm
added
S-waiting-on-review
and removed
S-waiting-on-author
labels
Oct 13, 2017
michaelwoerister
reviewed
Oct 13, 2017
|
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)] | |||
This comment has been minimized.
This comment has been minimized.
michaelwoerister
Oct 13, 2017
Contributor
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) { |
This comment has been minimized.
This comment has been minimized.
| HirItem::ItemGlobalAsm(..) => ("ItemGlobalAsm", LABELS_HIR_ONLY), | ||
|
|
||
| // A type alias, e.g. `type Foo = Bar<u8>` | ||
| HirItem::ItemTy(..) => ("ItemTy", LABELS_CONST), |
This comment has been minimized.
This comment has been minimized.
michaelwoerister
Oct 13, 2017
Contributor
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), |
This comment has been minimized.
This comment has been minimized.
michaelwoerister
Oct 13, 2017
Contributor
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]] = &[ |
This comment has been minimized.
This comment has been minimized.
| #[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")] |
This comment has been minimized.
This comment has been minimized.
michaelwoerister
Oct 13, 2017
Contributor
Interesting. I would have thought that that changes the MIR. And it would if it were not all constants.
This comment has been minimized.
This comment has been minimized.
| #[rustc_clean(label="HirBody", cfg="cfail3")] | ||
| #[rustc_clean( | ||
| cfg="cfail2", | ||
| except="FnSignature,Hir,HirBody,MirOptimized,MirValidated,TypeckTables" |
This comment has been minimized.
This comment has been minimized.
michaelwoerister
Oct 13, 2017
Contributor
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)] |
This comment has been minimized.
This comment has been minimized.
| #[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)] |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
michaelwoerister
Oct 13, 2017
Contributor
And a few more below. All of these tests seem to be broken :( Should have caught that during review a the time...
This comment has been minimized.
This comment has been minimized.
vitiral
Oct 13, 2017
•
Author
Contributor
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")] |
This comment has been minimized.
This comment has been minimized.
michaelwoerister
Oct 13, 2017
Contributor
This is curious but an unused lifetime parameter doesn't seem to show up in any of the derived data structures.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
@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 |
vitiral
force-pushed the
vitiral:incr_auto_assert2
branch
from
3b3334e
to
80c13ce
Oct 13, 2017
This comment has been minimized.
This comment has been minimized.
|
Thanks for removing those @bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
kennytm
added
S-waiting-on-bors
and removed
S-waiting-on-review
labels
Oct 13, 2017
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Oct 14, 2017
This comment has been minimized.
This comment has been minimized.
|
|
bors
merged commit 80c13ce
into
rust-lang:master
Oct 14, 2017
This comment has been minimized.
This comment has been minimized.
|
|
vitiral commentedOct 8, 2017
•
edited
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