|
12 | 12 | use crate::bug;
|
13 | 13 | use crate::ty;
|
14 | 14 | use rustc_ast::Attribute;
|
15 |
| -use rustc_session::Limit; |
16 | 15 | use rustc_session::Session;
|
| 16 | +use rustc_session::{Limit, Limits}; |
17 | 17 | use rustc_span::symbol::{sym, Symbol};
|
18 | 18 |
|
19 | 19 | use std::num::IntErrorKind;
|
20 | 20 |
|
21 | 21 | pub fn provide(providers: &mut ty::query::Providers) {
|
22 |
| - providers.recursion_limit = |tcx, ()| get_recursion_limit(tcx.hir().krate_attrs(), tcx.sess); |
23 |
| - providers.move_size_limit = |
24 |
| - |tcx, ()| get_limit(tcx.hir().krate_attrs(), tcx.sess, sym::move_size_limit, 0).0; |
25 |
| - providers.type_length_limit = |
26 |
| - |tcx, ()| get_limit(tcx.hir().krate_attrs(), tcx.sess, sym::type_length_limit, 1048576); |
27 |
| - providers.const_eval_limit = |
28 |
| - |tcx, ()| get_limit(tcx.hir().krate_attrs(), tcx.sess, sym::const_eval_limit, 1_000_000); |
| 22 | + providers.limits = |tcx, ()| Limits { |
| 23 | + recursion_limit: get_recursion_limit(tcx.hir().krate_attrs(), tcx.sess), |
| 24 | + move_size_limit: get_limit(tcx.hir().krate_attrs(), tcx.sess, sym::move_size_limit, 0), |
| 25 | + type_length_limit: get_limit( |
| 26 | + tcx.hir().krate_attrs(), |
| 27 | + tcx.sess, |
| 28 | + sym::type_length_limit, |
| 29 | + 1048576, |
| 30 | + ), |
| 31 | + const_eval_limit: get_limit( |
| 32 | + tcx.hir().krate_attrs(), |
| 33 | + tcx.sess, |
| 34 | + sym::const_eval_limit, |
| 35 | + 1_000_000, |
| 36 | + ), |
| 37 | + } |
29 | 38 | }
|
30 | 39 |
|
31 | 40 | pub fn get_recursion_limit(krate_attrs: &[Attribute], sess: &Session) -> Limit {
|
|
0 commit comments