Do not add leading asterisk in the PartialEq
Adding leading asterisk can cause compilation failure for the _types_ that don't implement the `Copy`.
This commit is contained in:
parent
5a6e995980
commit
c2a0ef65da
5 changed files with 50 additions and 13 deletions
|
@ -31,7 +31,7 @@ pub fn expand_deriving_partial_eq(
|
|||
};
|
||||
|
||||
// We received arguments of type `&T`. Convert them to type `T` by stripping
|
||||
// any leading `&` or adding `*`. This isn't necessary for type checking, but
|
||||
// any leading `&`. This isn't necessary for type checking, but
|
||||
// it results in better error messages if something goes wrong.
|
||||
//
|
||||
// Note: for arguments that look like `&{ x }`, which occur with packed
|
||||
|
@ -53,8 +53,7 @@ pub fn expand_deriving_partial_eq(
|
|||
inner.clone()
|
||||
}
|
||||
} else {
|
||||
// No leading `&`: add a leading `*`.
|
||||
cx.expr_deref(field.span, expr.clone())
|
||||
expr.clone()
|
||||
}
|
||||
};
|
||||
cx.expr_binary(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue