Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Continue to get rid of ty::Const::{try_}eval* #130950

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

Merged
bors merged 4 commits into rust-lang:master from compiler-errors:yeet-eval
Oct 21, 2024

Conversation

Copy link
Member

@compiler-errors compiler-errors commented Sep 27, 2024
edited by RalfJung
Loading

This PR mostly does:

  • Removes all of the try_eval_* and eval_* helpers from ty::Const, and replace their usages with try_to_*.
  • Remove ty::Const::eval.
  • Rename ty::Const::normalize to ty::Const::normalize_internal. This function is still used in the normalization code itself.
  • Fix some weirdness around the TransmuteFrom goal.

I'm happy to split it out further; for example, I could probably land the first part which removes the helpers, or the changes to codegen which are more obvious than the changes to tools.

r? BoxyUwU

Part of #130704

matthiaskrgr and jieyouxu reacted with eyes emoji
@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 27, 2024
Copy link
Collaborator

rustbot commented Sep 27, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in engine.rs, potentially modifying the public API of ObligationCtxt.

cc @lcnr, @compiler-errors

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred in compiler/rustc_sanitizers

cc @rust-lang/project-exploit-mitigations, @rcvalle

The Miri subtree was changed

cc @rust-lang/miri

@compiler-errors compiler-errors changed the title (削除) Yeet eval (削除ここまで) (追記) Continue to get rid of try::Const::{try_}eval* (追記ここまで) Sep 27, 2024

This comment has been minimized.

Copy link
Member Author

ah debuginfo

saethlin reacted with thumbs up emoji

This comment has been minimized.

if let Some(len) =
len.try_eval_target_usize(self.tcx, self.tcx.param_env(adt.did()))
{
if let Some(len) = len.try_to_target_usize(self.tcx) {
Copy link
Member Author

@compiler-errors compiler-errors Sep 27, 2024

Choose a reason for hiding this comment

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

This possibly may need to be normalized w/ lazy norm?

}
}

/// Normalize a type for when it is structurally matched on.
Copy link
Member Author

@compiler-errors compiler-errors Sep 27, 2024

Choose a reason for hiding this comment

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

We need this so we can structurally normalize a const in consider_builtin_transmute_candidate. That structurally matches on an Assume struct which contains a bunch of bools for configuration.

span: Span,
) -> GetSafeTransmuteErrorAndReason {
use rustc_transmute::Answer;
self.probe(|_| {
Copy link
Member Author

@compiler-errors compiler-errors Sep 27, 2024

Choose a reason for hiding this comment

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

Best reviewed without whitespace. We added a probe so we can normalize below without side-effects.

use rustc_span::symbol::sym;

let Ok((ty, cv)) = c.eval(tcx, param_env, DUMMY_SP) else {
return Some(Self {
Copy link
Member Author

@compiler-errors compiler-errors Sep 27, 2024

Choose a reason for hiding this comment

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

This was sketchy. If a const was failing to eval, we just returned "whatever". 🤔

@oli-obk oli-obk changed the title (削除) Continue to get rid of try::Const::{try_}eval* (削除ここまで) (追記) Continue to get rid of ty::Const::{try_}eval* (追記ここまで) Sep 27, 2024
Copy link
Member Author

@rustbot author

some doctest is failing fml

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 28, 2024
Copy link
Collaborator

bors commented Sep 30, 2024

☔ The latest upstream changes (presumably #131036) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 16, 2024
Copy link
Collaborator

bors commented Oct 18, 2024

☔ The latest upstream changes (presumably #131892) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

BoxyUwU commented Oct 19, 2024

I resolved the large threads since they were making it hard to review the actual code changes themselves and it also seemed like @RalfJung had a better understanding of what's going on now? Apologies if this was over-eager ^^

Copy link
Member

@BoxyUwU BoxyUwU left a comment

Choose a reason for hiding this comment

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

Thank you :3 Looks good to me, sorry for taking so long to review. Once you resolve the nit, rebase, and maybe squash some of these commits? r=me

Copy link
Member

BoxyUwU commented Oct 20, 2024

@bors r+ rollup=never

Copy link
Collaborator

bors commented Oct 20, 2024

📌 Commit 5cf8107 has been approved by BoxyUwU

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 Oct 20, 2024
Copy link
Collaborator

bors commented Oct 21, 2024

⌛ Testing commit 5cf8107 with merge f2ba411...

Copy link
Collaborator

bors commented Oct 21, 2024

☀️ Test successful - checks-actions
Approved by: BoxyUwU
Pushing f2ba411 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 21, 2024
@bors bors merged commit f2ba411 into rust-lang:master Oct 21, 2024
7 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Oct 21, 2024
Copy link
Collaborator

Finished benchmarking commit (f2ba411): 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)

Results (secondary -1.2%)

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.2% [4.2%, 4.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.9% [-4.5%, -3.2%] 2
All ❌✅ (primary) - - 0

Cycles

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

Binary size

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

Bootstrap: 781.459s -> 781.789s (0.04%)
Artifact size: 333.77 MiB -> 333.65 MiB (-0.03%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@RalfJung RalfJung RalfJung left review comments

@BoxyUwU BoxyUwU BoxyUwU left review comments

Labels
merged-by-bors This PR was explicitly merged by bors. PG-exploit-mitigations Project group: Exploit mitigations 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Milestone
1.84.0
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /