Hi, I try the below example from std lib for into_iterator. I get the following error. How and where do I need to declare the item here is i128 but not i32
#![allow(unused)]
fn main() {
fn collect_as_strings<T>(collection: T) -> Vec<String>
where
T: IntoIterator,
T::Item: std::fmt::Debug,
{
collection
.into_iter()
.map(|item| format!("{item:?}"))
.collect()
}
dbg!(collect_as_strings([12345434553435533553345,12345434553435533553345]));
}
Errors:
Compiling playground v0.0.1 (/playground)
error: literal out of range for `i32`
--> src/main.rs:14:26
|
14 | dbg!(collect_as_strings([12345434553435533553345,12345434553435533553345]));
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the literal `12345434553435533553345` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
= help: consider using the type `i128` instead
= note: `#[deny(overflowing_literals)]` on by default
error: literal out of range for `i32`
--> src/main.rs:14:50
|
14 | dbg!(collect_as_strings([12345434553435533553345,12345434553435533553345]));
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the literal `12345434553435533553345` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
= help: consider using the type `i128` instead
error: could not compile `playground` due to 2 previous errors