Skip to content

Commit 163b65e

Browse files
nikomatsakiscramertj
authored andcommitted
convert the "only named lifetimes" error into a delay-span-bug
The existing rules should rule out this possibility.
1 parent ed5d1dd commit 163b65e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/librustc_typeck/check/writeback.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,11 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
320320
map.get(&Kind::from(r)).and_then(|k| k.as_region()) { r1 } else
321321
{
322322
let span = node_id.to_span(&self.fcx.tcx);
323-
span_err!(self.tcx().sess, span, E0564,
324-
"only named lifetimes are allowed in `impl Trait`, \
325-
but `{}` was found in the type `{}`", r, inside_ty);
323+
self.tcx().sess.delay_span_bug(
324+
span,
325+
&format!("only named lifetimes are allowed in `impl Trait`, \
326+
but `{}` was found in the type `{}`",
327+
r, inside_ty));
326328
gcx.types.re_static
327329
},
328330
}

src/test/compile-fail/impl-trait/more_lifetimes.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ fn whatever<T>(x: T) -> impl Any + 'static {
2323

2424
fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
2525
//~^ ERROR lifetime mismatch
26-
//~^^ ERROR only named lifetimes are allowed in `impl Trait`, but `'b` was found
27-
//~^^^ ERROR only named lifetimes are allowed in `impl Trait`, but `'b` was found
28-
// TODO^ remove the above duplicate errors
2926
move |_| println!("{}", y)
3027
}
3128

0 commit comments

Comments
 (0)