Tweak span for ok-wrapping in no-tail block
This commit is contained in:
parent
c88efe46b8
commit
311ff5b441
3 changed files with 6 additions and 9 deletions
|
@ -3017,9 +3017,10 @@ impl<'a> LoweringContext<'a> {
|
|||
let tail = block.expr.take().map_or_else(
|
||||
|| {
|
||||
let LoweredNodeId { node_id, hir_id } = this.next_id();
|
||||
let span = this.sess.codemap().end_point(unstable_span);
|
||||
hir::Expr {
|
||||
id: node_id,
|
||||
span: unstable_span,
|
||||
span,
|
||||
node: hir::ExprTup(hir_vec![]),
|
||||
attrs: ThinVec::new(),
|
||||
hir_id,
|
||||
|
|
|
@ -20,7 +20,7 @@ fn main() {
|
|||
};
|
||||
|
||||
let _: Option<i32> = do catch {
|
||||
//~^ ERROR type mismatch
|
||||
foo()?;
|
||||
};
|
||||
//~^ ERROR type mismatch
|
||||
}
|
||||
|
|
|
@ -8,14 +8,10 @@ LL | 42
|
|||
found type `{integer}`
|
||||
|
||||
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 | | //~^ ERROR type mismatch
|
||||
LL | | foo()?;
|
||||
LL | | };
|
||||
| |_____^ expected i32, found ()
|
||||
LL | };
|
||||
| ^ expected i32, found ()
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found type `()`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue