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
An Iterator<const std::string&> can not be collected into a Vecstd::string, because it requires FromIterator<std::string> to be true for Iterator<const std::string&> which it's not. The from_iter() impl needs to accept an IntoIterator<std::string> which is not matching Iterator<const std::string&>'s implementation which returns itself.
The issue is that IntoIterator (and thus collect) requires the into_iter() function's returned Iterator::Item type to be exactly the same as the type specified in IntoIterator. But I believe it would be better here to match an Iterator::Item type if its convertible-to the type in IntoIterator.
Some options:
Maybe collect needs to use a more lenient version of IntoIterator, and perform a map itself when the types don't match.
Maybe Iterator can match a concrete type if its Item is convertible-to T since next() returning a T will be valid in code that wants something T converts to as well.
Would the latter then automatically make IntoIterator more lenient? I think so, but didn't look carefully yet.
An
Iterator<const std::string&>
can not be collected into a Vecstd::string, because it requiresFromIterator<std::string>
to be true forIterator<const std::string&>
which it's not. Thefrom_iter()
impl needs to accept anIntoIterator<std::string>
which is not matchingIterator<const std::string&>
's implementation which returns itself.An example in subdoc:
run_options.macro_prefixes = sus::iter::from_range(option_include_macro_prefixes) .cloned() .collect<sus::Vec<std::string>>();
This should really work without
cloned()
ideally, since it's a copy constructible type.The text was updated successfully, but these errors were encountered: