about summary refs log tree commit diff
path: root/src/libcore/fmt
AgeCommit message (Collapse)AuthorLines
2017-10-11Prevent fmt::Arguments from being shared across threadsOliver Schneider-0/+1
Fixes #45197
2017-10-08Rollup merge of #45081 - tamird:fmt-cleanup, r=alexcrichtonkennytm-7/+6
fmt: misc cleanup
2017-10-08Rollup merge of #45042 - brennie:brennie/fmt-trait-summaries, r=steveklabnikkennytm-8/+8
Update trait summaries for std::fmt This patch is part of #29355. r? @steveklabnik
2017-10-07fmt: remove misleading comment fragmentTamir Duberstein-1/+1
2017-10-07fmt: DRYTamir Duberstein-5/+5
2017-10-07fmt: remove unnecessary lint suppressionTamir Duberstein-1/+0
2017-10-05Auto merge of #44943 - nivkner:fixme_fixup, r=dtolnaybors-1/+0
address some FIXME whose associated issues were marked as closed part of #44366
2017-10-04Update trait summaries for std::fmtBarret Rennie-8/+8
This patch is part of #29355.
2017-09-30address some `FIXME`s whose associated issues were marked as closedNiv Kaminer-1/+0
remove FIXME(#13101) since `assert_receiver_is_total_eq` stays. remove FIXME(#19649) now that stability markers render. remove FIXME(#13642) now the benchmarks were moved. remove FIXME(#6220) now that floating points can be formatted. remove FIXME(#18248) and write tests for `Rc<str>` and `Rc<[u8]>` remove reference to irelevent issues in FIXME(#1697, #2178...) update FIXME(#5516) to point to getopts issue 7 update FIXME(#7771) to point to RFC 628 update FIXME(#19839) to point to issue 26925
2017-09-25Add missing links in fmt moduleGuillaume Gomez-4/+8
2017-09-21Less confusing placeholder when RefCell is exclusively borrowedDavid Tolnay-1/+11
Based on ExpHP's comment in https://users.rust-lang.org/t/refcell-borrow-mut-get-strange-result/12994 > it would perhaps be nicer if it didn't put something that could be > misinterpreted as a valid string value The previous Debug implementation would show: RefCell { value: "<borrowed>" } The new one is: RefCell { value: <borrowed> }
2017-08-29Use a byte literal ASCII 0 instead of its decimal valueDavid Tolnay-1/+1
2017-08-24Fix inconsistent doc headingslukaramu-5/+5
This fixes headings reading "Unsafety" and "Example", they should be "Safety" and "Examples" according to RFC 1574.
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-15/+15
Like #43008 (f668999), but _much more aggressive_.
2017-08-13Don't inline debug methodsSteven Fackler-5/+0
The inner methods aren't inlined, so this puts more pressure on LLVM for literally no benefit. Closes #43843
2017-07-18Rollup merge of #42837 - rthomas:29355-error, r=steveklabnikMark Simulacrum-0/+16
Update docs on Error struct. #29355 This adds a pretty contrived example of the usage of fmt::Error. I am very open to suggestions for a better one. I have also highlighted the fmt::Error vs std::error::Error. r? @steveklabnik
2017-07-13Update docs on Error struct. #29355Ryan Thomas-0/+16
This adds a pretty contrived example of the usage of fmt::Error. I am very open to suggestions for a better one. I have also highlighted the fmt::Error vs std::error::Error. r? @steveklabnik
2017-07-12Rollup merge of #43011 - qnighy:unsized-tuple-impls, r=aturonMark Simulacrum-2/+7
Implement Eq/Hash/Debug etc. for unsized tuples. As I mentioned in [the comment in #18469](https://github.com/rust-lang/rust/issues/18469#issuecomment-306767422), the implementations of `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `Debug`, `Hash` can be generalized to unsized tuples. This is consistent with the `derive` behavior for unsized structs. ```rust #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Default, Hash)] struct MyTuple<X, Y, Z: ?Sized>(X, Y, Z); fn f(x: &MyTuple<i32, i32, [i32]>) { x == x; x < x; println!("{:?}", x); } ``` Questions: - Need an RFC? - Need a feature gate? I don't think it does because the unsized tuple coercion #42527 is feature-gated. - I changed `builder.field($name);` into `builder.field(&$name);` in the `Debug` implementation to pass compilation. This won't affect the behavior because `Debug for &'a T` is a mere redirection to `Debug for T`. However, I don't know if it affects code size / performance.
2017-07-04Rollup merge of #42836 - rthomas:29355-debug, r=GuillaumeGomezMark Simulacrum-10/+129
Update docs for Debug* structs. #29355 This adds docs for the Debug* structs as well as examples from the Formatter::debug_* methods, so that a user knows how to construct them. I added these examples as the builders module is not public and hence the debug_*_new() functions are not available to a user. r? @steveklabnik
2017-07-02Add docs for Debug* structs. #29355Ryan Thomas-10/+129
This adds docs for the Debug* structs as well as examples from the Formatter::debug_* methods, so that a user knows how to construct them. I added these examples as the builders module is not public and hence the debug_*_new() functions are not available to a user. r? @steveklabnik Review comments. Mainly adding in the links for all of the structs and functions. Remove rust tag on code blocks.
2017-07-02Implement Eq/Hash/Debug etc. for unsized tuples.Masaki Hara-2/+7
2017-06-22Update docs for fmt::write.Ryan Thomas-7/+4
I reworded it slightly to make it more clear that the function only take two arguments - the output and the Arguments struct that can be generated from the format_args! macro. r? @steveklabnik
2017-05-09fix confusion about parts required for float formattingNathan Froyd-4/+4
The documentation for flt2dec doesn't match up with the actual implementation, so fix the documentation to align with reality. Presumably due to the mismatch, the formatting code for floats in std::fmt can use correspondingly shorter arrays in some places, so fix those places up as well. Fixes #41304.
2017-04-28fmt: use mem::uninitialized for float formatting buffersNathan Froyd-22/+34
Spending time to initialize these is just wasted work, as we'll overwrite them soon anyway. Fixes #41259.
2017-04-28fmt: use the minimum parts array sizeNathan Froyd-4/+4
The comments for flt2dec::to_shortest_str says that we only need a slice of length 5 for the parts array. Initializing a 16-part array is just wasted effort and wasted stack space. Other functions in the flt2dec module have similar comments, so we adjust the parts arrays passed to those functions accordingly.
2017-04-28fmt: reduce the stack space required by float formattingNathan Froyd-16/+66
For the two major entry points for float formatting, we split the exact case and the shortest cases into separate functions. We mark the separate functions as #[inline(never) so the exact cases won't bloat stack space in their callers unnecessarily. The shortest cases are marked so for similar reasons. Fixes #41234.
2017-04-20Remove num::{Zero,One}Josh Stone-2/+3
[unstable, deprecated since 1.11.0]
2017-04-09Added doc comments for fmt::Resultmandeep-1/+24
2017-03-15Change how the 0 flag works in format! for floatsPiotr Jawniak-1/+4
Now it always implies right-alignment, so that padding zeroes are placed after the sign (if any) and before the digits. In other words, it always takes precedence over explicitly specified `[[fill]align]`. :06 :<06 :>06 :^06 before |-001.2| |-1.200| |-001.2| |-01.20| after |-001.2| |-001.2| |-001.2| |-001.2|
2017-03-15Change how the `0` flag works in format!Piotr Jawniak-0/+1
Now it always implies right-alignment, so that padding zeroes are placed after the sign (if any) and before the digits. In other words, it always takes precedence over explicitly specified `[[fill]align]`. This also affects the '#' flag: zeroes are placed after the prefix (0b, 0o, 0x) and before the digits. :05 :<05 :>05 :^05 before |-0001| |-1000| |-0001| |-0100| after |-0001| |-0001| |-0001| |-0001| :#05x :<#05x :>#05x :^#05x before |0x001| |0x100| |000x1| |0x010| after |0x001| |0x001| |0x001| |0x001| Fixes #39997 [breaking-change]
2017-03-10Add missing example for Display::fmtGuillaume Gomez-1/+20
2017-02-28Add missing docs and examples for fmt::WriteGuillaume Gomez-9/+62
2017-02-12Fix some typos in the core::fmt docs.Ahmed Charles-2/+2
2017-02-09name anonymous fn parameters in libcore traitsTrevor Spiteri-9/+9
2017-02-07Improve fmt floatSon-83/+98
* Move to a separate float mod * Add more tests for f64 f32 lower exp upper exp * Use assert_eq for a clearer error message
2017-02-03Auto merge of #39463 - alexcrichton:update-bootstrap, r=alexcrichtonbors-7/+1
Bump version, upgrade bootstrap 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.
2017-02-03Bump version, upgrade bootstrapAlex Crichton-7/+1
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.
2017-02-02remove the wrapping arithmeticsMichał Krasnoborski-10/+5
2017-02-01Adjust heuristics to better handle "{}..." format strings.Michał Krasnoborski-9/+12
2017-01-28use `String::with_capacity` in `format!`Michał Krasnoborski-0/+28
2016-12-3040 -> 39, as ceil(log10(2^128)) == 39est31-1/+1
just as ceil(log10(2^64)) == 20
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-5/+16
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-12-16Address falloutAaron Turon-5/+5
2016-11-28Make core::fmt::Void a non-empty type.Andrew Cann-1/+3
Because we handle artifically-constructed references to it in live code which is a totally broken thing to do.
2016-10-27tidy/features: fix checking of lang featuresTamir Duberstein-2/+2
Removes the `STATUSES` static which duplicates truth from the pattern match in `collect_lang_features`. Fixes existing duplicates by renaming: - never_type{,_impls} on `impl`s on `!` - concat_idents{,_macro} on `macro_rules! concat_idents` Fixes #37013.
2016-10-01impl Debug for raw pointers to unsized dataAlex Burka-2/+2
2016-09-30Rollup merge of #36535 - GuillaumeGomez:macro_url, r=steveklabnikSteve Klabnik-2/+2
Update to new macro url syntax r? @steveklabnik
2016-09-28[breaking-change] std: change `encode_utf{8,16}()` to take a buffer and ↵tormol-13/+5
return a slice They panic if the buffer is too small.
2016-09-22Rollup merge of #36423 - GuillaumeGomez:eq_impl, r=pnkfelixJonathan Turner-1/+1
Add missing Eq implementations Part of #36301.
2016-09-18Add missing Eq implementationsGuillaume Gomez-1/+1