You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While writing the clarification PR #828, I realized there may be other ways to further narrow the Drop-Check rule in a sound manner. For example, if D has multiple type parameters where some are bounded and some are unbounded, it could be that the fact that the bounded type parameters could never actually gain access to the data of lifetime 'a.
In the above example, I think one can argue that even though Two has a type parameter B with code that is effectively hidden from dropck, there is no way the impl Bound for String could access the &'a u8 that the A holds, and therefore we do not need to force 'a to strictly outlive t when dropck is analyzing fn foo.
This may actually matter in real code; I am imagining in particular the example of CheckedHashMap<K,V>, where a Eq+Hash bound on K need not restrict the choices that we select for V.
The text was updated successfully, but these errors were encountered:
While writing the clarification PR #828, I realized there may be other ways to further narrow the Drop-Check rule in a sound manner. For example, if
D
has multiple type parameters where some are bounded and some are unbounded, it could be that the fact that the bounded type parameters could never actually gain access to the data of lifetime'a
.More concretely:
In the above example, I think one can argue that even though
Two
has a type parameterB
with code that is effectively hidden from dropck, there is no way theimpl Bound for String
could access the&'a u8
that theA
holds, and therefore we do not need to force'a
to strictly outlivet
when dropck is analyzingfn foo
.This may actually matter in real code; I am imagining in particular the example of
CheckedHashMap<K,V>
, where aEq+Hash
bound onK
need not restrict the choices that we select forV
.The text was updated successfully, but these errors were encountered: