about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-20 09:36:28 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-21 10:35:54 +1100
commit2903bbbc156fb9707b43038af6723844fd4ccf29 (patch)
tree390101b18fd0e9ef81ab70d788653e96b991f8e5 /compiler/rustc_borrowck/src
parent010f3944e0f0baac8d738da49772fd06acd3701b (diff)
downloadrust-2903bbbc156fb9707b43038af6723844fd4ccf29.tar.gz
rust-2903bbbc156fb9707b43038af6723844fd4ccf29.zip
Convert `bug`s back to `delayed_bug`s.
This commit undoes some of the previous commit's mechanical changes,
based on human judgment.
Diffstat (limited to 'compiler/rustc_borrowck/src')
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/region_name.rs4
-rw-r--r--compiler/rustc_borrowck/src/type_check/free_region_relations.rs6
2 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/region_name.rs b/compiler/rustc_borrowck/src/diagnostics/region_name.rs
index fea8c5a6de6..e228bef1139 100644
--- a/compiler/rustc_borrowck/src/diagnostics/region_name.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/region_name.rs
@@ -626,8 +626,8 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
                     | GenericArgKind::Const(_),
                     _,
                 ) => {
-                    // HIR lowering sometimes doesn't catch this in erroneous
-                    // programs, so we need to use span_delayed_bug here. See #82126.
+                    // This was previously a `span_delayed_bug` and could be
+                    // reached by the test for #82126, but no longer.
                     self.dcx().span_bug(
                         hir_arg.span(),
                         format!("unmatched arg and hir arg: found {kind:?} vs {hir_arg:?}"),
diff --git a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
index 0fc04175705..897918fb0a4 100644
--- a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
+++ b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
@@ -316,7 +316,11 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
                     .and(type_op::normalize::Normalize::new(ty))
                     .fully_perform(self.infcx, span)
                 else {
-                    tcx.dcx().span_bug(span, format!("failed to normalize {ty:?}"));
+                    // Note: this path is currently not reached in any test, so
+                    // any example that triggers this would be worth minimizing
+                    // and converting into a test.
+                    tcx.dcx().span_delayed_bug(span, format!("failed to normalize {ty:?}"));
+                    continue;
                 };
                 constraints.extend(c);