1
Fork 0

Tweak span for ok-wrapping in no-tail block

This commit is contained in:
Scott McMurray 2018-04-10 00:45:57 -07:00
parent c88efe46b8
commit 311ff5b441
3 changed files with 6 additions and 9 deletions

View file

@ -3017,9 +3017,10 @@ impl<'a> LoweringContext<'a> {
let tail = block.expr.take().map_or_else( let tail = block.expr.take().map_or_else(
|| { || {
let LoweredNodeId { node_id, hir_id } = this.next_id(); let LoweredNodeId { node_id, hir_id } = this.next_id();
let span = this.sess.codemap().end_point(unstable_span);
hir::Expr { hir::Expr {
id: node_id, id: node_id,
span: unstable_span, span,
node: hir::ExprTup(hir_vec![]), node: hir::ExprTup(hir_vec![]),
attrs: ThinVec::new(), attrs: ThinVec::new(),
hir_id, hir_id,

View file

@ -20,7 +20,7 @@ fn main() {
}; };
let _: Option<i32> = do catch { let _: Option<i32> = do catch {
//~^ ERROR type mismatch
foo()?; foo()?;
}; };
//~^ ERROR type mismatch
} }

View file

@ -8,14 +8,10 @@ LL | 42
found type `{integer}` found type `{integer}`
error[E0271]: type mismatch resolving `<std::option::Option<i32> as std::ops::Try>::Ok == ()` error[E0271]: type mismatch resolving `<std::option::Option<i32> as std::ops::Try>::Ok == ()`
--> $DIR/catch-block-type-error.rs:22:35 --> $DIR/catch-block-type-error.rs:24:5
| |
LL | let _: Option<i32> = do catch { LL | };
| ___________________________________^ | ^ expected i32, found ()
LL | | //~^ ERROR type mismatch
LL | | foo()?;
LL | | };
| |_____^ expected i32, found ()
| |
= note: expected type `i32` = note: expected type `i32`
found type `()` found type `()`