Do not warn when deriving Copy for raw pointers#21362
Do not warn when deriving Copy for raw pointers#21362bors merged 2 commits intorust-lang:masterfrom aochagavia:copy_rawptr
Copy for raw pointers#21362Conversation
|
@cmr Is there a way to test the lack of a warning? |
|
@aochagavia you can use |
|
@cmr Thanks! I have added a test. |
|
r? @huonw (You have the strongest opinions about this lint, I believe) |
|
Any news on this? |
|
Sorry, @aochagavia, lost track of this. I think it's good, just a small implementation nit. |
src/librustc/lint/builtin.rs
Outdated
There was a problem hiding this comment.
Currently this code will mean that any trait called Copy isn't warned about, while the compiler actually has enough info to do it "perfectly", i.e. only avoid warning for the special Copy trait.
let trait_ref = ty::node_id_to_trait_ref(cx.tcx, t_ref.ref_id);
let def_id = ty::trait_ref_to_def_id(cx.tcx, trait_ref.def_id);
if Some(def_id) == cx.tcx.lang_items.copy_trait() {
return
}(I'm not 100% certain that will work, and I haven't compiled it.)
|
If I'm so slow again be feel to pester me. |
|
@huonw Addressed your nit. Thanks for reviewing! |
|
Sorry to comment after closing, but should deriving Debug produce the raw_pointer_derive warning like it currently does? |
…s-v2 internal: Preparations for span compression
Fixes #21272 and #21296
r? @cmr