diff options
Diffstat (limited to 'tests/ui/impl-trait/issues/issue-52128.rs')
-rw-r--r-- | tests/ui/impl-trait/issues/issue-52128.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/issues/issue-52128.rs b/tests/ui/impl-trait/issues/issue-52128.rs new file mode 100644 index 000000000..5afd380dd --- /dev/null +++ b/tests/ui/impl-trait/issues/issue-52128.rs @@ -0,0 +1,25 @@ +// check-pass + +#![deny(warnings)] + +use std::collections::BTreeMap; + +pub struct RangeMap { + map: BTreeMap<Range, u8>, +} + +#[derive(Eq, PartialEq, Ord, PartialOrd)] +struct Range; + +impl RangeMap { + fn iter_with_range<'a>(&'a self) -> impl Iterator<Item = (&'a Range, &'a u8)> + 'a { + self.map.range(Range..Range) + } + + pub fn iter<'a>(&'a self) -> impl Iterator<Item = &'a u8> + 'a { + self.iter_with_range().map(|(_, data)| data) + } + +} + +fn main() {} |