Skip to content

Allow projections to be promoted to constants in MIR.#38837

Merged
bors merged 1 commit into
rust-lang:masterfrom
eddyb:issue-38074
Jan 8, 2017
Merged

Allow projections to be promoted to constants in MIR.#38837
bors merged 1 commit into
rust-lang:masterfrom
eddyb:issue-38074

Conversation

@eddyb

@eddyb eddyb commented Jan 5, 2017

Copy link
Copy Markdown
Contributor

This employs the LvalueContext additions by @pcwalton to properly extend the MIR promotion of temporaries to allow projections (field accesses, indexing and dereferences) on said temporaries.

It's needed both parity with the old constant qualification logic (for current borrowck) and it fixes #38074.
The former is required for soundness if we accept the RFC for promoting rvalues to 'static constants.
That is, until we get MIR borrowck and the same source of truth will be used for both checks and codegen.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @pnkfelix

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

@eddyb

eddyb commented Jan 5, 2017

Copy link
Copy Markdown
Contributor Author

Heh, looks like this needs #38833 to fully work (in debug mode? testing libstd).

@nikomatsakis

Copy link
Copy Markdown
Contributor

r? @nikomatsakis

@nikomatsakis

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jan 7, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 8f84e95 has been approved by nikomatsakis

@bors

bors commented Jan 8, 2017

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 8f84e95 with merge d2c7959...

bors added a commit that referenced this pull request Jan 8, 2017
Allow projections to be promoted to constants in MIR.

This employs the `LvalueContext` additions by @pcwalton to properly extend the MIR promotion of temporaries to allow projections (field accesses, indexing and dereferences) on said temporaries.

It's needed both parity with the old constant qualification logic (for current borrowck) and it fixes #38074.
The former is *required for soundness* if we accept the RFC for promoting rvalues to `'static` constants.
That is, until we get MIR borrowck and the same source of truth will be used for both checks and codegen.
@bors

bors commented Jan 8, 2017

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing d2c7959 to master...

@bors bors merged commit 8f84e95 into rust-lang:master Jan 8, 2017
@eddyb eddyb deleted the issue-38074 branch January 8, 2017 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

checked arithmetic not treated as constant in debug builds

5 participants