mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Rust: Add type inference test with range full expression
This commit is contained in:
@@ -2332,6 +2332,8 @@ mod loops {
|
||||
for u in [0u8..10] {} // $ type=u:Range type=u:Idx.u8
|
||||
let range = 0..10; // $ type=range:Range type=range:Idx.i32
|
||||
for i in range {} // $ type=i:i32
|
||||
let range_full = ..; // $ MISSING: type=range_full:RangeFull
|
||||
for i in &[1i64, 2i64, 3i64][range_full] {} // $ target=index MISSING: type=i:&T.i64
|
||||
|
||||
let range1 = // $ type=range1:Range type=range1:Idx.u16
|
||||
std::ops::Range {
|
||||
@@ -2558,12 +2560,11 @@ pub mod exec {
|
||||
pub mod path_buf {
|
||||
// a highly simplified model of `PathBuf::canonicalize`
|
||||
|
||||
pub struct Path {
|
||||
}
|
||||
pub struct Path {}
|
||||
|
||||
impl Path {
|
||||
pub const fn new() -> Path {
|
||||
Path { }
|
||||
Path {}
|
||||
}
|
||||
|
||||
pub fn canonicalize(&self) -> Result<PathBuf, ()> {
|
||||
@@ -2571,12 +2572,11 @@ pub mod path_buf {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PathBuf {
|
||||
}
|
||||
pub struct PathBuf {}
|
||||
|
||||
impl PathBuf {
|
||||
pub const fn new() -> PathBuf {
|
||||
PathBuf { }
|
||||
PathBuf {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2587,7 +2587,7 @@ pub mod path_buf {
|
||||
#[inline]
|
||||
fn deref(&self) -> &Path {
|
||||
// (very much not a real implementation)
|
||||
static path : Path = Path::new(); // $ target=new
|
||||
static path: Path = Path::new(); // $ target=new
|
||||
&path
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user