Skip to content

Should I fill a bug report? #14799

Answered by akimakinai
thmxv asked this question in Q&A
Aug 17, 2024 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

The problem reproduces with the following code.

pub struct Local<'s, T>(&'s T);

impl<'s, 'a, T> IntoIterator for &'a Local<'s, T> where &'a T: IntoIterator {
    type Item = <&'a T as IntoIterator>::Item;
    type IntoIter = <&'a T as IntoIterator>::IntoIter;
    fn into_iter(self) -> Self::IntoIter {
        todo!()
    }
}

fn test<T>(_items: &[T])
where
    for<'a> &'a T: IntoIterator<Item = &'a isize>,
{
}

pub fn system() {
    let items = vec![[1,2]];
    test(&items);
}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=cac861a1305e1f5520ea1fadb3fd013c

This code compiles fine with -Znext-solver, so it may be a limitation of the current trait solver.

https://ru…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@thmxv
Comment options

@akimakinai
Comment options

Answer selected by thmxv
@thmxv
Comment options

@akimakinai
Comment options

@thmxv
Comment options

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
3 participants