-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-codegenArea: Code generationArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
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:
pub trait Foo {
fn bar(&self) {}
}
impl Foo for () {
fn bar(&self) { println!("Hello, World!"); }
}
pub fn main() {
().bar();
}
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 use RevealMode::All
to "see through" specialization, since inlining executes quite late).
I think roughly speaking the steps to solve this issue "properly" are to:
- Refactor
Instance
andInstanceDef
out oflibrustc_trans
and (probably) intolibrustc
- Rework inlining to use those mechanisms to resolve method calls (including trait ones)
kennytm
Metadata
Metadata
Assignees
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-codegenArea: Code generationArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.