Skip to content

Commit 3fe0325

Browse files
committed
Make "no def-id for fresh lifetime" a span_delayed_bug.
Fixes #121431.
1 parent 96f609a commit 3fe0325

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16361636
if let Some(old_def_id) = self.orig_opt_local_def_id(param) {
16371637
old_def_id
16381638
} else {
1639-
self.dcx().span_bug(lifetime.ident.span, "no def-id for fresh lifetime");
1639+
self.dcx()
1640+
.span_delayed_bug(lifetime.ident.span, "no def-id for fresh lifetime");
1641+
continue;
16401642
}
16411643
}
16421644

tests/ui/lowering/issue-121431.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn bug<T>() -> impl CallbackMarker< Item = [(); { |_: &mut ()| 3; 4 }] > {}
2+
//~^ ERROR cannot find trait `CallbackMarker` in this scope
3+
4+
fn main() {}

tests/ui/lowering/issue-121431.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0405]: cannot find trait `CallbackMarker` in this scope
2+
--> $DIR/issue-121431.rs:1:21
3+
|
4+
LL | fn bug<T>() -> impl CallbackMarker< Item = [(); { |_: &mut ()| 3; 4 }] > {}
5+
| ^^^^^^^^^^^^^^ not found in this scope
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0405`.

0 commit comments

Comments
 (0)