summary refs log tree commit diff
path: root/src/libcore/fmt
AgeCommit message (Collapse)AuthorLines
2015-09-13Add a blanket impl for &mut std::fmt::WriteChris Wong-0/+15
There is already a corresponding impl for `std::io::Write`. This change will make the two traits more consistent.
2015-08-15core: Fill out issues for unstable featuresAlex Crichton-14/+28
2015-08-15Reduce libcore/liballoc's dependence on pointer sizesDylan McKay-6/+1
2015-08-09Replace many uses of `mem::transmute` with more specific functionsTobias Bucher-2/+2
The replacements are functions that usually use a single `mem::transmute` in their body and restrict input and output via more concrete types than `T` and `U`. Worth noting are the `transmute` functions for slices and the `from_utf8*` family for mutable slices. Additionally, `mem::transmute` was often used for casting raw pointers, when you can already cast raw pointers just fine with `as`.
2015-08-03syntax: Implement #![no_core]Alex Crichton-3/+3
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-07-29Rollup merge of #27326 - steveklabnik:doc_show_use, r=GankroSteve Klabnik-1/+2
In spirit with https://internals.rust-lang.org/t/should-we-keep-including-obvious-imports-in-code-examples/2217, show the feature flags we're using in examples. (also one instance of 'use')
2015-07-27Fix escaping of characters in Debug for OsStrdiaphore-2/+2
Fixes #27211 Fix Debug for {char, str} in core::fmt
2015-07-27Show appropriate feature flags in docsSteve Klabnik-1/+2
2015-07-20Auto merge of #27026 - nagisa:overflowing-unsigned, r=pnkfelixbors-2/+0
This commit fixes the negate_unsigned feature gate to appropriately account for inferred variables. This is technically a [breaking-change], but I’d consider it a bug fix. cc @brson for your relnotes. Fixes https://github.com/rust-lang/rust/issues/24676 Fixes #26840 Fixes https://github.com/rust-lang/rust/issues/25206
2015-07-18optimize integer formattingarthurprs-2/+86
2015-07-14Fix negate_unsigned feature gate checkSimonas Kazlauskas-2/+0
This commit fixes the negate_unsigned feature gate to appropriately account for infered variables. This is technically a [breaking-change].
2015-07-10Add trailing , for 1-tuplesSteven Fackler-1/+16
2015-07-08Change tuple Debug impls to use buildersSteven Fackler-13/+3
2015-07-08Make mention of alternate flags in std::fmt traitsSteve Klabnik-0/+43
https://www.reddit.com/r/rust/comments/3ceaui/psa_produces_prettyprinted_debug_output/
2015-07-06Significantly improve formatter trait docsSteve Klabnik-11/+300
Each formatting trait now has an example of implementation, as well as a fuller description of what it's supposed to output. It also contains a link to the module-level documentation which Fixes #25765
2015-07-01Auto merge of #26698 - alexcrichton:char-fmt, r=huonwbors-1/+8
This recently regressed in #24689, and this updates the `Display` implementation to take formatting flags into account. Closes #26625
2015-06-30std: Fix formatting flags for charsAlex Crichton-1/+8
This recently regressed in #24689, and this updates the `Display` implementation to take formatting flags into account. Closes #26625
2015-06-30fmt: Update docs and mention :#? pretty-printingUlrik Sverdrup-1/+4
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-1/+1
2015-06-17core: Split apart the global `core` featureAlex Crichton-15/+13
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-06-14Update mod.rsWei-Ming Yang-2/+2
`FormatError` is not exist anymore.
2015-06-10Have std::fmt::Formatter implement std::fmt::Write.Simon Sapin-7/+15
2015-06-10Add a write_char method to std::fmt::Formatter.Simon Sapin-4/+8
This is the logical next step after #24661, but I’m less sure about this one.
2015-05-28Improve Debug documentationSteve Klabnik-0/+44
2015-05-19Stabilize debug builders for 1.2.0Steven Fackler-23/+23
2015-05-18Fix debug builder examples examplesSteven Fackler-2/+2
2015-05-17Fix finish docsSteven Fackler-10/+5
2015-05-17Make debug builders take &mut self, add entries methodSteven Fackler-15/+45
[breaking-change]
2015-05-06core: made the core formatter to use a new flt2dec.Kang Seonghoon-332/+125
As a side effect `core::fmt::float` is gone now. This also slightly changes the float output, so this is: [breaking-change]
2015-05-02Make `UnsafeCell`, `RefCell`, `Mutex`, and `RwLock` accept DSTsP1start-3/+3
This + DST coercions (#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to be simplified to `Rc<RefCell<Trait>>`.
2015-04-28Register new snapshotsTamir Duberstein-36/+7
2015-04-21rollup merge of #24636: alexcrichton/remove-deprecatedAlex Crichton-44/+66
Conflicts: src/libcore/result.rs
2015-04-21std: Remove deprecated/unstable num functionalityAlex Crichton-44/+66
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
2015-04-21Pick a feature name for write_charSimon Sapin-1/+1
2015-04-21write_char is unlikely to make it for 1.0, it’ll be 1.1Simon Sapin-1/+1
2015-04-21Add a `write_char` method to `std::fmt::Write`Simon Sapin-0/+17
as accepted in [RFC 526](https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md).
2015-04-14rollup merge of #24379: rkruppe/fmt-negative-zeroAlex Crichton-114/+52
Fixes #20596 by making `Debug` render negative zero with a `-` without affecting the behavior of `Display`. While I was at it, I also removed some dead code from `float_to_str_bytes_common` (the one from `libcore/fmt/float.rs`, not the function of the same name in `libstd/num/strconv.rs`). It had support for different bases, and for negative numbers, but the function is internal to core and the couple places that call it (all in `libcore/fmt/mod.rs`) never use those features: They pass in `num.abs()` and base 10.
2015-04-12Destabilize format_args! internals.Ryan Prichard-29/+36
Arguments, Formatters, and the various format traits remain stable. The format_args! macro uses #[allow_internal_unstable] to allow it access to the unstable things in core::fmt. Destabilized things include a "v1" in their name: * core::fmt::rt * core::fmt::rt::v1 (the module and all contents) * core::fmt::ArgumentV1 * core::fmt::ArgumentV1::new * core::fmt::ArgumentV1::from_usize * core::fmt::Arguments::new_v1 * core::fmt::Arguments::new_v1_formatted The unstable message was copied from that of std::io::_print.
2015-04-12Make Debug include the - in -0.0Robin Kruppe-114/+52
2015-04-11Auto merge of #24269 - benashford:formatting-fix, r=alexcrichtonbors-1/+1
This fixes the bug described in issue #23150. This affected formatting any floating point number into a string in a formatting pattern that: a) required rounding up, and b) required an extra digit on the front. So `format!("{:.0}", 9.9)` would fail, but `format!("{:.0}", 8.9)` would succeed. This was due to a negative integer being cast to a `usize` resulting in an 'arithmetic operation overflowed' panic. The fix was to change the order of operations so that the number is zero before casting.
2015-04-10Fix for #23150Ben Ashford-1/+1
2015-04-09fmt: Assume that we'll only ever see 32 or 64 bit pointersRicho Healey-2/+1
2015-04-09fmt: {:p#} formats pointers padded to native widthRicho Healey-1/+25
2015-04-01rollup merge of #23860: nikomatsakis/copy-requires-cloneAlex Crichton-9/+16
Conflicts: src/test/compile-fail/coherence-impls-copy.rs
2015-04-01Fallout in public-facing and semi-public-facing libsNiko Matsakis-9/+16
2015-04-01Fallout in libstd: remove impls now considered to conflict.Niko Matsakis-6/+0
2015-03-31Auto merge of #23549 - aturon:stab-num, r=alexcrichtonbors-0/+1
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change] r? @alexcrichton
2015-03-31Stabilize std::numAaron Turon-0/+1
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change]
2015-03-30std: Standardize (input, output) param orderingsAlex Crichton-2/+2
This functions swaps the order of arguments to a few functions that previously took (output, input) parameters, but now take (input, output) parameters (in that order). The affected functions are: * ptr::copy * ptr::copy_nonoverlapping * slice::bytes::copy_memory * intrinsics::copy * intrinsics::copy_nonoverlapping Closes #22890 [breaking-change]
2015-03-29Auto merge of #23810 - sfackler:debug-collections, r=alexcrichtonbors-90/+125
The collections debug helpers no longer prefix output with the collection name, in line with the current conventions for Debug implementations. Implementations that want to preserve the current behavior can simply add a `try!(write!(fmt, "TypeName "));` at the beginning of the `fmt` method. [breaking-change]