Skip to content
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

MIR generation cleanup #59560

Merged
merged 3 commits into from
Apr 25, 2019
Merged

Conversation

matthewjasper
Copy link
Contributor

  • Handle the case where the body of a constant is a subtype of the type of the constant (see mir_static_subtype.rs).
  • Move the evaluation of ExprKind::Use into into.rs, saving an unnecessary copy.

@rust-highfive
Copy link
Collaborator

r? @varkor

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 30, 2019
@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 1, 2019
@@ -147,7 +147,21 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t
build::construct_fn(cx, id, arguments, safety, abi,
return_ty, yield_ty, return_ty_span, body)
} else {
build::construct_const(cx, body_id, return_ty_span)
// Get the revealed type of this const. This is *not* the adjusted
// type of it's body, which may be a subtype of this type. For
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// type of it's body, which may be a subtype of this type. For
// type of its body, which may be a subtype of this type. For

@varkor
Copy link
Member

varkor commented Apr 2, 2019

This looks reasonable to me, but I'm not so familiar with the MIR design choices, so it'd be good for someone to double-check. r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned varkor Apr 2, 2019
@Dylan-DPC-zz
Copy link

ping from triage @oli-obk waiting for your review on this

@bors
Copy link
Contributor

bors commented Apr 20, 2019

☔ The latest upstream changes (presumably #59987) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Apr 24, 2019

☔ The latest upstream changes (presumably #60224) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 24, 2019

lgtm. r=me after a rebase

sorry about taking so long

Cast type may be a subtype of the destination type. There is a later
assertion that they have the same layout.
Fixes an ICE for the following code:

fn foo(_ : &()) {}
static X: fn(&'static ()) = foo;
This avoids some unnecessary moves
@matthewjasper
Copy link
Contributor Author

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Apr 24, 2019

📌 Commit e9c687b has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 24, 2019
Centril added a commit to Centril/rust that referenced this pull request Apr 25, 2019
…p, r=oli-obk

MIR generation cleanup

* Handle the case where the body of a constant is a subtype of the type of the constant (see `mir_static_subtype.rs`).
* Move the evaluation of `ExprKind::Use` into `into.rs`, saving an unnecessary copy.
bors added a commit that referenced this pull request Apr 25, 2019
Rollup of 6 pull requests

Successful merges:

 - #59560 (MIR generation cleanup)
 - #59697 (tweak unresolved label suggestion)
 - #60038 (Add codegen test for PGO instrumentation.)
 - #60160 (Fix #58270, fix off-by-one error in error diagnostics.)
 - #60185 (Reexport IntErrorKind in std)
 - #60243 (Add regression test for #53249.)

Failed merges:

r? @ghost
@bors
Copy link
Contributor

bors commented Apr 25, 2019

⌛ Testing commit e9c687b with merge 9aea116...

@bors bors merged commit e9c687b into rust-lang:master Apr 25, 2019
@matthewjasper matthewjasper deleted the mir-generation-cleanup branch April 25, 2019 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants