about summary refs log tree commit diff
path: root/src/libcore/fmt
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-3955/+0
2020-07-19Document `core::fmt::rt::v1::Count`Solomon Ucko-0/+4
2020-07-17Add tracking issue number for fmt_as_str.Mara Bos-1/+1
2020-07-17Make fmt::Arguments::as_str() return a 'static str.Mara Bos-4/+4
2020-07-17Make Arguments::as_str() work for empty format strings.Mara Bos-1/+6
2020-07-17Add #[inline] to Arguments::as_str().Mara Bos-0/+1
2020-07-17Add Arguments::as_str().Mara Bos-0/+35
2020-05-29Rollup merge of #72452 - Lucretiel:precision-doc, r=dtolnayYuki Okushi-1/+2
Clarified the documentation for Formatter::precision Added a note that `precision` is interpreted as max-width when formatting strings
2020-05-24First draft documenting Debug stability.Andrew Lilley Brinker-0/+7
Debug implementations of std types aren't stable, and neither are derived Debug implementations for any types, including user-defined types. This commit adds a section to the Debug documentatio noting this stability status.
2020-05-21Clarified the documentation for Formatter::precisionNathan West-1/+2
2020-04-03Replace max/min_value() with MAX/MIN assoc constsLinus Färnstrand-1/+1
2020-03-23Rename remaining occurences of Void to Opaque.Ana-Maria Mihalache-2/+2
2020-03-12Rollup merge of #69011 - foeb:document-unsafe-core-fmt, r=Mark-SimulacrumMazdak Farrokhzad-6/+45
Document unsafe blocks in core::fmt r? @RalfJung CC: @rust-lang/wg-unsafe-code-guidelines #66219 Sorry for the hiatus, but here's a few more files with the unsafe blocks documented! I think working on it smaller chunks like this will be easier for everyone.
2020-03-08Rollup merge of #69651 - Mark-Simulacrum:black-box-marker, r=eddybMazdak Farrokhzad-1/+11
Try to ensure usize marker does not get merged This follows up on [this conversation](https://github.com/rust-lang/rust/pull/69209#discussion_r379911282). However, I'm not confident this is quite correct, so feedback is appreciated, as always.
2020-03-06fix various typosMatthias Krüger-1/+1
2020-03-05Document unsafe blocks in core::fmtPhoebe Bell-6/+45
2020-03-03Try to ensure usize marker does not get mergedMark Rousskov-1/+11
2020-02-17Move the show_usize marker function to a staticMark Rousskov-7/+16
Currently, function items are always tagged unnamed_addr, which means that casting a function to a function pointer is not guaranteed to produce a deterministic address. However, once a function pointer is created, we do expect that to remain stable. So, this changes the show_usize function to a static containing a function pointer and uses that for comparisons. Notably, a *static* may have 'unstable' address, but the function pointer within it must be constant. Resolves issue 58320.
2020-02-17Move to using an extern type for opaquenessMark Rousskov-12/+4
This prevents accidental dereferences and so forth of the Void type, as well as cleaning up the error message to reference Opaque rather than the more complicated PhantomData type.
2020-02-17Drop unused argument to float functionsMark Rousskov-2/+0
2020-02-15Formatter::sign is &'static strMark Rousskov-6/+6
The contents were always UTF-8 anyway, and &str has an equivalent representation to &[u8], so this should not affect performance while removing unsafety at edges. It may be worth exploring a further adjustment that stores a single byte (instead of 16) as the contents are always "", "-", or "+".
2020-02-14implement LowerExp and UpperExp for integersMax Blachman-0/+163
2020-01-31Drop cfg(bootstrap) codeMark Rousskov-21/+1
2020-01-28stabilize the debug_map_key_value featureAshley Mannix-4/+2
2020-01-24Use Self instead of self return typeLzu Tao-10/+10
2020-01-20Drop args from FormatterMark Rousskov-13/+6
These are no longer used by Formatter methods.
2020-01-20Move run/getcount to functionsMark Rousskov-38/+35
These are only called from one place and don't generally support being called from other places; furthermore, they're the only formatter functions that look at the `args` field (which a future commit will remove).
2020-01-20Delete unused "next" variants from formatting infrastructureMark Rousskov-10/+15
The formatting infrastructure stopped emitting these a while back, and in removing them we can simplify related code.
2020-01-17Auto merge of #66716 - derekdreery:debug_non_exhaustive, r=dtolnaybors-0/+56
Implement `DebugStruct::non_exhaustive`. This patch adds a function (finish_non_exhaustive) to add ellipsis before the closing brace when formatting using `DebugStruct`. ## Example ```rust #![feature(debug_non_exhaustive)] use std::fmt; struct Bar { bar: i32, hidden: f32, } impl fmt::Debug for Bar { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Bar") .field("bar", &self.bar) .non_exhaustive(true) // Show that some other field(s) exist. .finish() } } assert_eq!( format!("{:?}", Bar { bar: 10, hidden: 1.0 }), "Bar { bar: 10, .. }", ); ```
2020-01-15Rollup merge of #67784 - Mark-Simulacrum:residual-pad-integral, r=dtolnayYuki Okushi-3/+6
Reset Formatter flags on exit from pad_integral This fixes a bug where after calling pad_integral with appropriate flags, the fill and alignment flags would be set to '0' and 'Right' and left as such even after exiting pad_integral, which meant that future calls on the same Formatter would get incorrect flags reported. This is quite difficult to observe in practice, as almost all formatting implementations in practice don't call `Display::fmt` directly, but rather use `write!` or a similar macro, which means that they cannot observe the effects of the wrong flags (as `write!` creates a fresh Formatter instance). However, we include a test case. A manual check leads me to believe this is the only case where we failed to reset the flags appropriately, but I could have missed something.
2020-01-14Implement `finish_non_exhaustive` for `DebugStruct`.Richard Dodd-0/+56
2020-01-06Use Self instead of $typeLzu Tao-2/+2
2020-01-01Reset Formatter flags on exit from pad_integralMark Rousskov-3/+6
This fixes a bug where after calling pad_integral with appropriate flags, the fill and alignment flags would be set to '0' and 'Right' and left as such even after exiting pad_integral, which meant that future calls on the same Formatter would get incorrect flags reported. This is quite difficult to observe in practice, as almost all formatting implementations in practice don't call `Display::fmt` directly, but rather use `write!` or a similar macro, which means that they cannot observe the effects of the wrong flags (as `write!` creates a fresh Formatter instance). However, we include a test case.
2019-12-22Format the worldMark Rousskov-89/+55
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-7/+7
2019-12-19Rollup merge of #67253 - elichai:2019-12-fmt, r=Dylan-DPCMark Rousskov-44/+76
Add more delegations to the fmt docs and add doctests HI, this is a continuation to #67021 I replaced the `Debug` example with one that use the `Debug*` helpers so that padding etc will work too. I also added asserts for the doctests as @RalfJung asked :) The only thing I left with the `write!` macro is the `Display` example as I didn't know if there's a better way to do that. r? @QuietMisdreavus
2019-12-15Replace prints in fmt docs with assertsElichai Turkel-38/+64
2019-12-14Revert "Stabilize the `never_type`, written `!`."Niko Matsakis-2/+2
This reverts commit 15c30ddd69d6cc3fffe6d304c6dc968a5ed046f1.
2019-12-12Change fmt docs for more delegationsElichai Turkel-6/+12
2019-12-04Fix docs for formatting delegationsElichai Turkel-5/+6
2019-11-26Format libcore with rustfmtDavid Tolnay-149/+198
This commit applies rustfmt with default settings to files in src/libcore *that are not involved in any currently open PR* to minimize merge conflicts. The list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in `outstanding_files`, the relevant commands were: $ find src/libcore -name '*.rs' | xargs rustfmt --edition=2018 $ rg libcore outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libcore.
2019-11-21Stabilize the `never_type`, written `!`.Mazdak Farrokhzad-2/+2
2019-11-06Have tidy ensure that we document all `unsafe` blocks in libcoreOliver Scherer-0/+6
2019-10-22Apply clippy::redundant_pattern_matching suggestionMateusz Mikuła-1/+1
2019-10-17Rollup merge of #65478 - RalfJung:write, r=jonas-schievinkMazdak Farrokhzad-2/+2
fmt::Write is about string slices, not byte slices No idea why the docs talk about bytes, maybe a copy-paste error?
2019-10-16fmt::Write is about string slices, not byte slicesRalf Jung-2/+2
2019-10-10move debug_map assertions after check for errAshley Mannix-7/+9
2019-10-01Remove unneeded `fn main` blocks from docsLzu Tao-6/+4
2019-09-25Snap cfgs to new betaMark Rousskov-3/+1
2019-09-23Move `--cfg bootstrap` out of `rustc.rs`Alex Crichton-3/+3
Instead let's do this via `RUSTFLAGS` in `builder.rs`. Currently requires a submodule update of `stdarch` to fix a problem with previous compilers.