Skip to content

Commit 311ff5b

Browse files
committed
Tweak span for ok-wrapping in no-tail block
1 parent c88efe4 commit 311ff5b

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/librustc/hir/lowering.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3017,9 +3017,10 @@ impl<'a> LoweringContext<'a> {
30173017
let tail = block.expr.take().map_or_else(
30183018
|| {
30193019
let LoweredNodeId { node_id, hir_id } = this.next_id();
3020+
let span = this.sess.codemap().end_point(unstable_span);
30203021
hir::Expr {
30213022
id: node_id,
3022-
span: unstable_span,
3023+
span,
30233024
node: hir::ExprTup(hir_vec![]),
30243025
attrs: ThinVec::new(),
30253026
hir_id,

src/test/ui/catch-block-type-error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() {
2020
};
2121

2222
let _: Option<i32> = do catch {
23-
//~^ ERROR type mismatch
2423
foo()?;
2524
};
25+
//~^ ERROR type mismatch
2626
}

src/test/ui/catch-block-type-error.stderr

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ LL | 42
88
found type `{integer}`
99

1010
error[E0271]: type mismatch resolving `<std::option::Option<i32> as std::ops::Try>::Ok == ()`
11-
--> $DIR/catch-block-type-error.rs:22:35
11+
--> $DIR/catch-block-type-error.rs:24:5
1212
|
13-
LL | let _: Option<i32> = do catch {
14-
| ___________________________________^
15-
LL | | //~^ ERROR type mismatch
16-
LL | | foo()?;
17-
LL | | };
18-
| |_____^ expected i32, found ()
13+
LL | };
14+
| ^ expected i32, found ()
1915
|
2016
= note: expected type `i32`
2117
found type `()`

0 commit comments

Comments
 (0)