Skip to content

Commit 4c10f07

Browse files
committed
Rust: Add type inference test with range full expression
1 parent 2f4e2d6 commit 4c10f07

File tree

2 files changed

+619
-612
lines changed

2 files changed

+619
-612
lines changed

rust/ql/test/library-tests/type-inference/main.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2332,6 +2332,8 @@ mod loops {
23322332
for u in [0u8..10] {} // $ type=u:Range type=u:Idx.u8
23332333
let range = 0..10; // $ type=range:Range type=range:Idx.i32
23342334
for i in range {} // $ type=i:i32
2335+
let range_full = ..; // $ MISSING: type=range_full:RangeFull
2336+
for i in &[1i64, 2i64, 3i64][range_full] {} // $ target=index MISSING: type=i:&T.i64
23352337

23362338
let range1 = // $ type=range1:Range type=range1:Idx.u16
23372339
std::ops::Range {
@@ -2558,25 +2560,23 @@ pub mod exec {
25582560
pub mod path_buf {
25592561
// a highly simplified model of `PathBuf::canonicalize`
25602562

2561-
pub struct Path {
2562-
}
2563+
pub struct Path {}
25632564

25642565
impl Path {
25652566
pub const fn new() -> Path {
2566-
Path { }
2567+
Path {}
25672568
}
25682569

25692570
pub fn canonicalize(&self) -> Result<PathBuf, ()> {
25702571
Ok(PathBuf::new()) // $ target=new
25712572
}
25722573
}
25732574

2574-
pub struct PathBuf {
2575-
}
2575+
pub struct PathBuf {}
25762576

25772577
impl PathBuf {
25782578
pub const fn new() -> PathBuf {
2579-
PathBuf { }
2579+
PathBuf {}
25802580
}
25812581
}
25822582

@@ -2587,7 +2587,7 @@ pub mod path_buf {
25872587
#[inline]
25882588
fn deref(&self) -> &Path {
25892589
// (very much not a real implementation)
2590-
static path : Path = Path::new(); // $ target=new
2590+
static path: Path = Path::new(); // $ target=new
25912591
&path
25922592
}
25932593
}

0 commit comments

Comments
 (0)