summary refs log tree commit diff
path: root/src/libserialize/json.rs
AgeCommit message (Collapse)AuthorLines
2015-01-30Remove all `i` suffixesTobias Bucher-2/+2
2015-01-29Auto merge of #21677 - japaric:no-range, r=alexcrichtonbors-18/+18
Note: Do not merge until we get a newer snapshot that includes #21374 There was some type inference fallout (see 4th commit) because type inference with `a..b` is not as good as with `range(a, b)` (see #21672). r? @alexcrichton
2015-01-29s/Show/Debug/gJorge Aparicio-13/+13
2015-01-29convert remaining `range(a, b)` to `a..b`Jorge Aparicio-3/+3
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-29Rollup merge of 21662 - oli-obk:hashmap_enum_json, r=alexcrichtonManish Goregaokar-9/+25
2015-01-27fix #[cfg(test)] warningsJorge Aparicio-2/+1
2015-01-26Fallout of io => old_ioAlex Crichton-9/+9
2015-01-26don't ignore errors in encode and allow hashmaps with enum keysOliver Schneider-9/+25
closes #21470 on main rust repository was fixed on rust-lang/rustc-serialize (see https://github.com/rust-lang/rustc-serialize/pull/32)
2015-01-21rollup merge of #21457: alexcrichton/issue-21436Alex Crichton-9/+28
Conflicts: src/liballoc/boxed.rs src/librustc/middle/traits/error_reporting.rs src/libstd/sync/mpsc/mod.rs
2015-01-21rollup merge of #21396: japaric/no-parens-in-rangeAlex Crichton-2/+2
Conflicts: src/libsyntax/parse/lexer/comments.rs
2015-01-20std: Rename Show/String to Debug/DisplayAlex Crichton-9/+28
This commit is an implementation of [RFC 565][rfc] which is a stabilization of the `std::fmt` module and the implementations of various formatting traits. Specifically, the following changes were performed: [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0565-show-string-guidelines.md * The `Show` trait is now deprecated, it was renamed to `Debug` * The `String` trait is now deprecated, it was renamed to `Display` * Many `Debug` and `Display` implementations were audited in accordance with the RFC and audited implementations now have the `#[stable]` attribute * Integers and floats no longer print a suffix * Smart pointers no longer print details that they are a smart pointer * Paths with `Debug` are now quoted and escape characters * The `unwrap` methods on `Result` now require `Display` instead of `Debug` * The `Error` trait no longer has a `detail` method and now requires that `Display` must be implemented. With the loss of `String`, this has moved into libcore. * `impl<E: Error> FromError<E> for Box<Error>` now exists * `derive(Show)` has been renamed to `derive(Debug)`. This is not currently warned about due to warnings being emitted on stage1+ While backwards compatibility is attempted to be maintained with a blanket implementation of `Display` for the old `String` trait (and the same for `Show`/`Debug`) this is still a breaking change due to primitives no longer implementing `String` as well as modifications such as `unwrap` and the `Error` trait. Most code is fairly straightforward to update with a rename or tweaks of method calls. [breaking-change] Closes #21436
2015-01-21Rollup merge of #21314 - fenhl:patch-1, r=steveklbanikBarosl LEE-1/+1
See [this document](https://gist.github.com/0xabad1dea/8870b192fd1758743f66) by @0xabad1dea for the rationale.
2015-01-19remove unnecessary parentheses from range notationJorge Aparicio-2/+2
2015-01-19ugly hack to convert BadHashMapKey error to general fmt::ErrorOliver 'ker' Schneider-5/+20
2015-01-19add unit test for non string/numeric map keysOliver 'ker' Schneider-1/+20
2015-01-19lower FnMut to FnOnce since json-hack is no longer requiredOliver 'ker' Schneider-4/+4
Conflicts: src/libserialize/serialize.rs
2015-01-19json-encoder: report error when hash map key is not string or numericOliver 'ker' Schneider-78/+154
2015-01-17Undo accidental change unrelated to my PRFenhl-1/+1
2015-01-17Use singular they in the serialize::json docsFenhl-2/+2
See [https://gist.github.com/0xabad1dea/8870b192fd1758743f66](this document) by @0xabad1dea for the rationale.
2015-01-12cleanup: `&foo[0..a]` -> `&foo[..a]`Jorge Aparicio-2/+2
2015-01-07rollup merge of #20728: huonw/type-param-shadowingAlex Crichton-1/+1
Conflicts: src/librustc_typeck/check/wf.rs
2015-01-08Prohibit type parameter shadowing with a clunky hammer.Huon Wilson-1/+1
This is a [breaking-change]. Change impl<T> Foo<T> { fn bar<T>(... to (for example) impl<T> Foo<T> { fn bar<U>(... Per RFC 459. Closes #19390.
2015-01-07rollup merge of #20721: japaric/snapAlex Crichton-15/+14
Conflicts: src/libcollections/vec.rs src/libcore/fmt/mod.rs src/librustc/lint/builtin.rs src/librustc/session/config.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/context.rs src/librustc_trans/trans/type_.rs src/librustc_typeck/check/_match.rs src/librustdoc/html/format.rs src/libsyntax/std_inject.rs src/libsyntax/util/interner.rs src/test/compile-fail/mut-pattern-mismatched.rs
2015-01-07rollup merge of #20708: aturon/new-int-modulesAlex Crichton-8/+0
Conflicts: src/libserialize/lib.rs
2015-01-07use slicing sugarJorge Aparicio-15/+14
2015-01-07register new snapshotsJorge Aparicio-8/+0
2015-01-08Rename `target_word_size` to `target_pointer_width`Nick Cameron-3/+3
Closes #20421 [breaking-change]
2015-01-07Register new snapshotsAlex Crichton-8/+0
2015-01-06More test fixesAlex Crichton-12/+13
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-24/+32
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
2015-01-07falloutNick Cameron-18/+39
2015-01-06core: split into fmt::Show and fmt::StringSean McArthur-24/+32
fmt::Show is for debugging, and can and should be implemented for all public types. This trait is used with `{:?}` syntax. There still exists #[derive(Show)]. fmt::String is for types that faithfully be represented as a String. Because of this, there is no way to derive fmt::String, all implementations must be purposeful. It is used by the default format syntax, `{}`. This will break most instances of `{}`, since that now requires the type to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the correct fix. Types that were being printed specifically for users should receive a fmt::String implementation to fix this. Part of #20013 [breaking-change]
2015-01-07Replace full slice notation with index callsNick Cameron-94/+94
2015-01-05rollup merge of #20556: japaric/no-for-sizedAlex Crichton-1/+1
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/libcore/borrow.rs src/libcore/cmp.rs src/libcore/ops.rs src/libstd/c_str.rs src/test/compile-fail/issue-19009.rs
2015-01-05register snapshotJorge Aparicio-21/+0
2015-01-05sed -i -s 's/ for Sized?//g' **/*.rsJorge Aparicio-1/+1
2015-01-04serialize: Use assoc types + less old_orphan_checkAlex Crichton-17/+16
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]
2015-01-03Remove deprecated functionalityAlex Crichton-1/+1
This removes a large array of deprecated functionality, regardless of how recently it was deprecated. The purpose of this commit is to clean out the standard libraries and compiler for the upcoming alpha release. Some notable compiler changes were to enable warnings for all now-deprecated command line arguments (previously the deprecated versions were silently accepted) as well as removing deriving(Zero) entirely (the trait was removed). The distribution no longer contains the libtime or libregex_macros crates. Both of these have been deprecated for some time and are available externally.
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-19/+19
2015-01-03sed -i -s 's/\bmod,/self,/g' **/*.rsJorge Aparicio-2/+2
2015-01-03serialize: fix falloutJorge Aparicio-0/+25
2015-01-03serialize: fix falloutJorge Aparicio-3/+5
2015-01-02Rollup test fixes and rebase conflictsAlex Crichton-1/+1
2015-01-02rollup merge of #20416: nikomatsakis/coherenceAlex Crichton-4/+7
Conflicts: src/test/run-pass/issue-15734.rs src/test/run-pass/issue-3743.rs
2015-01-02Disable the JSON doctests because they don't pass the new coherenceNiko Matsakis-3/+6
rules and cannot be updated until the libraries are synced, nor can they opt in to the old semantics.
2015-01-02Fix orphan checking (cc #19470). (This is not a complete fix of #19470 ↵Niko Matsakis-1/+1
because of the backwards compatibility feature gate.) This is a [breaking-change]. The new rules require that, for an impl of a trait defined in some other crate, two conditions must hold: 1. Some type must be local. 2. Every type parameter must appear "under" some local type. Here are some examples that are legal: ```rust struct MyStruct<T> { ... } // Here `T` appears "under' `MyStruct`. impl<T> Clone for MyStruct<T> { } // Here `T` appears "under' `MyStruct` as well. Note that it also appears // elsewhere. impl<T> Iterator<T> for MyStruct<T> { } ``` Here is an illegal example: ```rust // Here `U` does not appear "under" `MyStruct` or any other local type. // We call `U` "uncovered". impl<T,U> Iterator<U> for MyStruct<T> { } ``` There are a couple of ways to rewrite this last example so that it is legal: 1. In some cases, the uncovered type parameter (here, `U`) should be converted into an associated type. This is however a non-local change that requires access to the original trait. Also, associated types are not fully baked. 2. Add `U` as a type parameter of `MyStruct`: ```rust struct MyStruct<T,U> { ... } impl<T,U> Iterator<U> for MyStruct<T,U> { } ``` 3. Create a newtype wrapper for `U` ```rust impl<T,U> Iterator<Wrapper<U>> for MyStruct<T,U> { } ``` Because associated types are not fully baked, which in the case of the `Hash` trait makes adhering to this rule impossible, you can temporarily disable this rule in your crate by using `#![feature(old_orphan_check)]`. Note that the `old_orphan_check` feature will be removed before 1.0 is released.
2015-01-01std: Enforce Unicode in fmt::WriterAlex Crichton-134/+147
This commit is an implementation of [RFC 526][rfc] which is a change to alter the definition of the old `fmt::FormatWriter`. The new trait, renamed to `Writer`, now only exposes one method `write_str` in order to guarantee that all implementations of the formatting traits can only produce valid Unicode. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md One of the primary improvements of this patch is the performance of the `.to_string()` method by avoiding an almost-always redundant UTF-8 check. This is a breaking change due to the renaming of the trait as well as the loss of the `write` method, but migration paths should be relatively easy: * All usage of `write` should move to `write_str`. If truly binary data was being written in an implementation of `Show`, then it will need to use a different trait or an altogether different code path. * All usage of `write!` should continue to work as-is with no modifications. * All usage of `Show` where implementations just delegate to another should continue to work as-is. [breaking-change] Closes #20352
2015-01-02More falloutNick Cameron-1/+1
2015-01-02Fallout - change array syntax to use `;`Nick Cameron-1/+1