Merge pull request #2147 from clippered/fix-manual-memcpy-on-overlapping-slices
Fix #2123 : check that the source and destination are different for m…
This commit is contained in:
commit
327d995bb6
2 changed files with 16 additions and 1 deletions
|
|
@ -749,7 +749,14 @@ fn get_indexed_assignments<'a, 'tcx>(
|
|||
) -> Option<(FixedOffsetVar, FixedOffsetVar)> {
|
||||
if let Expr_::ExprAssign(ref lhs, ref rhs) = e.node {
|
||||
match (get_fixed_offset_var(cx, lhs, var), fetch_cloned_fixed_offset_var(cx, rhs, var)) {
|
||||
(Some(offset_left), Some(offset_right)) => Some((offset_left, offset_right)),
|
||||
(Some(offset_left), Some(offset_right)) => {
|
||||
// Source and destination must be different
|
||||
if offset_left.var_name != offset_right.var_name {
|
||||
Some((offset_left, offset_right))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
_ => None,
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue