rustc_builtin_macros/deriving/
copy.rs1use rustc_ast::Safety;
2use rustc_expand::base::ExtCtxt;
3use rustc_span::Span;
4
5use crate::deriving::generic::*;
6use crate::deriving::path_std;
7
8pub(crate) fn expand_deriving_copy(
9 cx: &ExtCtxt<'_>,
10 span: Span,
11 item: &ast::Item,
12 push: &mut dyn FnMut(Box<ast::Item>),
13 is_const: bool,
14) {
15 let trait_def = TraitDef {
16 span,
17 path: generic::ty::new_path(cx, span, { &[sym::marker, sym::Copy] }, &[])path_std!(cx, span, marker::Copy),
18 skip_path_as_bound: false,
19 needs_copy_as_bound_if_packed: false,
20 additional_bounds: SmallVec::new(),
21 supports_unions: true,
22 methods: SmallVec::new(),
23 associated_types: SmallVec::new(),
24 is_const,
25 safety: Safety::Default,
26 document: true,
27 };
28
29 trait_def.expand(cx, item, push);
30}