]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/trait-objects.rs
Rollup merge of #102954 - GuillaumeGomez:cfg-hide-attr-checks, r=Manishearth
[rust.git] / src / test / ui / generic-associated-types / trait-objects.rs
1 // revisions: base extended
2
3 #![cfg_attr(extended, feature(generic_associated_types_extended))]
4 #![cfg_attr(extended, allow(incomplete_features))]
5
6 trait StreamingIterator {
7     type Item<'a> where Self: 'a;
8     fn size_hint(&self) -> (usize, Option<usize>);
9     // Uncommenting makes `StreamingIterator` not object safe
10 //    fn next(&mut self) -> Self::Item<'_>;
11 }
12
13 fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize {
14     //[base]~^ the trait `StreamingIterator` cannot be made into an object
15     x.size_hint().0
16     //[extended]~^ borrowed data escapes
17 }
18
19 fn main() {}