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

Make exhaustiveness usable outside of rustc #118842

Merged
merged 16 commits into from
Dec 19, 2023

Conversation

Nadrieril
Copy link
Member

With this PR, rustc_pattern_analysis compiles on stable (with the stable feature)! rust-analyzer will be able to use it to provide match-related diagnostics and refactors.

Two questions:

  • Should I name the feature nightly instead of rustc for consistency with other crates? rustc makes more sense imo.
  • typed-arena is an optional dependency but tidy made me add it to the allow-list anyway. Can I avoid that somehow?

r? @compiler-errors

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 11, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 11, 2023

The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging.

cc @davidtwco, @wesleywiser

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@Nadrieril
Copy link
Member Author

typed-arena is MIT licensed btw

@Nadrieril
Copy link
Member Author

Bracing myself for perf sadness

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 11, 2023
@Nadrieril Nadrieril added A-exhaustiveness-checking Relating to exhaustiveness / usefulness checking of patterns and removed A-testsuite Area: The testsuite used to check the correctness of rustc labels Dec 11, 2023
@bors
Copy link
Contributor

bors commented Dec 11, 2023

⌛ Trying commit 5d7b823 with merge 6c25005...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 11, 2023
Make exhaustiveness usable outside of rustc

With this PR, `rustc_pattern_analysis` compiles on stable (with the `stable` feature)! `rust-analyzer` will be able to use it to provide match-related diagnostics and refactors.

Two questions:
- Should I name the feature `nightly` instead of `rustc` for consistency with other crates? `rustc` makes more sense imo.
- `typed-arena` is an optional dependency but tidy made me add it to the allow-list anyway. Can I avoid that somehow?

r? `@compiler-errors`
@bors
Copy link
Contributor

bors commented Dec 12, 2023

☀️ Try build successful - checks-actions
Build commit: 6c25005 (6c25005174ed8f066e244b3d08df28671ed44189)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6c25005): comparison URL.

Overall result: ❌ regressions - 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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.9% [0.8%, 1.0%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

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)
- - 0
Improvements ✅
(primary)
-1.5% [-1.5%, -1.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.5% [-1.5%, -1.5%] 1

Cycles

Results

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)
2.9% [2.1%, 3.6%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.9% [-3.9%, -3.9%] 2
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 672.051s -> 672.417s (0.05%)
Artifact size: 314.25 MiB -> 314.30 MiB (0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Dec 12, 2023
compiler/rustc_pattern_analysis/src/pat.rs Show resolved Hide resolved
compiler/rustc_pattern_analysis/src/lib.rs Outdated Show resolved Hide resolved
compiler/rustc_pattern_analysis/src/constructor.rs Outdated Show resolved Hide resolved
compiler/rustc_pattern_analysis/src/rustc.rs Outdated Show resolved Hide resolved
compiler/rustc_pattern_analysis/src/lib.rs Outdated Show resolved Hide resolved
compiler/rustc_pattern_analysis/src/lints.rs Show resolved Hide resolved
compiler/rustc_pattern_analysis/src/lints.rs Outdated Show resolved Hide resolved
@rustbot rustbot added the A-testsuite Area: The testsuite used to check the correctness of rustc label Dec 14, 2023
@compiler-errors
Copy link
Member

I will review this on Monday probably

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.

Please address these in a follow-up commit

/// Context that provides type information about constructors.
///
/// Most of the crate is parameterized on a type that implements this trait.
pub trait TypeCx: Sized + Clone + fmt::Debug {
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn't need a Clone supertrait here.

}

/// Context that provides information global to a match.
#[derive(Clone)]
Copy link
Member

Choose a reason for hiding this comment

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

you can use derivative like rustc_type_ir to avoid needing to 1. manual Copy impl and 2. Clone that requires Cx: Clone.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh nice I didn't know we used derivative

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Dec 19, 2023

📌 Commit 3016c29 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 Dec 19, 2023
@compiler-errors
Copy link
Member

@bors rollup=never

#[cfg(feature = "nightly")]
let mut words = {
// We take some effort to avoid copying the words.
let words = Rc::<[Word; CHUNK_WORDS]>::new_zeroed();
Copy link
Contributor

Choose a reason for hiding this comment

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

does this deserve a TODO that points to a tracking issue?

Copy link
Member

Choose a reason for hiding this comment

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

@Nadrieril should add this to a follow-up PR if it matters.

@bors
Copy link
Contributor

bors commented Dec 19, 2023

⌛ Testing commit 3016c29 with merge 3a539c0...

@bors
Copy link
Contributor

bors commented Dec 19, 2023

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 19, 2023
@bors bors merged commit 3a539c0 into rust-lang:master Dec 19, 2023
12 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 19, 2023
@Nadrieril Nadrieril deleted the librarify-further branch December 19, 2023 19:56
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3a539c0): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.9% [0.9%, 1.0%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.4%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

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)
2.1% [0.6%, 3.6%] 2
Regressions ❌
(secondary)
3.5% [3.5%, 3.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.8% [-0.8%, -0.8%] 1
All ❌✅ (primary) 2.1% [0.6%, 3.6%] 2

Cycles

Results

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)
3.0% [2.5%, 3.4%] 6
Improvements ✅
(primary)
-0.5% [-0.5%, -0.5%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-0.5%, -0.5%] 2

Binary size

Results

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)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 1
All ❌✅ (primary) - - 0

Bootstrap: 671.842s -> 673.86s (0.30%)
Artifact size: 312.46 MiB -> 312.43 MiB (-0.01%)

compiler-errors added a commit to compiler-errors/rust that referenced this pull request Dec 23, 2023
…r=compiler-errors

Exhaustiveness: clean up after librarification

This cleans up some things that weren't done nicely by rust-lang#118842.

r? `@compiler-errors`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 23, 2023
Rollup merge of rust-lang#119230 - Nadrieril:librarify-even-further, r=compiler-errors

Exhaustiveness: clean up after librarification

This cleans up some things that weren't done nicely by rust-lang#118842.

r? `@compiler-errors`
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Dec 24, 2023
…r-errors

Exhaustiveness: clean up after librarification

This cleans up some things that weren't done nicely by rust-lang/rust#118842.

r? `@compiler-errors`
@Kobzol
Copy link
Contributor

Kobzol commented Dec 26, 2023

Small regression to a single stress test benchmark. Worth the librarification effort, I don't think that we need to dive further into this.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-exhaustiveness-checking Relating to exhaustiveness / usefulness checking of patterns A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

7 participants