Rollup merge of #53360 - PramodBisht:issue/51602, r=estebank
Addressed #51602 Fixed #51602 r? @estebank here I have addressed the case where `in` was not expected right after `if` block. Speaking of `type ascription` I am not sure if this the best approach which I have implemented. Plus I think one more test case can be added to test `type-ascription` case, though I don't have any at this point of time. I will ping you again if all existing testcases pass.
This commit is contained in:
commit
1cda84bfdb
3 changed files with 32 additions and 1 deletions
15
src/test/ui/issue-51602.rs
Normal file
15
src/test/ui/issue-51602.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main(){
|
||||
if i in 1..10 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
10
src/test/ui/issue-51602.stderr
Normal file
10
src/test/ui/issue-51602.stderr
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
error: expected `{`, found `in`
|
||||
--> $DIR/issue-51602.rs:12:10
|
||||
|
|
||||
LL | if i in 1..10 {
|
||||
| -- ^^ expected `{`
|
||||
| |
|
||||
| this `if` statement has a condition, but no block
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue