-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Drive trans from the output of the translation item collector #33890
Drive trans from the output of the translation item collector #33890
Conversation
r? @Aatch (rust_highfive has picked a reviewer for you, use r? to override) |
} | ||
} | ||
} | ||
} | ||
hir::ItemEnum(ref enum_definition, ref gens) => { | ||
if gens.ty_params.is_empty() { | ||
// sizes only make sense for non-generic types | ||
enum_variant_size_lint(ccx, enum_definition, item.span, item.id); |
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 should definitely be a regular lint using ty::layout
now.
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.
Preexisting, though.
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.
Right, mostly making a note as it's the only thing I can see left in that function.
(or @eddyb ?) |
☔ The latest upstream changes (presumably #33783) made this pull request unmergeable. Please resolve the merge conflicts. |
f972fbb
to
7e3b445
Compare
Rebased... |
☔ The latest upstream changes (presumably #33909) made this pull request unmergeable. Please resolve the merge conflicts. |
}) => { | ||
attributes::from_fn_attrs(ccx, attrs, lldecl); | ||
|
||
let is_first = !ccx.available_monomorphizations().borrow() | ||
.contains(&symbol); |
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.
so...was this code just dead?
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.
AFAICT, this logic was moved elsewhere.
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, the partitioner is now responsible for assigning the correct linkage to monomorphizations.
Kicked off a crater run, but it occurs to me that a more likely source of failure is Windows and the like. |
LGTM, other than @nikomatsakis' comments. |
@michaelwoerister crater run yielded 8 regressions. I looked at a few of them and they looked legit: https://gist.github.com/nikomatsakis/4b1496d1b60e77cac2fe8c604a6ebec2 |
Thanks for the crater run! Hopefully the regressions can be fixed quickly. |
7e3b445
to
91e9bda
Compare
So, if been looking into the first regression from the crater run and it seems that MIR is sufficiently different from old-trans that it breaks. The culprit here is the following function: fn exists<P: AsRef<Path>>(path: P) -> io::Result<bool> {
match fs::metadata(path) {
Ok(_) => Ok(true),
Err(ref err) if err.kind() == io::ErrorKind::NotFound => Ok(false),
Err(err) => Err(err)
}
} When compiling with |
@michaelwoerister This also seems to break a test when compiling with CGU (works fine without): https://gist.github.com/jonas-schievink/ad3fbdc66029a287f73ca9d2f3229027 (this is with |
…uiting logical operations.
…nd monomorphizations. See issue rust-lang#34151 for more information.
The data tracked here was meant to compare the output of the translation item collector to the set of translation items found by the on-demand translator.
64a9f96
to
1c03bfe
Compare
@bors r=eddyb Re-added a missing |
📌 Commit 1c03bfe has been approved by |
⌛ Testing commit 1c03bfe with merge d119362... |
Drive trans from the output of the translation item collector This PR changes the way how translation works above the item level. Instead of walking the HIR and calling `trans_item()` on everything encountered (while instantiating monomorphizations on-demand), we now just process the list of translation items generated by the `trans::collector`. Using the collector has the benefit of being able to know the exact set of monomorphizations and symbols before actually running translation, something that is crucial for incremental compilation (but also has [other benefits](#33602)). The collector has existed for quite a while now, but so far it's output was only used for running some auto-tests. With this PR it becomes the only source of truth about what gets translated. One modification we had to make, compared to the initial approach, is that closures are not represented as their own `TransItems`. Doing so, while still supporting non-MIR-based translation, would have been prohibitively complex, and not worth the trouble since legacy-trans will disappear sooner or later. Once there is solely MIR-trans, it would be a good idea to make closures `TransItems` again. This PR removes the most obvious functions and tables that are not needed anymore, but there's definitely still more cleanup possible later on (e.g. `monomorphize::monomorphic_fn()` does very little at this point). Since there are already more than 10 commits in here, doing this in a separate PR seems to be a better idea. These changes definitely warrant a crater run. Thanks @Aatch, for taking on one of the more tedious tasks during the dev-sprint! Thanks @eddyb, for doing some nice refactorings to symbol name generation and making sure these landed so I could use them! cc @rust-lang/compiler cc @rust-lang/tools
…s, r=compiler-errors Fix codegen-units tests that were disabled 8 years ago I don't know if any of these tests still have value. They were disabled by rust-lang#33890, and we've survived without them for a while. But considering how small this test suite is, maybe it's worth having them. I also had to add some normalization to the codegen-units tests output. I think the fact that I had to add some underscores how poor our test coverage is.
…s, r=compiler-errors Fix codegen-units tests that were disabled 8 years ago I don't know if any of these tests still have value. They were disabled by rust-lang#33890, and we've survived without them for a while. But considering how small this test suite is, maybe it's worth having them. I also had to add some normalization to the codegen-units tests output. I think the fact that I had to add some underscores how poor our test coverage is.
…s, r=compiler-errors Fix codegen-units tests that were disabled 8 years ago I don't know if any of these tests still have value. They were disabled by rust-lang#33890, and we've survived without them for a while. But considering how small this test suite is, maybe it's worth having them. I also had to add some normalization to the codegen-units tests output. I think the fact that I had to add some underscores how poor our test coverage is.
…s, r=compiler-errors Fix codegen-units tests that were disabled 8 years ago I don't know if any of these tests still have value. They were disabled by rust-lang#33890, and we've survived without them for a while. But considering how small this test suite is, maybe it's worth having them. I also had to add some normalization to the codegen-units tests output. I think the fact that I had to add some underscores how poor our test coverage is.
Rollup merge of rust-lang#128929 - saethlin:enable-codegen-units-tests, r=compiler-errors Fix codegen-units tests that were disabled 8 years ago I don't know if any of these tests still have value. They were disabled by rust-lang#33890, and we've survived without them for a while. But considering how small this test suite is, maybe it's worth having them. I also had to add some normalization to the codegen-units tests output. I think the fact that I had to add some underscores how poor our test coverage is.
This PR changes the way how translation works above the item level. Instead of walking the HIR and calling
trans_item()
on everything encountered (while instantiating monomorphizations on-demand), we now just process the list of translation items generated by thetrans::collector
. Using the collector has the benefit of being able to know the exact set of monomorphizations and symbols before actually running translation, something that is crucial for incremental compilation (but also has other benefits).The collector has existed for quite a while now, but so far it's output was only used for running some auto-tests. With this PR it becomes the only source of truth about what gets translated.
One modification we had to make, compared to the initial approach, is that closures are not represented as their own
TransItems
. Doing so, while still supporting non-MIR-based translation, would have been prohibitively complex, and not worth the trouble since legacy-trans will disappear sooner or later. Once there is solely MIR-trans, it would be a good idea to make closuresTransItems
again.This PR removes the most obvious functions and tables that are not needed anymore, but there's definitely still more cleanup possible later on (e.g.
monomorphize::monomorphic_fn()
does very little at this point). Since there are already more than 10 commits in here, doing this in a separate PR seems to be a better idea.These changes definitely warrant a crater run.
Thanks @Aatch, for taking on one of the more tedious tasks during the dev-sprint!
Thanks @eddyb, for doing some nice refactorings to symbol name generation and making sure these landed so I could use them!
cc @rust-lang/compiler
cc @rust-lang/tools