You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Someone came into the channel today confused at how to index into a vector. Their problem was that the variable that they wanted to use as an index was an i8. Casting actually crossed their mind, but they gave up after trying v[foo as i32] and v[foo as isize]. The page at http://doc.rust-lang.org/stable/book/vectors.html could stand to have a sentence mentioning how to index with a variable (currently it just indexes with constants, which all properly get inferred to usize without the reader realizing).
The text was updated successfully, but these errors were encountered:
Someone came into the channel today confused at how to index into a vector. Their problem was that the variable that they wanted to use as an index was an
i8
. Casting actually crossed their mind, but they gave up after tryingv[foo as i32]
andv[foo as isize]
. The page at http://doc.rust-lang.org/stable/book/vectors.html could stand to have a sentence mentioning how to index with a variable (currently it just indexes with constants, which all properly get inferred to usize without the reader realizing).The text was updated successfully, but these errors were encountered: