about summary refs log tree commit diff
path: root/src/test/ui/polymorphization/predicates.rs
blob: 82a94933b470eba3ef53e7dcd1ffd0198f9cf945 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// build-fail
// compile-flags:-Zpolymorphize=on
#![feature(rustc_attrs)]

// This test checks that `T` is considered used in `foo`, because it is used in a predicate for
// `I`, which is used.

#[rustc_polymorphize_error]
fn bar<I>() {
    //~^ ERROR item has unused generic parameters
}

#[rustc_polymorphize_error]
fn foo<I, T>(_: I)
where
    I: Iterator<Item = T>,
{
    bar::<I>()
}

fn main() {
    let x = &[2u32];
    foo(x.iter());
}