Skip to content

Avoid calling the layout_of query in lit_to_const - #136302

Merged
bors merged 2 commits into
rust-lang:masterfrom
oli-obk:push-vvqmwzunxsrk
Feb 5, 2025
Merged

Avoid calling the layout_of query in lit_to_const#136302
bors merged 2 commits into
rust-lang:masterfrom
oli-obk:push-vvqmwzunxsrk

Conversation

@oli-obk

@oli-obkoli-obk commented Jan 30, 2025

Copy link
Copy Markdown
Contributor

We got all the information available locally

@rustbot

Copy link
Copy Markdown
Collaborator

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbotrustbot 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. labels Jan 30, 2025
@oli-obk

Copy link
Copy Markdown
ContributorAuthor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbotrustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 30, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 30, 2025
Avoid calling the layout_of query in lit_to_const
We got all the information available locally
@bors

bors commented Jan 30, 2025

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 0cd5186 with merge b95ed12...

@bors

bors commented Jan 30, 2025

Copy link
Copy Markdown
Collaborator

☀️ Try build successful - checks-actions
Build commit: b95ed12 (b95ed1281fca307fccf25399a576bc09de0ec55c)

@rust-timer

This comment has been minimized.

@compiler-errors

Copy link
Copy Markdown
Contributor

r=me when perf is back

@rustbot author

@rustbotrustbot 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 Jan 30, 2025
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (b95ed12): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.4%[-0.6%, -0.2%]19
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -2.7%, secondary -2.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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-2.7%[-3.6%, -2.1%]4
Improvements ✅
(secondary)
-2.2%[-3.7%, -1.4%]3
All ❌✅ (primary)-2.7%[-3.6%, -2.1%]4

Cycles

Results (secondary -2.6%)

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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.6%[-3.4%, -1.8%]2
All ❌✅ (primary)--0

Binary size

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

Bootstrap: 778.535s -> 778.836s (0.04%)
Artifact size: 328.51 MiB -> 328.42 MiB (-0.03%)

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 31, 2025
@compiler-errors

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jan 31, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 0cd5186 has been approved by compiler-errors

It is now in the queue for this repository.

@borsbors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 31, 2025
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Feb 5, 2025
…eril
Reject negative literals for unsigned or char types in pattern ranges and literals
It sucks a bit that we have to duplicate the work here (normal expressions just get this for free from the `ExprKind::UnOp(UnOp::Neg, ...)` typeck logic.
In rust-lang#134228 I caused
```rust
fn main() {
match 42_u8 {
-10..255 => {},
_ => {}
}
}
```
to just compile without even a lint.
I can't believe we didn't have tests for this
Amusingly rust-lang#136302 will also register a delayed bug in `lit_to_const` for this, so we'll have a redundancy if something like this fails again.
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Feb 5, 2025
…eril
Reject negative literals for unsigned or char types in pattern ranges and literals
It sucks a bit that we have to duplicate the work here (normal expressions just get this for free from the `ExprKind::UnOp(UnOp::Neg, ...)` typeck logic.
In rust-lang#134228 I caused
```rust
fn main() {
match 42_u8 {
-10..255 => {},
_ => {}
}
}
```
to just compile without even a lint.
I can't believe we didn't have tests for this
Amusingly rust-lang#136302 will also register a delayed bug in `lit_to_const` for this, so we'll have a redundancy if something like this fails again.
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Feb 5, 2025
…eril
Reject negative literals for unsigned or char types in pattern ranges and literals
It sucks a bit that we have to duplicate the work here (normal expressions just get this for free from the `ExprKind::UnOp(UnOp::Neg, ...)` typeck logic.
In rust-lang#134228 I caused
```rust
fn main() {
match 42_u8 {
-10..255 => {},
_ => {}
}
}
```
to just compile without even a lint.
I can't believe we didn't have tests for this
Amusingly rust-lang#136302 will also register a delayed bug in `lit_to_const` for this, so we'll have a redundancy if something like this fails again.
@bors

bors commented Feb 5, 2025

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 0cd5186 with merge d4bdd1e...

@bors

bors commented Feb 5, 2025

Copy link
Copy Markdown
Collaborator

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

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Feb 5, 2025
@bors
bors merged commit d4bdd1e into rust-lang:masterFeb 5, 2025
@rustbotrustbot added this to the 1.86.0 milestone Feb 5, 2025
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (d4bdd1e): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.5%[-0.6%, -0.3%]14
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -2.6%, secondary -0.6%)

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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
6.2%[6.2%, 6.2%]1
Improvements ✅
(primary)
-2.6%[-3.5%, -1.4%]3
Improvements ✅
(secondary)
-2.9%[-4.1%, -0.8%]3
All ❌✅ (primary)-2.6%[-3.5%, -1.4%]3

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: 778.541s -> 778.801s (0.03%)
Artifact size: 328.82 MiB -> 328.78 MiB (-0.01%)

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 6, 2025
Rollup merge of rust-lang#136304 - oli-obk:push-ymxoklvzrpvx, r=Nadrieril
Reject negative literals for unsigned or char types in pattern ranges and literals
It sucks a bit that we have to duplicate the work here (normal expressions just get this for free from the `ExprKind::UnOp(UnOp::Neg, ...)` typeck logic.
In rust-lang#134228 I caused
```rust
fn main() {
match 42_u8 {
-10..255 => {},
_ => {}
}
}
```
to just compile without even a lint.
I can't believe we didn't have tests for this
Amusingly rust-lang#136302 will also register a delayed bug in `lit_to_const` for this, so we'll have a redundancy if something like this fails again.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

6 participants

@oli-obk@rustbot@rust-timer@bors@compiler-errors@fmease