Do not ignore lifetime bounds in Copy impls#47877
Conversation
There was a problem hiding this comment.
Let's add a comment here:
In order to have a Copy operand, the type T of the value must be Copy. Note that we prove that T: Copy, rather than using the type_moves_by_default test. This is important because type_moves_by_default ignores the resulting region obligations and assumes they pass. This can result in bounds from Copy impls being unsoundly ignored (e.g., #29149). Note that we decide to use Copy before knowing whether the bounds fully apply: in effect, the rule is that if a value of some type could implement Copy, then it must.
There was a problem hiding this comment.
Can you add a comment that mentions #29149 ? You could basically copy and paste the comment I described above.
59d11b0 to
dbe7bda
Compare
|
@nikomatsakis Comments added! |
|
@bors r+ |
|
📌 Commit dbe7bda has been approved by |
dbe7bda to
b9f7564
Compare
|
@bors r+ |
|
📌 Commit b9f7564 has been approved by |
… r=nikomatsakis Do not ignore lifetime bounds in Copy impls cc rust-lang#29149 r? @nikomatsakis
… r=nikomatsakis Do not ignore lifetime bounds in Copy impls cc rust-lang#29149 r? @nikomatsakis
… r=nikomatsakis Do not ignore lifetime bounds in Copy impls cc rust-lang#29149 r? @nikomatsakis
cc #29149
r? @nikomatsakis