Skip to content

syntax: deprecate #[auto_{en,de}code] in favour of #[deriving({En,De}codable)]. #6502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/librustc/middle/freevars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use syntax::{ast, ast_util, visit};

// A vector of defs representing the free variables referred to in a function.
// (The def_upvar will already have been stripped).
#[auto_encode]
#[auto_decode]
#[deriving(Encodable, Decodable)]
pub struct freevar_entry {
def: ast::def, //< The variable being accessed free.
span: span //< First span where it is accessed (there can be multiple)
Expand Down
6 changes: 2 additions & 4 deletions src/librustc/middle/moves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,14 @@ use syntax::visit::vt;
use syntax::print::pprust;
use syntax::codemap::span;

#[auto_encode]
#[auto_decode]
#[deriving(Encodable, Decodable)]
pub enum CaptureMode {
CapCopy, // Copy the value into the closure.
CapMove, // Move the value into the closure.
CapRef, // Reference directly from parent stack frame (used by `&fn()`).
}

#[auto_encode]
#[auto_decode]
#[deriving(Encodable, Decodable)]
pub struct CaptureVar {
def: def, // Variable being accessed free
span: span, // Location of an access to this variable
Expand Down
44 changes: 12 additions & 32 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,15 @@ pub struct mt {
mutbl: ast::mutability,
}

#[auto_encode]
#[auto_decode]
#[deriving(Eq)]
#[deriving(Eq, Encodable, Decodable)]
pub enum vstore {
vstore_fixed(uint),
vstore_uniq,
vstore_box,
vstore_slice(Region)
}

#[auto_encode]
#[auto_decode]
#[deriving(Eq, IterBytes)]
#[deriving(Eq, IterBytes, Encodable, Decodable)]
pub enum TraitStore {
BoxTraitStore, // @Trait
UniqTraitStore, // ~Trait
Expand All @@ -117,9 +113,7 @@ pub enum TraitStore {

// XXX: This should probably go away at some point. Maybe after destructors
// do?
#[auto_encode]
#[auto_decode]
#[deriving(Eq)]
#[deriving(Eq, Encodable, Decodable)]
pub enum SelfMode {
ByCopy,
ByRef,
Expand Down Expand Up @@ -197,27 +191,22 @@ pub enum ast_ty_to_ty_cache_entry {

pub type opt_region_variance = Option<region_variance>;

#[auto_encode]
#[auto_decode]
#[deriving(Eq)]
#[deriving(Eq, Decodable, Encodable)]
pub enum region_variance { rv_covariant, rv_invariant, rv_contravariant }

#[auto_encode]
#[auto_decode]
#[deriving(Decodable, Encodable)]
pub enum AutoAdjustment {
AutoAddEnv(ty::Region, ast::Sigil),
AutoDerefRef(AutoDerefRef)
}

#[auto_encode]
#[auto_decode]
#[deriving(Decodable, Encodable)]
pub struct AutoDerefRef {
autoderefs: uint,
autoref: Option<AutoRef>
}

#[auto_encode]
#[auto_decode]
#[deriving(Decodable, Encodable)]
pub enum AutoRef {
/// Convert from T to &T
AutoPtr(Region, ast::mutability),
Expand Down Expand Up @@ -453,9 +442,7 @@ pub struct param_ty {
}

/// Representation of regions:
#[auto_encode]
#[auto_decode]
#[deriving(Eq, IterBytes)]
#[deriving(Eq, IterBytes, Encodable, Decodable)]
pub enum Region {
/// Bound regions are found (primarily) in function types. They indicate
/// region parameters that have yet to be replaced with actual regions
Expand Down Expand Up @@ -501,17 +488,13 @@ pub impl Region {
}
}

#[auto_encode]
#[auto_decode]
#[deriving(Eq, IterBytes)]
#[deriving(Eq, IterBytes, Encodable, Decodable)]
pub struct FreeRegion {
scope_id: node_id,
bound_region: bound_region
}

#[auto_encode]
#[auto_decode]
#[deriving(Eq, IterBytes)]
#[deriving(Eq, IterBytes, Encodable, Decodable)]
pub enum bound_region {
/// The self region for structs, impls (&T in a type defn or &'self T)
br_self,
Expand Down Expand Up @@ -742,9 +725,7 @@ pub struct IntVid(uint);
#[deriving(Eq)]
pub struct FloatVid(uint);

#[deriving(Eq)]
#[auto_encode]
#[auto_decode]
#[deriving(Eq, Encodable, Decodable)]
pub struct RegionVid {
id: uint
}
Expand Down Expand Up @@ -777,8 +758,7 @@ impl to_bytes::IterBytes for InferTy {
}
}

#[auto_encode]
#[auto_decode]
#[deriving(Encodable, Decodable)]
pub enum InferRegion {
ReVar(RegionVid),
ReSkolemized(uint, bound_region)
Expand Down
6 changes: 2 additions & 4 deletions src/librustc/middle/typeck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ pub mod infer;
pub mod collect;
pub mod coherence;

#[auto_encode]
#[auto_decode]
#[deriving(Encodable, Decodable)]
pub enum method_origin {
// supertrait method invoked on "self" inside a default method
// first field is supertrait ID;
Expand All @@ -98,8 +97,7 @@ pub enum method_origin {

// details for a method invoked with a receiver whose type is a type parameter
// with a bounded trait.
#[auto_encode]
#[auto_decode]
#[deriving(Encodable, Decodable)]
pub struct method_param {
// the trait containing the method to be invoked
trait_id: ast::def_id,
Expand Down
12 changes: 3 additions & 9 deletions src/libstd/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1331,26 +1331,20 @@ mod tests {

use std::serialize::Decodable;

#[auto_encode]
#[auto_decode]
#[deriving(Eq)]
#[deriving(Eq, Encodable, Decodable)]
enum Animal {
Dog,
Frog(~str, int)
}

#[auto_encode]
#[auto_decode]
#[deriving(Eq)]
#[deriving(Eq, Encodable, Decodable)]
struct Inner {
a: (),
b: uint,
c: ~[~str],
}

#[auto_encode]
#[auto_decode]
#[deriving(Eq)]
#[deriving(Eq, Encodable, Decodable)]
struct Outer {
inner: ~[Inner],
}
Expand Down
8 changes: 2 additions & 6 deletions src/libstd/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ pub mod rustrt {
}

/// A record specifying a time value in seconds and nanoseconds.
#[auto_encode]
#[auto_decode]
#[deriving(Eq)]
#[deriving(Eq, Encodable, Decodable)]
pub struct Timespec { sec: i64, nsec: i32 }

/*
Expand Down Expand Up @@ -100,9 +98,7 @@ pub fn tzset() {
}
}

#[auto_encode]
#[auto_decode]
#[deriving(Eq)]
#[deriving(Eq, Encodable, Decodable)]
pub struct Tm {
tm_sec: i32, // seconds after the minute ~[0-60]
tm_min: i32, // minutes after the hour ~[0-59]
Expand Down
4 changes: 1 addition & 3 deletions src/libstd/workcache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ use core::util::replace;
*
*/

#[deriving(Eq)]
#[auto_encode]
#[auto_decode]
#[deriving(Eq, Encodable, Decodable)]
struct WorkKey {
kind: ~str,
name: ~str
Expand Down
4 changes: 1 addition & 3 deletions src/libsyntax/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ enum AbiArchitecture {
Archs(u32) // Multiple architectures (bitset)
}

#[auto_encode]
#[auto_decode]
#[deriving(Eq)]
#[deriving(Eq, Encodable, Decodable)]
pub struct AbiSet {
priv bits: u32 // each bit represents one of the abis below
}
Expand Down
Loading