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`.
This commit is contained in:
@@ -67,6 +67,11 @@ impl Limit {
|
||||
Limit(value)
|
||||
}
|
||||
|
||||
/// Create a new unlimited limit.
|
||||
pub fn unlimited() -> Self {
|
||||
Limit(usize::MAX)
|
||||
}
|
||||
|
||||
/// Check that `value` is within the limit. Ensures that the same comparisons are used
|
||||
/// throughout the compiler, as mismatches can cause ICEs, see #72540.
|
||||
#[inline]
|
||||
@@ -119,6 +124,8 @@ pub struct Limits {
|
||||
pub move_size_limit: Limit,
|
||||
/// The maximum length of types during monomorphization.
|
||||
pub type_length_limit: Limit,
|
||||
/// The maximum pattern complexity allowed (internal only).
|
||||
pub pattern_complexity_limit: Limit,
|
||||
}
|
||||
|
||||
pub struct CompilerIO {
|
||||
|
||||
Reference in New Issue
Block a user