Skip to content

Commit

Permalink
impl TrustedLen is unsafe (#1318)
Browse files Browse the repository at this point in the history
* impl TrustedLen is unsafe

Implementing `TrustedLen` is now unsafe.

From what I understand, quite a few people are still unhappy about the design since the `unsafe` marker in this case is a promise that `size_hint()` in a *different* impl is accurate, so this may change again.

Anyway, we need to do something to fix our builds, and the alternative is just to remove this (I haven't a clue if it is enabling any important optimisations).

* Remove TrustedLen impl for DistIter
  • Loading branch information
dhardy authored Jun 12, 2023
1 parent 51d27a9 commit 0c4c6c0
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/distributions/distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,6 @@ where
{
}

#[cfg(feature = "nightly")]
impl<D, R, T> iter::TrustedLen for DistIter<D, R, T>
where
D: Distribution<T>,
R: Rng,
{
}

/// A distribution of values of type `S` derived from the distribution `D`
/// by mapping its output of type `T` through the closure `F`.
///
Expand Down

0 comments on commit 0c4c6c0

Please sign in to comment.