Skip to content

Multiple Higher-Rank Trait Bounds bug #57750

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
hikitrbogithub opened this issue Jan 19, 2019 · 1 comment
Closed

Multiple Higher-Rank Trait Bounds bug #57750

hikitrbogithub opened this issue Jan 19, 2019 · 1 comment

Comments

@hikitrbogithub
Copy link

use std::fmt::Debug;

//consume x
fn consume_print_return<T>(x: T) -> T
where
// how do I express that these ---*
//                                |
//  *-----------------------------*
//  |
//  *------------------v
/*  | */     for<'a> &'a T: IntoIterator,
//  *-------------------v
/*  | */     for<'a> <&'a T as IntoIterator>::Item: Debug,
//  |
{/* | */
//  *--- lifetimes are equal to the lifetime of this borrow?
//  |
//  *-----------v
    for item in &x {
        println!("{:?}", item);
    }

    //return x
    x
}

fn main() {
    consume_print_return(vec![1, 2]);
}

Gives the following error
error[E0277]: <&'a _ as std::iter::IntoIterator>::Item doesn't implement std::fmt::Debug

@sfackler
Copy link
Member

Duplicate of #56556

@sfackler sfackler marked this as a duplicate of #56556 Jan 19, 2019
@hikitrbogithub hikitrbogithub changed the title Multiple Higher Kinded Trait Bounds bug Multiple Higher-Rank Trait Bounds bug Jan 19, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants