diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index ef843da7307d3..a5be91bb87209 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1636,7 +1636,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { if let Some(old_def_id) = self.orig_opt_local_def_id(param) { old_def_id } else { - self.dcx().span_bug(lifetime.ident.span, "no def-id for fresh lifetime"); + self.dcx() + .span_delayed_bug(lifetime.ident.span, "no def-id for fresh lifetime"); + continue; } } diff --git a/tests/ui/lowering/issue-121431.rs b/tests/ui/lowering/issue-121431.rs new file mode 100644 index 0000000000000..b855577bcfbff --- /dev/null +++ b/tests/ui/lowering/issue-121431.rs @@ -0,0 +1,4 @@ +fn bug() -> impl CallbackMarker< Item = [(); { |_: &mut ()| 3; 4 }] > {} +//~^ ERROR cannot find trait `CallbackMarker` in this scope + +fn main() {} diff --git a/tests/ui/lowering/issue-121431.stderr b/tests/ui/lowering/issue-121431.stderr new file mode 100644 index 0000000000000..160919ffc8bac --- /dev/null +++ b/tests/ui/lowering/issue-121431.stderr @@ -0,0 +1,9 @@ +error[E0405]: cannot find trait `CallbackMarker` in this scope + --> $DIR/issue-121431.rs:1:21 + | +LL | fn bug() -> impl CallbackMarker< Item = [(); { |_: &mut ()| 3; 4 }] > {} + | ^^^^^^^^^^^^^^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0405`.