Skip to content

Commit 291a620

Browse files
authored
Rollup merge of rust-lang#52622 - estebank:lifetime-multispan, r=nikomatsakis
Use MultiSpan in E0707 and E709
2 parents 85bb13c + 59a435b commit 291a620

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/librustc/hir/lowering.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ use syntax::tokenstream::{Delimited, TokenStream, TokenTree};
7373
use syntax::parse::token::Token;
7474
use syntax::util::small_vector::SmallVector;
7575
use syntax::visit::{self, Visitor};
76-
use syntax_pos::Span;
76+
use syntax_pos::{Span, MultiSpan};
7777

7878
const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF;
7979

@@ -2071,7 +2071,7 @@ impl<'a> LoweringContext<'a> {
20712071
if current_lt_name != name {
20722072
struct_span_err!(
20732073
self.context.sess,
2074-
current_lt_span.between(lifetime.span),
2074+
MultiSpan::from_spans(vec![current_lt_span, lifetime.span]),
20752075
E0709,
20762076
"multiple different lifetimes used in arguments of `async fn`",
20772077
)
@@ -2083,7 +2083,7 @@ impl<'a> LoweringContext<'a> {
20832083
} else if current_lt_name.is_elided() && name.is_elided() {
20842084
struct_span_err!(
20852085
self.context.sess,
2086-
current_lt_span.between(lifetime.span),
2086+
MultiSpan::from_spans(vec![current_lt_span, lifetime.span]),
20872087
E0707,
20882088
"multiple elided lifetimes used in arguments of `async fn`",
20892089
)

src/test/ui/async-fn-multiple-lifetimes.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0709]: multiple different lifetimes used in arguments of `async fn`
2-
--> $DIR/async-fn-multiple-lifetimes.rs:17:49
2+
--> $DIR/async-fn-multiple-lifetimes.rs:17:47
33
|
44
LL | async fn multiple_named_lifetimes<'a, 'b>(_: &'a u8, _: &'b u8) {}
5-
| --^^^^^^^^^-- different lifetime here
5+
| ^^ ^^ different lifetime here
66
| |
77
| first lifetime here
88
|
@@ -12,7 +12,7 @@ error[E0707]: multiple elided lifetimes used in arguments of `async fn`
1212
--> $DIR/async-fn-multiple-lifetimes.rs:26:39
1313
|
1414
LL | async fn multiple_elided_lifetimes(_: &u8, _: &u8) {}
15-
| -^^^^^^^- different lifetime here
15+
| ^ ^ different lifetime here
1616
| |
1717
| first lifetime here
1818
|

0 commit comments

Comments
 (0)