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

Resolve long compile times when evaluating always valid constants #67667

Merged

Conversation

@wesleywiser
Copy link
Member

wesleywiser commented Dec 27, 2019

This extends the existing logic which skips validating every integer or
floating point number type to also skip validating empty structs because
they are also trivially valid.

Fixes #67539

r? @oli-obk
cc @RalfJung @spastorino

@wesleywiser wesleywiser force-pushed the wesleywiser:speed_up_trivially_valid_constants branch from 8a45951 to dce8826 Dec 28, 2019
@wesleywiser

This comment has been minimized.

Copy link
Member Author

wesleywiser commented Dec 28, 2019

Force pushed

@wesleywiser wesleywiser force-pushed the wesleywiser:speed_up_trivially_valid_constants branch from dce8826 to 19834f3 Dec 28, 2019
src/librustc_mir/interpret/validity.rs Outdated Show resolved Hide resolved
src/librustc_mir/interpret/validity.rs Outdated Show resolved Hide resolved
@wesleywiser wesleywiser force-pushed the wesleywiser:speed_up_trivially_valid_constants branch from 19834f3 to 31e1c41 Dec 28, 2019
@wesleywiser

This comment has been minimized.

Copy link
Member Author

wesleywiser commented Dec 28, 2019

Force pushed. We're back to the original version with an added //FIXME to document that we could eventually handle more cases with a more complete analysis.

const FOO: [Empty; 3] = [foo(); 3];

#[warn(const_err)]
const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];

This comment has been minimized.

Copy link
@oli-obk

oli-obk Dec 29, 2019

Contributor

side note: if you remove this constant and its use, you do get a hard error on the use of FOO, but BAR is what we are actually interested in testing here, because it causes validation to error instead of const eval.

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Dec 29, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 29, 2019

📌 Commit 31e1c41 has been approved by oli-obk

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Dec 29, 2019
…d_constants, r=oli-obk

Resolve long compile times when evaluating always valid constants

This extends the existing logic which skips validating every integer or
floating point number type to also skip validating empty structs because
they are also trivially valid.

Fixes rust-lang#67539

r? @oli-obk
cc @RalfJung @spastorino
bors added a commit that referenced this pull request Dec 29, 2019
Rollup of 5 pull requests

Successful merges:

 - #64273 (Stabilize attribute macros on inline modules)
 - #67631 (Work around a resolve bug in const prop)
 - #67667 (Resolve long compile times when evaluating always valid constants)
 - #67677 (resolve: Minor cleanup of duplicate macro reexports)
 - #67687 (Do not ICE on lifetime error involving closures)

Failed merges:

 - #67682 ([const-prop] Remove useless typedef)

r? @ghost
@JohnTitor

This comment has been minimized.

Copy link
Member

JohnTitor commented Dec 29, 2019

Seems failed in #67704 (comment)
@bors r-

This extends the existing logic which skips validating every integer or
floating point number type to also skip validating empty structs because
they are also trivially valid.

Fixes #67539
@wesleywiser wesleywiser force-pushed the wesleywiser:speed_up_trivially_valid_constants branch from 31e1c41 to 5ca3a1b Dec 29, 2019
@wesleywiser

This comment has been minimized.

Copy link
Member Author

wesleywiser commented Dec 29, 2019

Ignored 32-bit platforms in the huge-values test I added.

@bors r=oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 29, 2019

📌 Commit 5ca3a1b has been approved by oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 30, 2019

⌛️ Testing commit 5ca3a1b with merge 0fb4380...

bors added a commit that referenced this pull request Dec 30, 2019
…, r=oli-obk

Resolve long compile times when evaluating always valid constants

This extends the existing logic which skips validating every integer or
floating point number type to also skip validating empty structs because
they are also trivially valid.

Fixes #67539

r? @oli-obk
cc @RalfJung @spastorino
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 30, 2019

☀️ Test successful - checks-azure
Approved by: oli-obk
Pushing 0fb4380 to master...

@bors bors added the merged-by-bors label Dec 30, 2019
@bors bors merged commit 5ca3a1b into rust-lang:master Dec 30, 2019
5 checks passed
5 checks passed
homu Test successful
Details
pr Build #20191229.54 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.