Skip to content

Mismatched types not throwing error? #404

Answered by winterqt
winterqt asked this question in Q&A
Discussion options

You must be logged in to vote

Figured it out: this seems to be a limitation Vec's implementation of Get::get:

impl<'a, T: Arg + Get<'a>> Get<'a> for Vec<T> {
    fn get(i: &mut Iter<'a>) -> Option<Self> {
        <Array<T, Iter<'a>>>::get(i).map(|a| a.collect())
    }
}

As far as I can tell, as long as the return type is an array, this will return Some, leading to no error being thrown by Iter::read.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by diwic
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants