Skip to main content

rustc_builtin_macros/deriving/
copy.rs

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