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

Constant validation is not cached #53561

Closed
oli-obk opened this issue Aug 21, 2018 · 1 comment · Fixed by #53821
Closed

Constant validation is not cached #53561

oli-obk opened this issue Aug 21, 2018 · 1 comment · Fixed by #53821
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) A-incr-comp Area: Incremental compilation WG-compiler-performance Working group: Compiler Performance

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Aug 21, 2018

Constant validation is not part of the query that evaluates constants, because it would cause cycle errors in case a static directly or transitively contained a pointer back to itself.

One possible solution is to wrap another query around the const_eval query, not exposing the const_eval query to regular callers (similar to is_freeze_raw) and having a wrapper query around it that does the validation and thus also caches the validation.

@oli-obk oli-obk added A-incr-comp Area: Incremental compilation WG-compiler-performance Working group: Compiler Performance A-const-eval Area: Constant evaluation (MIR interpretation) labels Aug 21, 2018
@RalfJung
Copy link
Member

The same mechanism is also needed for generic constants to get any validation at all.

Also, when we are adding "wrapper queries", it might be a good idea to have separate queries for const and static. The current situation there (about who reports which errors when, and about whether the result must be ByRef or must be normalized to use Scalar where possible) is rather messy.

bors added a commit that referenced this issue Sep 19, 2018
Report const eval error inside the query

r? @RalfJung

fixes #53561
bors added a commit that referenced this issue Oct 26, 2018
Report const eval error inside the query

Functional changes: We no longer warn about bad constants embedded in unused types. This relied on being able to report just a warning, not a hard error on that case, which we cannot do any more now that error reporting is consistently centralized.

r? @RalfJung

fixes #53561
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) A-incr-comp Area: Incremental compilation WG-compiler-performance Working group: Compiler Performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants