summary refs log tree commit diff
path: root/src/libserialize/serialize.rs
AgeCommit message (Collapse)AuthorLines
2018-03-02Fix Decodable impl for ArcJohn Kåre Alsaker-1/+1
2017-12-20Implement Encodable and Decodable for Result.Michael Woerister-0/+48
2017-07-23Fix some doc/comment typos.Bruce Mitchener-2/+2
2017-02-10Only SwitchInt over integers, not all constsSimonas Kazlauskas-0/+28
Also use a Cow to avoid full Vec for all SwitchInts
2017-02-03Bump version, upgrade bootstrapAlex Crichton-5/+0
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-0/+33
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-10-10Avoid allocations in `Decoder::read_str`.Nicholas Nethercote-2/+3
`opaque::Decoder::read_str` is very hot within `rustc` due to its use in the reading of crate metadata, and it currently returns a `String`. This commit changes it to instead return a `Cow<str>`, which avoids a heap allocation. This change reduces the number of calls to `malloc` by almost 10% in some benchmarks. This is a [breaking-change] to libserialize.
2016-09-20serialize: allow specifying the default behavior for specializations.Eduard Burtescu-17/+19
2016-09-20Remove librbml and the RBML-tagged auto-encoder/decoder.Eduard Burtescu-63/+131
2016-09-20rustc_metadata: go only through rustc_serialize in astencode.Eduard Burtescu-44/+0
2016-09-20serialize: extend with specialization-based encoding/decoding multi-dispatch.Eduard Burtescu-0/+95
2016-09-11Use question_mark feature in libserialize.Ahmed Charles-4/+4
2016-08-25Rename {uint,int} methods to {usize,isize}.Corey Farwell-8/+8
2016-03-22try! -> ?Jorge Aparicio-14/+14
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2015-09-08some more clippy-based improvementsAndre Bogus-1/+1
2015-08-12Fallout in libs -- misc missing bounds uncovered by WF checks.Niko Matsakis-1/+1
2015-04-14std: Remove old_io/old_path/rand modulesAlex Crichton-32/+0
This commit entirely removes the old I/O, path, and rand modules. All functionality has been deprecated and unstable for quite some time now!
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-43/+43
Now that support has been removed, all lingering use cases are renamed.
2015-03-23Add generic conversion traitsAaron Turon-1/+1
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
2015-03-20std: Remove old_io/old_path from the preludeAlex Crichton-1/+1
This commit removes the reexports of `old_io` traits as well as `old_path` types and traits from the prelude. This functionality is now all deprecated and needs to be removed to make way for other functionality like `Seek` in the `std::io` module (currently reexported as `NewSeek` in the io prelude). Closes #23377 Closes #23378
2015-03-12Stabilize std::pathAaron Turon-0/+5
This commit stabilizes essentially all of the new `std::path` API. The API itself is changed in a couple of ways (which brings it in closer alignment with the RFC): * `.` components are now normalized away, unless they appear at the start of a path. This in turn effects the semantics of e.g. asking for the file name of `foo/` or `foo/.`, both of which yield `Some("foo")` now. This semantics is what the original RFC specified, and is also desirable given early experience rolling out the new API. * The `parent` function now succeeds if, and only if, the path has at least one non-root/prefix component. This change affects `pop` as well. * The `Prefix` component now involves a separate `PrefixComponent` struct, to better allow for keeping both parsed and unparsed prefix data. In addition, the `old_path` module is now deprecated. Closes #23264 [breaking-change]
2015-03-04std: Deprecate std::old_io::fsAlex Crichton-0/+14
This commit deprecates the majority of std::old_io::fs in favor of std::fs and its new functionality. Some functions remain non-deprecated but are now behind a feature gate called `old_fs`. These functions will be deprecated once suitable replacements have been implemented. The compiler has been migrated to new `std::fs` and `std::path` APIs where appropriate as part of this change.
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-1/+1
2015-02-03Rename std::path to std::old_pathAaron Turon-9/+9
As part of [RFC 474](https://github.com/rust-lang/rfcs/pull/474), this commit renames `std::path` to `std::old_path`, leaving the existing path API in place to ease migration to the new one. Updating should be as simple as adjusting imports, and the prelude still maps to the old path APIs for now. [breaking-change]
2015-02-02More deprecating of i/u suffixesAlfie John-1/+1
2015-01-29`for x in range(a, b)` -> `for x in a..b`Jorge Aparicio-2/+2
sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs
2015-01-19lower FnMut to FnOnce since json-hack is no longer requiredOliver 'ker' Schneider-1/+1
Conflicts: src/libserialize/serialize.rs
2015-01-07use slicing sugarJorge Aparicio-1/+1
2015-01-06Test fixes and rebase conflictsAlex Crichton-2/+2
2015-01-06rollup merge of #20563: cmr/macro-input-future-proofingAlex Crichton-1/+1
2015-01-06serialize macro fixCorey Richardson-1/+1
2015-01-06rollup merge of #20656: japaric/at-cleanAlex Crichton-4/+4
2015-01-07Replace full slice notation with index callsNick Cameron-1/+1
2015-01-06cleanup: use short AT notation (`Ty::Item` instead of `<Ty as Trait>::Item`)Jorge Aparicio-4/+4
2015-01-05Merge remote-tracking branch 'nrc/sized-2' into rollupAlex Crichton-2/+2
Conflicts: src/liballoc/boxed.rs src/libcollections/btree/map.rs src/libcollections/slice.rs src/libcore/borrow.rs src/libcore/cmp.rs src/libcore/ops.rs src/libstd/c_str.rs src/libstd/collections/hash/map.rs src/libsyntax/parse/obsolete.rs src/test/compile-fail/unboxed-closure-sugar-default.rs src/test/compile-fail/unboxed-closure-sugar-equiv.rs src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs src/test/compile-fail/unboxed-closure-sugar-region.rs src/test/compile-fail/unsized3.rs src/test/run-pass/associated-types-conditional-dispatch.rs
2015-01-06FalloutNick Cameron-2/+2
2015-01-05sed -i -s 's/ for Sized?//g' **/*.rsJorge Aparicio-1/+1
2015-01-04serialize: Use assoc types + less old_orphan_checkAlex Crichton-246/+267
This commit moves the libserialize crate (and will force the hand of the rustc-serialize crate) to not require the `old_orphan_check` feature gate as well as using associated types wherever possible. Concretely, the following changes were made: * The error type of `Encoder` and `Decoder` is now an associated type, meaning that these traits have no type parameters. * The `Encoder` and `Decoder` type parameters on the `Encodable` and `Decodable` traits have moved to the corresponding method of the trait. This movement alleviates the dependency on `old_orphan_check` but implies that implementations can no longer be specialized for the type of encoder/decoder being implemented. Due to the trait definitions changing, this is a: [breaking-change]
2014-12-21Fallout of std::str stabilizationAlex Crichton-2/+2
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-4/+6
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]
2014-12-15serialize: Change some FnOnce bounds to FnMutAlex Crichton-3/+3
Relax some of the bounds on the decoder methods back to FnMut to help accomodate some more flavorful variants of decoders which may need to run the closure more than once when it, for example, attempts to find the first successful enum to decode. This a breaking change due to the bounds for the trait switching, and clients will need to update from `FnOnce` to `FnMut` as well as likely making the local function binding mutable in order to call the function. [breaking-change]
2014-12-13libserialize: use unboxed closuresJorge Aparicio-100/+107
2014-11-06DTSify libserialize traitsJorge Aparicio-7/+14
- ToBase64 - FromBase64 - ToHex - FromHex - ToJson - Encodable
2014-11-01libserialize: tuple-arity should be provided to `Decoder::read_tuple`Dan Burkert-6/+11
Currently `Decoder` implementations are not provided the tuple arity as a parameter to `read_tuple`. This forces all encoder/decoder combos to serialize the arity along with the elements. Tuple-arity is always known statically at the decode site, because it is part of the type of the tuple, so it could instead be provided as an argument to `read_tuple`, as it is to `read_struct`. The upside to this is that serialized tuples could become smaller in encoder/decoder implementations which choose not to serialize type (arity) information. For example, @TyOverby's [binary-encode](https://github.com/TyOverby/binary-encode) format is currently forced to serialize the tuple-arity along with every tuple, despite the information being statically known at the decode site. A downside to this change is that the tuple-arity of serialized tuples can no longer be automatically checked during deserialization. However, for formats which do serialize the tuple-arity, either explicitly (rbml) or implicitly (json), this check can be added to the `read_tuple` method. The signature of `Deserialize::read_tuple` and `Deserialize::read_tuple_struct` are changed, and thus binary backwards-compatibility is broken. This change does *not* force serialization formats to change, and thus does not break decoding values serialized prior to this change. [breaking-change]
2014-10-27alloc: Make deriving more friendly with ArcAlex Crichton-1/+1
This adds impls of Eq/Ord/PartialEq/PartialOrd/Show/Default to Arc<T>, and it also removes the `Send + Sync` bound on the `Clone` impl of Arc to make it more deriving-friendly. The `Send + Sync` requirement is still enforce on construction, of course!
2014-10-26Added Encodable and Decodable for Arc<T>.Colin Sherratt-0/+13
2014-10-02serialize: remove proxy impls for Gc<T>.Eduard Burtescu-13/+0
2014-09-23use emit_tuple_arg while serializing tuplesDan Burkert-1/+1
2014-08-30Unify non-snake-case lints and non-uppercase statics lintsP1start-2/+2
This unifies the `non_snake_case_functions` and `uppercase_variables` lints into one lint, `non_snake_case`. It also now checks for non-snake-case modules. This also extends the non-camel-case types lint to check type parameters, and merges the `non_uppercase_pattern_statics` lint into the `non_uppercase_statics` lint. Because the `uppercase_variables` lint is now part of the `non_snake_case` lint, all non-snake-case variables that start with lowercase characters (such as `fooBar`) will now trigger the `non_snake_case` lint. New code should be updated to use the new `non_snake_case` lint instead of the previous `non_snake_case_functions` and `uppercase_variables` lints. All use of the `non_uppercase_pattern_statics` should be replaced with the `non_uppercase_statics` lint. Any code that previously contained non-snake-case module or variable names should be updated to use snake case names or disable the `non_snake_case` lint. Any code with non-camel-case type parameters should be changed to use camel case or disable the `non_camel_case_types` lint. [breaking-change]
2014-08-10remove outdated commentChuck Ries-2/+0
These are already coded as traits.