2 // compile-flags:-Zpolymorphize=on
3 #![feature(rustc_attrs)]
5 // This test checks that `T` is considered used in `foo`, because it is used in a predicate for
8 #[rustc_polymorphize_error]
10 //~^ ERROR item has unused generic parameters
13 #[rustc_polymorphize_error]
16 I: Iterator<Item = T>,
21 #[rustc_polymorphize_error]
24 std::iter::Repeat<I>: Iterator<Item = T>,
29 // In addition, check that `I` is considered used in `next::{{closure}}`, because `T` is used and
30 // `T` is really just `I::Item`. `E` is used due to the fixed-point marking of predicates.
32 pub(crate) struct Foo<'a, I, E>(I, &'a E);
34 impl<'a, I, T: 'a, E> Iterator for Foo<'a, I, E>
36 I: Iterator<Item = &'a (T, E)>,
40 #[rustc_polymorphize_error]
41 fn next(&mut self) -> Option<Self::Item> {
46 // Furthermore, check that `B` is considered used because `C` is used, and that `A` is considered
47 // used because `B` is now used.
51 impl Baz<u16> for u8 {}
52 impl Baz<u32> for u16 {}
54 #[rustc_polymorphize_error]
55 fn quux<A, B, C: Default>() -> usize
60 std::mem::size_of::<C>()
68 let mut a = Foo([(1u32, 1u16)].iter(), &1u16);
71 let _ = quux::<u8, u16, u32>();