diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-02-07 10:57:14 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-02-17 09:30:33 +1100 |
| commit | b023671ce2019cdc1768d4acfb148c86ab70183a (patch) | |
| tree | 1a97d7b1eddf25dbcaa4e83bb107cc7b5b8c3c60 /compiler/rustc_middle/src/ty | |
| parent | 5bc62314547c7639484481f62f218156697cfef0 (diff) | |
| download | rust-b023671ce2019cdc1768d4acfb148c86ab70183a.tar.gz rust-b023671ce2019cdc1768d4acfb148c86ab70183a.zip | |
Add `pattern_complexity_limit` to `Limits`.
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`.
Diffstat (limited to 'compiler/rustc_middle/src/ty')
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index cb8dc692148..ea2b610a727 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2168,6 +2168,10 @@ impl<'tcx> TyCtxt<'tcx> { self.limits(()).move_size_limit } + pub fn pattern_complexity_limit(self) -> Limit { + self.limits(()).pattern_complexity_limit + } + /// All traits in the crate graph, including those not visible to the user. pub fn all_traits(self) -> impl Iterator<Item = DefId> + 'tcx { iter::once(LOCAL_CRATE) |
