-
Notifications
You must be signed in to change notification settings - Fork 13.3k
enable mir inlining across trait methods #44389
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
Comments
Some notes: First, this code in the lints does more or less what is needed already (in particular, this match arm is the case where we are able to find a particular impl). Second, the code in trans is reasonable, but assumes that things are monomorphized (otherwise it has to return an To be quite honest i'm not entirely sure what the "right abstraction" looks like here. It's not clear to me that using I also know that we've talked for some time about migrating some of the "trans" logic out of |
This is the true entrypoint: rust/src/librustc_trans/monomorphize.rs Line 166 in d7d75ef
This should be in |
Move monomorphize::resolve() to librustc this moves `monomorphize::resolve(..)` to librustc, and re-enables inlining for some trait methods, fixing #44389 @nikomatsakis I've kept the calls to the new `ty::Instance::resolve(....)` always `.unwrap()`-ing for the moment, how/do you want to add more debugging info via `.unwrap_or()` or something like this? we still have some related `resolve_*` functions on monomorphize, but I wasn't sure moving them was into the scope for this PR too. @eddyb mind to take a look too?
As the fix to #40473, @qmx disabled MIR inlining of trait calls altogether. This issue tracks the task of re-enabling the inlining, where possible! This is a slightly more involved task.
Here is the example text:
The goal would be to have the call to
bar()
inlined. But we should draw up some more interesting tasks showing edge-cases: for example, generic functions and so forth (we should be able to useRevealMode::All
to "see through" specialization, since inlining executes quite late).I think roughly speaking the steps to solve this issue "properly" are to:
Instance
andInstanceDef
out oflibrustc_trans
and (probably) intolibrustc
The text was updated successfully, but these errors were encountered: