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

continue ParamEnv to TypingEnv transition #133212

Merged
merged 12 commits into from
Nov 20, 2024
Merged

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Nov 19, 2024

@rustbot rustbot added 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 19, 2024
@rustbot
Copy link
Collaborator

rustbot commented Nov 19, 2024

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @rust-lang/wg-const-eval

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in match checking

cc @Nadrieril

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

@lcnr lcnr changed the title move fn is_item_raw to TypingEnv continue ParamEnv to TypingEnv transition Nov 19, 2024
@lcnr
Copy link
Contributor Author

lcnr commented Nov 19, 2024

cc @BoxyUwU on the last commit

// Only anon consts can implicitly capture params.
// FIXME: is this correct behavior?
let typing_env = ty::TypingEnv::from_param_env(cx.tcx.param_env(*def_id));
let typing_env = ty::TypingEnv::post_analysis(cx.tcx, *def_id);
cx.tcx.normalize_erasing_regions(typing_env, ct)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're using normalize_erasing_regions to evaluate the constant, so it's gonna switch to Reveal::All anyways, cc @BoxyUwU

@RalfJung
Copy link
Member

What about the part where InterpCx stores a TypingEnv?

Currently the InterpCx setup in Miri still seems rather odd to me.

@lcnr
Copy link
Contributor Author

lcnr commented Nov 19, 2024

What about the part where InterpCx stores a TypingEnv?

Currently the InterpCx setup in Miri still seems rather odd to me.

I agree, wanted to do this in a separate PR so that this one doesn't grow out of hand 🤔 edit: just gonna do it here as well

@RalfJung
Copy link
Member

Separate PR is fine, I was just confused since you didn't mention it in the PR description. :)

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me when green

@lcnr
Copy link
Contributor Author

lcnr commented Nov 19, 2024

@bors r=compiler-errors rollup=iffy

@bors
Copy link
Contributor

bors commented Nov 19, 2024

📌 Commit 002efeb has been approved by compiler-errors

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 Nov 19, 2024
@lcnr
Copy link
Contributor Author

lcnr commented Nov 19, 2024

@bors rollup=never

probably slightly impacts performance again

@bors
Copy link
Contributor

bors commented Nov 20, 2024

⌛ Testing commit 002efeb with merge 70e814b...

@bors
Copy link
Contributor

bors commented Nov 20, 2024

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 70e814b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 20, 2024
@bors bors merged commit 70e814b into rust-lang:master Nov 20, 2024
7 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 20, 2024
pub(crate) param_env: ty::ParamEnv<'tcx>,
/// The current context in case we're evaluating in a
/// polymorphic context. This always uses `ty::TypingMode::PostAnalysis`
pub typing_env: ty::TypingEnv<'tcx>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should make this public, I want to be sure nobody mutates this field... I'll make a PR to privatize this again.

@lcnr lcnr deleted the questionable-uwu branch November 20, 2024 10:04
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (70e814b): comparison URL.

Overall result: ❌ regressions - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.4% [0.3%, 0.5%] 5
Regressions ❌
(secondary)
2.1% [0.1%, 6.6%] 12
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.3%, 0.5%] 5

Max RSS (memory usage)

Results (primary -1.4%, secondary -2.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.7% [4.7%, 4.7%] 1
Improvements ✅
(primary)
-1.4% [-1.4%, -1.4%] 1
Improvements ✅
(secondary)
-3.7% [-5.6%, -2.7%] 4
All ❌✅ (primary) -1.4% [-1.4%, -1.4%] 1

Cycles

Results (secondary 4.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.5% [1.6%, 7.2%] 11
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 793.573s -> 793.177s (-0.05%)
Artifact size: 335.42 MiB -> 335.96 MiB (0.16%)

@rustbot rustbot added the perf-regression Performance regression. label Nov 20, 2024
@lcnr lcnr mentioned this pull request Nov 20, 2024
@lcnr
Copy link
Contributor Author

lcnr commented Nov 20, 2024

Passing TypingEnv to the const-eval queries seems to have a bigger perf impact. Will look into reverting this change and making a new TypingEnv from scratch in the query

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2024
finish `Reveal` removal

After rust-lang#133212 changed the `TypingMode` to be the only source of truth, this entirely rips out `Reveal`.

cc rust-lang#132279

r? `@compiler-errors`
@RalfJung
Copy link
Member

RalfJung commented Nov 20, 2024 via email

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 20, 2024
interpret: make typing_env field private

This was made public in rust-lang#133212 but IMO it should remain private. (Specifically, this prevents it from being mutated.)

r? `@lcnr`
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2024
finish `Reveal` removal

After rust-lang#133212 changed the `TypingMode` to be the only source of truth, this entirely rips out `Reveal`.

cc rust-lang#132279

r? `@compiler-errors`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2024
Rollup merge of rust-lang#133241 - RalfJung:typing-env, r=lcnr

interpret: make typing_env field private

This was made public in rust-lang#133212 but IMO it should remain private. (Specifically, this prevents it from being mutated.)

r? `@lcnr`
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Nov 21, 2024
interpret: make typing_env field private

This was made public in rust-lang/rust#133212 but IMO it should remain private. (Specifically, this prevents it from being mutated.)

r? `@lcnr`
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 23, 2024
…rors,BoxyUwU

finish `Reveal` removal

After rust-lang#133212 changed the `TypingMode` to be the only source of truth, this entirely rips out `Reveal`.

cc rust-lang#132279

r? `@compiler-errors`
github-merge-queue bot pushed a commit to model-checking/kani that referenced this pull request Nov 28, 2024
Fix required due to the following changes to Rust's internal API:
- rust-lang/rust#132460
- rust-lang/rust#133212
- rust-lang/rust#131326

Resolves #3731

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

---------

Co-authored-by: Zyad Hassan <88045115+zhassan-aws@users.noreply.github.com>
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Dec 6, 2024
…rors

continue `ParamEnv` to `TypingEnv` transition

cc rust-lang#132279

r? `@compiler-errors`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants