summary refs log tree commit diff
path: root/src/libcore/fmt
AgeCommit message (Collapse)AuthorLines
2017-12-20Rollup merge of #46831 - Diggsey:float-debug-fmt, r=dtolnaykennytm-8/+9
Always `Debug` floats with a decimal point Fixes #30967 r? @dtolnay
2017-12-20Auto merge of #46233 - SimonSapin:fmt-debuglist-flags, r=sfacklerbors-43/+79
Make fmt::DebugList and friends forward formatting parameters For example, formatting slice of integers with `{:04?}` should zero-pad each integer. This also affects every use of `#[derive(Debug)]`.
2017-12-19Always print floats with a decimal point with the Debug formatterDiggory Blake-8/+9
2017-12-12Rename never_type_impls gate to never_typeAndrew Cann-2/+2
2017-11-28Reject '2' as a binary digit in internals of 'b' formattingDavid Ross-1/+1
I don't believe the previous code `0 ... 2` would run into any real problems, but it seems confusing to read, given that '2' is never a valid binary digit. As far as I can tell this code is only ever called from within another private method in the trait which has logic to never hand it '2' anyways. I thought we could change this for clarity anyways.
2017-11-28Rollup merge of #46285 - SimonSapin:twos-complement, r=GuillaumeGomezkennytm-0/+20
Document non-obvious behavior of fmt::UpperHex & co for negative integers Before stabilization I’d have suggested changing the behavior, but that time is past.
2017-11-27Keep access to private Formatter fields in Formatter methodsSimon Sapin-43/+49
2017-11-26Document non-obvious behavior of fmt::UpperHex & co for negative integersSimon Sapin-0/+20
Before stabilization I’d have suggested changing the behavior, but that time is past.
2017-11-26Deprecate the Formatter::flags method, fix #46237Simon Sapin-0/+3
2017-11-24Make fmt::DebugList and friends forward formatting parametersSimon Sapin-28/+58
For example, formatting slice of integers with `{:04?}` should zero-pad each integer.
2017-11-22Auto merge of #45198 - oli-obk:fmt_args, r=sfacklerbors-0/+8
Prevent fmt::Arguments from being shared across threads Fixes #45197 This is a **breaking change**! Without doing this it's very easy to create race conditions. There's probably a way to do this without breaking valid use cases, but it would require quite an overhaul of the formatting machinery.
2017-11-21fix some typosMartin Lindhe-1/+1
2017-11-08Add missing example for Debug traitGuillaume Gomez-0/+20
2017-10-11Explain the `_oibit_remover` fieldOliver Schneider-0/+7
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.