diff options
| author | Oli Scherer <github35764891676564198441@oli-obk.de> | 2021-03-26 16:28:52 +0000 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2021-04-20 09:30:28 -0400 |
| commit | a2f217902675d8ad29ecb79a8c153b485d85cb7b (patch) | |
| tree | afe1c1945d2162db75faf314269500e18120dc9c /compiler/rustc_session/src/session.rs | |
| parent | e9696c8b62c45903bed1bb39782abe43e392cd21 (diff) | |
| download | rust-a2f217902675d8ad29ecb79a8c153b485d85cb7b.tar.gz rust-a2f217902675d8ad29ecb79a8c153b485d85cb7b.zip | |
Add an attribute to be able to configure the limit
Diffstat (limited to 'compiler/rustc_session/src/session.rs')
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index cc2583be944..7bff634fb2d 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -83,6 +83,12 @@ impl Limit { } } +impl From<usize> for Limit { + fn from(value: usize) -> Self { + Self::new(value) + } +} + impl fmt::Display for Limit { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.0) @@ -143,6 +149,10 @@ pub struct Session { /// operations such as auto-dereference and monomorphization. pub recursion_limit: OnceCell<Limit>, + /// The size at which the `large_assignments` lint starts + /// being emitted. + pub move_size_limit: OnceCell<usize>, + /// The maximum length of types during monomorphization. pub type_length_limit: OnceCell<Limit>, @@ -353,6 +363,11 @@ impl Session { } #[inline] + pub fn move_size_limit(&self) -> usize { + self.move_size_limit.get().copied().unwrap() + } + + #[inline] pub fn type_length_limit(&self) -> Limit { self.type_length_limit.get().copied().unwrap() } @@ -1414,6 +1429,7 @@ pub fn build_session( features: OnceCell::new(), lint_store: OnceCell::new(), recursion_limit: OnceCell::new(), + move_size_limit: OnceCell::new(), type_length_limit: OnceCell::new(), const_eval_limit: OnceCell::new(), incr_comp_session: OneThread::new(RefCell::new(IncrCompSession::NotInitialized)), |
