]>
git.proxmox.com Git - rustc.git/blob - src/libsyntax_ext/deriving/bounds.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 use deriving
::generic
::*;
12 use deriving
::generic
::ty
::*;
14 use syntax
::ast
::MetaItem
;
15 use syntax
::ext
::base
::{Annotatable, ExtCtxt}
;
18 pub fn expand_deriving_unsafe_bound(cx
: &mut ExtCtxt
,
22 _
: &mut FnMut(Annotatable
)) {
23 cx
.span_err(span
, "this unsafe trait should be implemented explicitly");
26 pub fn expand_deriving_copy(cx
: &mut ExtCtxt
,
30 push
: &mut FnMut(Annotatable
)) {
31 let mut v
= cx
.crate_root
.map(|s
| vec
![s
]).unwrap_or(Vec
::new());
34 let path
= Path
::new(v
);
36 let trait_def
= TraitDef
{
38 attributes
: Vec
::new(),
40 additional_bounds
: Vec
::new(),
41 generics
: LifetimeBounds
::empty(),
44 associated_types
: Vec
::new(),
47 trait_def
.expand(cx
, mitem
, item
, push
);