10
10
11
11
//! The compiler code necessary for `#[derive(Decodable)]`. See encodable.rs for more.
12
12
13
- use deriving;
13
+ use deriving:: { self , pathvec_std } ;
14
14
use deriving:: generic:: * ;
15
15
use deriving:: generic:: ty:: * ;
16
16
use deriving:: warn_if_deprecated;
@@ -46,20 +46,12 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
46
46
item : & Annotatable ,
47
47
push : & mut FnMut ( Annotatable ) ,
48
48
krate : & ' static str ) {
49
- if cx. crate_root != Some ( "std" ) {
50
- // FIXME(#21880): lift this requirement.
51
- cx. span_err ( span,
52
- "this trait cannot be derived with #![no_std] \
53
- or #![no_core]") ;
54
- return ;
55
- }
56
-
57
49
let typaram = & * deriving:: hygienic_type_parameter ( item, "__D" ) ;
58
50
59
51
let trait_def = TraitDef {
60
52
span,
61
53
attributes : Vec :: new ( ) ,
62
- path : Path :: new_ ( vec ! [ krate, "Decodable" ] , None , vec ! [ ] , true ) ,
54
+ path : Path :: new_ ( vec ! [ krate, "Decodable" ] , None , vec ! [ ] , PathKind :: Global ) ,
63
55
additional_bounds : Vec :: new ( ) ,
64
56
generics : LifetimeBounds :: empty ( ) ,
65
57
is_unsafe : false ,
@@ -72,18 +64,18 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
72
64
vec![ Path :: new_( vec![ krate, "Decoder" ] ,
73
65
None ,
74
66
vec![ ] ,
75
- true ) ] ) ] ,
67
+ PathKind :: Global ) ] ) ] ,
76
68
} ,
77
69
explicit_self: None ,
78
70
args: vec![ Ptr ( Box :: new( Literal ( Path :: new_local( typaram) ) ) ,
79
71
Borrowed ( None , Mutability :: Mutable ) ) ] ,
80
72
ret_ty:
81
- Literal ( Path :: new_( pathvec_std!( cx, core :: result:: Result ) ,
73
+ Literal ( Path :: new_( pathvec_std!( cx, result:: Result ) ,
82
74
None ,
83
75
vec![ Box :: new( Self_ ) , Box :: new( Literal ( Path :: new_(
84
- vec![ typaram, "Error" ] , None , vec![ ] , false
76
+ vec![ typaram, "Error" ] , None , vec![ ] , PathKind :: Local
85
77
) ) ) ] ,
86
- true ) ) ,
78
+ PathKind :: Std ) ) ,
87
79
attributes: Vec :: new( ) ,
88
80
is_unsafe: false ,
89
81
unify_fieldless_variants: false ,
0 commit comments