1
Fork 0

Turn may_have_side_effect into an associated constant

The `may_have_side_effect` is an implementation detail of `TrustedRandomAccess`
trait. It describes if obtaining an iterator element may have side effects. It
is currently implemented as an associated function.

Turn `may_have_side_effect` into an associated constant. This makes the
value immediately available to the optimizer.
This commit is contained in:
Tomasz Miąsko 2021-02-12 00:00:00 +00:00
parent 9503ea19ed
commit dc3304c341
9 changed files with 30 additions and 78 deletions

View file

@ -212,9 +212,7 @@ unsafe impl<T, A: Allocator> TrustedRandomAccess for IntoIter<T, A>
where
T: Copy,
{
fn may_have_side_effect() -> bool {
false
}
const MAY_HAVE_SIDE_EFFECT: bool = false;
}
#[stable(feature = "vec_into_iter_clone", since = "1.8.0")]