Skip to content

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Jan 5, 2017

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
Contributor

r? @pnkfelix

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

@eddyb
Copy link
Member Author

eddyb commented Jan 5, 2017

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

@nikomatsakis
Copy link
Contributor

r? @nikomatsakis

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 7, 2017

📌 Commit 8f84e95 has been approved by nikomatsakis

@bors
Copy link
Collaborator

bors commented Jan 8, 2017

⌛ 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
Copy link
Collaborator

bors commented Jan 8, 2017

☀️ 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