StepBy<Range<{int <= usize}>> can be TrustedLen
This commit is contained in:
parent
f70a4b9dd3
commit
8a72f35234
1 changed files with 7 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use crate::convert::TryFrom;
|
||||
use crate::{
|
||||
intrinsics,
|
||||
iter::from_fn,
|
||||
iter::{from_fn, TrustedLen},
|
||||
ops::{Range, Try},
|
||||
};
|
||||
|
||||
|
|
@ -484,6 +484,12 @@ macro_rules! spec_int_ranges {
|
|||
acc
|
||||
}
|
||||
}
|
||||
|
||||
/// Safety: This macro is only applied to ranges over types <= usize
|
||||
/// which means the inner length is guaranteed to fit into a usize and so
|
||||
/// the outer length calculation won't encounter clamped values
|
||||
#[unstable(feature = "trusted_len", issue = "37572")]
|
||||
unsafe impl TrustedLen for StepBy<Range<$t>> {}
|
||||
)*)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue