/ SeriousOJ /

Record Detail

Compile Error

error[E0277]: a value of type `String` cannot be built from an iterator over elements of type `&u8`
  --> foo.rs:30:44
   |
30 |                     l = s.iter().collect::<String>().parse::<u64>().unwrap()
   |                                  -------   ^^^^^^ value of type `String` cannot be built from `std::iter::Iterator<Item=&u8>`
   |                                  |
   |                                  required by a bound introduced by this call
   |
   = help: the trait `FromIterator<&u8>` is not implemented for `String`
   = help: the following other types implement trait `FromIterator<A>`:
             <String as FromIterator<char>>
             <String as FromIterator<Box<str>>>
             <String as FromIterator<Cow<'a, str>>>
             <String as FromIterator<String>>
             <String as FromIterator<&'a char>>
             <String as FromIterator<&'a str>>
note: required by a bound in `collect`
  --> /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/iter/traits/iterator.rs:2050:5

error[E0277]: a value of type `String` cannot be built from an iterator over elements of type `&u8`
  --> foo.rs:34:44
   |
34 |                     l = s.iter().collect::<String>().parse::<u64>().unwrap();
   |                                  -------   ^^^^^^ value of type `String` cannot be built from `std::iter::Iterator<Item=&u8>`
   |                                  |
   |                                  required by a bound introduced by this call
   |
   = help: the trait `FromIterator<&u8>` is not implemented for `String`
   = help: the following other types implement trait `FromIterator<A>`:
             <String as FromIterator<char>>
             <String as FromIterator<Box<str>>>
             <String as FromIterator<Cow<'a, str>>>
             <String as FromIterator<String>>
             <String as FromIterator<&'a char>>
             <String as FromIterator<&'a str>>
note: required by a bound in `collect`
  --> /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/iter/traits/iterator.rs:2050:5

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.

Information

Submit By
Type
Submission
Language
Rust 2021 (Rust 1.75.0)
Submit At
2025-07-17 13:04:07
Judged At
2025-07-17 13:04:07
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes