about summary refs log tree commit diff
path: root/src/libcore/fmt/mod.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-2280/+0
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-2/+16
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-2/+16
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-15Formatter::sign is &'static strMark Rousskov-3/+3
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-01-31Drop cfg(bootstrap) codeMark Rousskov-12/+1
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-8/+11
The formatting infrastructure stopped emitting these a while back, and in removing them we can simplify related code.
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-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-112/+112
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/+2
2019-10-22Apply clippy::redundant_pattern_matching suggestionMateusz Mikuła-1/+1
2019-10-16fmt::Write is about string slices, not byte slicesRalf Jung-2/+2
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.
2019-08-30Add a "diagnostic item" schemeOliver Scherer-1/+2
This allows lints and other diagnostics to refer to items by a unique ID instead of relying on whacky path resolution schemes that may break when items are relocated.
2019-08-17Make built-in derives opaque macrosMatthew Jasper-1/+1
2019-08-14Handle cfg(bootstrap) throughoutMark Rousskov-2/+0
2019-08-10Give built-in macros stable addresses in the standard libraryVadim Petrochenkov-0/+15
2019-07-27Remove run-pass test suitesVadim Petrochenkov-1/+1
2019-06-23Fix meta-variable binding errors in macrosJulien Cretin-4/+4
The errors are either: - The meta-variable used in the right-hand side is not bound (or defined) in the left-hand side. - The meta-variable used in the right-hand side does not repeat with the same kleene operator as its binder in the left-hand side. Either it does not repeat enough, or it uses a different operator somewhere. This change should have no semantic impact.
2019-05-19Fix data types indicationVeryTastyTomato-2/+2
Fix the data types indication in basic examples of the Trait std::fmt::LowerExp and std::fmt::UpperExp. Since there aren’t any type annotation on the let statement using the number 42.0, they are of type f64 according to The Book: https://doc.rust-lang.org/book/ch03-02-data-types.html#floating-point-types
2019-04-19libcore: deny more...Mazdak Farrokhzad-63/+63
2019-04-18libcore => 2018Taiki Endo-8/+8
2019-02-13Rollup merge of #58272 - fitzgen:num-format-code-size, r=Mark-SimulacrumMazdak Farrokhzad-39/+62
Cut down on number formating code size r? @alexcrichton
2019-02-10libs: doc commentsAlexander Regueiro-2/+2
2019-02-08Use write_char for writing padding charactersNick Fitzgerald-22/+8
Removes some unsafe *and* saves almost half a kilobyte of code size.