-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Overhaul rustc_middle::limits
#136671
Overhaul rustc_middle::limits
#136671
Conversation
rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer Some changes occurred in match checking cc @Nadrieril Some changes occurred in exhaustiveness checking cc @Nadrieril |
The last commit renames the unstable |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't use rustc_session
in rust-analyzer (and thus not in the relevant pattern matching api)
I don't mind the renaming, but it sounds weird "allow pattern_complexity_limits". It's supposed to make sense in a sentence. 😉 |
Oh. Well, those changes are easy enough to remove, I can just use In what sense can't it be used? It seemed to compile ok, and a few other rustc crates are seemingly used, like |
rust-analyzer needs to build on stable (as well as not depend on specifically |
It's a crate-level attribute with a parameter, so you use it like |
Oh I see, makes more sense now. :) |
cbe77b1
to
65caf76
Compare
Thanks for the comments and explanations. I have changed things so that rust-analyzer doesn't depend on |
☔ The latest upstream changes (presumably #136943) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I didn't know there was a shared infrastructure for limits, this is better like this. r=me once the pattern_analysis tests can also run on stable.
It's similar to the other limits, e.g. obtained via `get_limit`. So it makes sense to handle it consistently with the other limits. We now use `Limit`/`usize` in most places instead of `Option<usize>`, so we use `Limit::new(usize::MAX)`/`usize::MAX` to emulate how `None` used to work. The commit also adds `Limit::unlimited`.
Thanks to the previous commit, they no longer need to be separate.
It's always good to make `rustc_middle` smaller. `rustc_interface` is the best destination, because it's the only crate that calls `get_recursive_limit`.
For consistency with `recursion_limit`, `move_size_limit`, and `type_length_limit`.
65caf76
to
7a8c0fc
Compare
I addressed the comments. @bors r=Nadrieril rollup |
…eril Overhaul `rustc_middle::limits` In particular, to make `pattern_complexity` work more like other limits, which then enables some other simplifications. r? `@Nadrieril`
…kingjubilee Rollup of 12 pull requests Successful merges: - rust-lang#136671 (Overhaul `rustc_middle::limits`) - rust-lang#136817 (Pattern Migration 2024: clean up and comment) - rust-lang#136844 (Use `const_error!` when possible) - rust-lang#136953 (rustc_target: import TargetMetadata) - rust-lang#137095 (Replace some u64 hashes with Hash64) - rust-lang#137100 (HIR analysis: Remove unnecessary abstraction over list of clauses) - rust-lang#137105 (Restrict DerefPure for Cow<T> impl to T = impl Clone, [impl Clone], str.) - rust-lang#137120 (Enable `relative-path-include-bytes-132203` rustdoc-ui test on Windows) - rust-lang#137125 (Re-add missing empty lines in the releases notes) - rust-lang#137140 (Fix const items not being allowed to be called `r#move` or `r#static`) - rust-lang#137145 (use add-core-stubs / minicore for a few more tests) - rust-lang#137149 (Remove SSE ABI from i586-pc-windows-msvc) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#136466 (Start removing `rustc_middle::hir::map::Map`) - rust-lang#136671 (Overhaul `rustc_middle::limits`) - rust-lang#136817 (Pattern Migration 2024: clean up and comment) - rust-lang#136844 (Use `const_error!` when possible) - rust-lang#137080 (bootstrap: add more tracing to compiler/std/llvm flows) - rust-lang#137101 (`invalid_from_utf8[_unchecked]`: also lint inherent methods) - rust-lang#137140 (Fix const items not being allowed to be called `r#move` or `r#static`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136671 - nnethercote:middle-limits, r=Nadrieril Overhaul `rustc_middle::limits` In particular, to make `pattern_complexity` work more like other limits, which then enables some other simplifications. r? ``@Nadrieril``
In particular, to make
pattern_complexity
work more like other limits, which then enables some other simplifications.r? @Nadrieril