Closed
Description
Works on beta, but not on nightly.
This breaks miri.
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() {}
error[E0446]: private type `Range` in public interface
--> src/main.rs:11:41
|
8 | struct Range;
| - `Range` declared as private
...
11 | fn iter_with_range<'a>(&'a self) -> impl Iterator<Item = (&'a Range, &'a u8)> + 'a {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
error: aborting due to previous error