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
Here is an example of code that triggers the problem. We have a SliceDeque<&usize> and drop its IntoIter, which ends up with _x: &'dangling usize inside of that Drop impl.
use slice_deque::SliceDeque;fnmain(){let _iter;let x = Box::new(0usize);letmut deque = SliceDeque::new();
deque.push_back(&*x);
_iter = deque.into_iter();// x is dropped// then _iter is dropped}
The text was updated successfully, but these errors were encountered:
Inside this
Drop
impl:slice_deque/src/lib.rs
Lines 2454 to 2458 in 045fb28
those
_x
are of typeT
, based on:slice_deque/src/lib.rs
Lines 2363 to 2364 in 045fb28
However
T
is may_dangle, so it's UB to touch/pass/return an object of that type by value. Check out rust-lang/unsafe-code-guidelines#283.Here is an example of code that triggers the problem. We have a
SliceDeque<&usize>
and drop its IntoIter, which ends up with_x: &'dangling usize
inside of that Drop impl.The text was updated successfully, but these errors were encountered: