diff options
| author | bors <bors@rust-lang.org> | 2023-04-03 07:27:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-04-03 07:27:58 +0000 |
| commit | 932c173ca1b7a79c1005e2d72ddfa505a7bf2cfa (patch) | |
| tree | 2c44d95b514a02c51806d2e3f38e3fe29c9b07e4 /compiler/rustc_middle/src/ty/util.rs | |
| parent | d0eed58a1e78eb1a25bb54076e4b0f7ea5ff7401 (diff) | |
| parent | 22df7107bdd36cf47e327c8165e720c1eccb351d (diff) | |
| download | rust-932c173ca1b7a79c1005e2d72ddfa505a7bf2cfa.tar.gz rust-932c173ca1b7a79c1005e2d72ddfa505a7bf2cfa.zip | |
Auto merge of #109884 - matthiaskrgr:rollup-5wapig9, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #109526 (LIBPATH is used as dylib's path environment variable on AIX) - #109642 (check for missing codegen backeng config) - #109722 (Implement read_buf for RustHermit) - #109856 (fix(middle): emit error rather than delay bug when reaching limit) - #109868 (Improve PR job names in Github Actions preview) - #109871 (Include invocation start times) - #109873 (Move some UI tests into subdirectories) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_middle/src/ty/util.rs')
| -rw-r--r-- | compiler/rustc_middle/src/ty/util.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index d3565b28ae5..4411bcd927d 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -19,7 +19,8 @@ use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_index::bit_set::GrowableBitSet; use rustc_index::vec::{Idx, IndexVec}; use rustc_macros::HashStable; -use rustc_span::{sym, DUMMY_SP}; +use rustc_session::Limit; +use rustc_span::sym; use rustc_target::abi::{Integer, IntegerType, Size, TargetDataLayout}; use rustc_target::spec::abi::Abi; use smallvec::SmallVec; @@ -225,10 +226,13 @@ impl<'tcx> TyCtxt<'tcx> { let recursion_limit = self.recursion_limit(); for iteration in 0.. { if !recursion_limit.value_within_limit(iteration) { - return self.ty_error_with_message( - DUMMY_SP, - &format!("reached the recursion limit finding the struct tail for {}", ty), - ); + let suggested_limit = match recursion_limit { + Limit(0) => Limit(2), + limit => limit * 2, + }; + let reported = + self.sess.emit_err(crate::error::RecursionLimitReached { ty, suggested_limit }); + return self.ty_error(reported); } match *ty.kind() { ty::Adt(def, substs) => { |
