Skip to content

Commit b9a67e3

Browse files
committed
Do not warn when deriving Copy for raw pointers
Fixes #21272 and #21296
1 parent ca4b967 commit b9a67e3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/librustc/lint/builtin.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,15 @@ impl LintPass for RawPointerDerive {
592592
return
593593
}
594594
let did = match item.node {
595-
ast::ItemImpl(..) => {
595+
ast::ItemImpl(_, _, _, ref t_ref_opt, _, _) => {
596+
// Deriving the Copy trait does not cause a warning
597+
if let &Some(ref trait_ref) = t_ref_opt {
598+
let def_id = ty::trait_ref_to_def_id(cx.tcx, trait_ref);
599+
if Some(def_id) == cx.tcx.lang_items.copy_trait() {
600+
return
601+
}
602+
}
603+
596604
match ty::node_id_to_type(cx.tcx, item.id).sty {
597605
ty::ty_enum(did, _) => did,
598606
ty::ty_struct(did, _) => did,

0 commit comments

Comments
 (0)