about summary refs log tree commit diff
path: root/src/libserialize/json.rs
AgeCommit message (Collapse)AuthorLines
2015-02-24Use arrays instead of vectors in testsVadim Petrochenkov-5/+5
2015-02-18rollup merge of #22502: nikomatsakis/deprecate-bracket-bracketAlex Crichton-6/+6
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/librustc/middle/lang_items.rs src/librustc_back/rpath.rs src/librustc_typeck/check/regionck.rs src/libstd/ffi/os_str.rs src/libsyntax/diagnostic.rs src/libsyntax/parse/parser.rs src/libsyntax/util/interner.rs src/test/run-pass/regions-refcell.rs
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-6/+6
2015-02-18Convert required suffixes into a use of `as`.Niko Matsakis-11/+11
2015-02-14Rename `fmt::Writer` to `fmt::Write`Chris Wong-8/+8
This brings it in line with its namesake in `std::io`. [breaking-change]
2015-02-08Rename Show to Debug, String to DisplayAlexander Korolkov-2/+2
Update reference.md: - derive() no longer supports Zero trait - derive() now supports Copy trait
2015-02-05cleanup: replace `as[_mut]_slice()` calls with deref coercionsJorge Aparicio-4/+4
2015-02-03Auto merge of #21613 - alfie:suffix-small, r=alexcrichtonbors-22/+22
2015-02-02More deprecating of i/u suffixesAlfie John-22/+22
2015-02-02`for x in xs.into_iter()` -> `for x in xs`Jorge Aparicio-1/+1
Also `for x in option.into_iter()` -> `if let Some(x) = option`
2015-02-02`for x in xs.iter()` -> `for x in &xs`Jorge Aparicio-7/+7
2015-01-30rollup merge of #21631: tbu-/isize_policeAlex Crichton-2/+2
Conflicts: src/libcoretest/iter.rs
2015-01-30rollup merge of #21713: alexcrichton/second-pass-fmtAlex Crichton-2/+2
2015-01-30std: Stabilize the std::fmt moduleAlex Crichton-2/+2
This commit performs a final stabilization pass over the std::fmt module, marking all necessary APIs as stable. One of the more interesting aspects of this module is that it exposes a good deal of its runtime representation to the outside world in order for `format_args!` to be able to construct the format strings. Instead of hacking the compiler to assume that these items are stable, this commit instead lays out a story for the stabilization and evolution of these APIs. There are three primary details used by the `format_args!` macro: 1. `Arguments` - an opaque package of a "compiled format string". This structure is passed around and the `write` function is the source of truth for transforming a compiled format string into a string at runtime. This must be able to be constructed in stable code. 2. `Argument` - an opaque structure representing an argument to a format string. This is *almost* a trait object as it's just a pointer/function pair, but due to the function originating from one of many traits, it's not actually a trait object. Like `Arguments`, this must be constructed from stable code. 3. `fmt::rt` - this module contains the runtime type definitions primarily for the `rt::Argument` structure. Whenever an argument is formatted with nonstandard flags, a corresponding `rt::Argument` is generated describing how the argument is being formatted. This can be used to construct an `Arguments`. The primary interface to `std::fmt` is the `Arguments` structure, and as such this type name is stabilize as-is today. It is expected for libraries to pass around an `Arguments` structure to represent a pending formatted computation. The remaining portions are largely "cruft" which would rather not be stabilized, but due to the stability checks they must be. As a result, almost all pieces have been renamed to represent that they are "version 1" of the formatting representation. The theory is that at a later date if we change the representation of these types we can add new definitions called "version 2" and corresponding constructors for `Arguments`. One of the other remaining large questions about the fmt module were how the pending I/O reform would affect the signatures of methods in the module. Due to [RFC 526][rfc], however, the writers of fmt are now incompatible with the writers of io, so this question has largely been solved. As a result the interfaces are largely stabilized as-is today. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md Specifically, the following changes were made: * The contents of `fmt::rt` were all moved under `fmt::rt::v1` * `fmt::rt` is stable * `fmt::rt::v1` is stable * `Error` is stable * `Writer` is stable * `Writer::write_str` is stable * `Writer::write_fmt` is stable * `Formatter` is stable * `Argument` has been renamed to `ArgumentV1` and is stable * `ArgumentV1::new` is stable * `ArgumentV1::from_uint` is stable * `Arguments::new_v1` is stable (renamed from `new`) * `Arguments::new_v1_formatted` is stable (renamed from `with_placeholders`) * All formatting traits are now stable, as well as the `fmt` method. * `fmt::write` is stable * `fmt::format` is stable * `Formatter::pad_integral` is stable * `Formatter::pad` is stable * `Formatter::write_str` is stable * `Formatter::write_fmt` is stable * Some assorted top level items which were only used by `format_args!` were removed in favor of static functions on `ArgumentV1` as well. * The formatting-flag-accessing methods remain unstable Within the contents of the `fmt::rt::v1` module, the following actions were taken: * Reexports of all enum variants were removed * All prefixes on enum variants were removed * A few miscellaneous enum variants were renamed * Otherwise all structs, fields, and variants were marked stable. In addition to these actions in the `std::fmt` module, many implementations of `Show` and `String` were stabilized as well. In some other modules: * `ToString` is now stable * `ToString::to_string` is now stable * `Vec` no longer implements `fmt::Writer` (this has moved to `String`) This is a breaking change due to all of the changes to the `fmt::rt` module, but this likely will not have much impact on existing programs. Closes #20661 [breaking-change]
2015-01-30std: Stabilize FromStr and parseAlex Crichton-4/+5
This commits adds an associated type to the `FromStr` trait representing an error payload for parses which do not succeed. The previous return value, `Option<Self>` did not allow for this form of payload. After the associated type was added, the following attributes were applied: * `FromStr` is now stable * `FromStr::Err` is now stable * `FromStr::from_str` is now stable * `StrExt::parse` is now stable * `FromStr for bool` is now stable * `FromStr for $float` is now stable * `FromStr for $integral` is now stable * Errors returned from stable `FromStr` implementations are stable * Errors implement `Display` and `Error` (both impl blocks being `#[stable]`) Closes #15138
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