Rust: Add type inference test with range full expression

This commit is contained in:
Simon Friis Vindum
2025-08-27 13:52:36 +02:00
parent 2f4e2d6d79
commit 4c10f07d5f
2 changed files with 619 additions and 612 deletions

View File

@@ -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
}
}