Skip to content

Don't call with_reveal_all_normalized in const-eval when param_env has inference vars in it #107542

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

Conversation

compiler-errors
Copy link
Member

what: This slightly shifts the order of operations from an existing hack:

// HACK(eddyb) when the query key would contain inference variables,
// attempt using identity substs and `ParamEnv` instead, that will succeed
// when the expression doesn't depend on any parameters.
// FIXME(eddyb, skinny121) pass `InferCtxt` into here when it's available, so that
// we can call `infcx.const_eval_resolve` which handles inference variables.
let param_env_and = if param_env_and.needs_infer() {

in order to avoid calling a tcx query (TyCtxt::reveal_opaque_types_in_bounds, via ParamEnv::with_reveal_all_normalized) when a param-env has inference variables in it.

why: This allows us to enable fingerprinting of query keys/values outside of incr-comp in deubg mode, to make sure we catch other places where we're passing infer vars and other bad things into query keys. Currently that (bbf3383) crashes because we introduce inference vars into a param-env in the blanket-impl finder in rustdoc 😓

let param_env = EarlyBinder(param_env).subst(infcx.tcx, substs);

See the CI failure here: https://github.com/rust-lang/rust/actions/runs/4058194838/jobs/6984834619

@rustbot
Copy link
Collaborator

rustbot commented Feb 1, 2023

r? @jackh726

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

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 1, 2023
@jackh726
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 18, 2023

📌 Commit 789e828 has been approved by jackh726

It is now in the queue for this repository.

@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 Feb 18, 2023
@bors
Copy link
Collaborator

bors commented Feb 18, 2023

⌛ Testing commit 789e828 with merge f77f4d5...

@bors
Copy link
Collaborator

bors commented Feb 19, 2023

☀️ Test successful - checks-actions
Approved by: jackh726
Pushing f77f4d5 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 19, 2023
@bors bors merged commit f77f4d5 into rust-lang:master Feb 19, 2023
@rustbot rustbot added this to the 1.69.0 milestone Feb 19, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f77f4d5): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

@compiler-errors compiler-errors deleted the param-envs-with-inference-vars-are-cursed branch August 11, 2023 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) merged-by-bors This PR was explicitly merged by bors. 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.

5 participants