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
{{ message }}
Repository navigation
NonNull's as_ref / as_mut don't have arbitrary lifetimes as stated #80183
You must enforce Rust's aliasing rules, since the returned lifetime 'a is arbitrarily chosen and does not necessarily reflect the actual lifetime of the data. [...]
Which makes sense, the pointer doesn't carry a lifetime with it, so we need to decide on it. However, the implementation actually looks like this (with implicit lifetimes shown for clarity):
pubunsafefnas_ref<'a>(&'aself) -> &'aT{// ...}
This makes it so the reference constructed has the same lifetime as the pointer variable, which is likely not what is intended.
The same occurs for all of these methods currently:
Activity
Rollup merge of rust-lang#80771 - thomcc:nonnull-refmut, r=dtolnay
Rollup merge of rust-lang#80771 - thomcc:nonnull-refmut, r=dtolnay