about summary refs log tree commit diff
path: root/src/libfmt_macros
AgeCommit message (Collapse)AuthorLines
2020-06-02Rename directories for some compiler crates from `libx` to `librustc_x`Vadim Petrochenkov-1136/+0
libarena -> librustc_arena libfmt_macros -> librustc_parse_format libgraphviz -> librustc_graphviz libserialize -> librustc_serialize
2020-05-29Improve inline asm error diagnosticsAmanieu d'Antras-1/+23
2020-05-18Fix testsAmanieu d'Antras-2/+2
2020-05-18Implement asm! in librustc_builtin_macrosAmanieu d'Antras-5/+154
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-1/+2
2020-03-06fix various typosMatthias Krüger-1/+1
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-3/+3
2019-12-30Make things build againVadim Petrochenkov-1/+1
2019-12-22Format the worldMark Rousskov-131/+132
2019-12-06Rename to `then_some` and `then`varkor-1/+1
2019-12-06Use `to_option` in various placesvarkor-5/+2
2019-11-28Allow any identifier as format arg nameDavid Tolnay-16/+17
Previously: error: invalid format string: invalid argument name `_x` --> src/main.rs:2:16 | 2 | println!("{_x}", a=0); | ^^ invalid argument name in format string | = note: argument names cannot start with an underscore Not supporting identifiers starting with underscore appears to have been an arbitrary limitation from 2013 in code that was most likely never reviewed: https://github.com/rust-lang/rust/pull/8245/files#diff-0347868ef389c805e97636623e4a4ea6R277 The error message was dutifully improved in #50610 but is there any reason that leading underscore would be a special case? This commit updates the format_args parser to accept identifiers with leading underscores.
2019-11-06Fix libfmt_macros testsEsteban Küber-26/+40
2019-11-05Point at formatting descriptor string when it is invalidEsteban Küber-0/+9
When a formatting string contains an invalid descriptor, point at it instead of the argument: ``` error: unknown format trait `foo` --> $DIR/ifmt-bad-arg.rs:86:17 | LL | println!("{:foo}", 1); | ^^^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait ```
2019-09-30Cleaned up a few doc comments in libfmt_macros.Alexander Regueiro-3/+3
2019-09-04flatten rustc_lexer::character_properties moduleAleksey Kladov-3/+2
On the call site, `rustc_lexer::is_whitespace` reads much better than `character_properties::is_whitespace`.
2019-09-04remove XID and Pattern_White_Space unicode tables from libcoreAleksey Kladov-6/+6
They are only used by rustc_lexer, and are not needed elsewhere. So we move the relevant definitions into rustc_lexer (while the actual unicode data comes from the unicode-xid crate) and make the rest of the compiler use it.
2019-08-03Rollup merge of #63121 - estebank:formatting-pos, r=alexcrichtonMazdak Farrokhzad-170/+235
On `format!()` arg count mismatch provide extra info When positional width and precision formatting flags are present in a formatting string that has an argument count mismatch, provide extra information pointing at them making it easiser to understand where the problem may lay: ``` error: 4 positional arguments in format string, but there are 3 arguments --> $DIR/ifmt-bad-arg.rs:78:15 | LL | println!("{} {:.*} {}", 1, 3.2, 4); | ^^ ^^--^ ^^ --- this parameter corresponds to the precision flag | | | this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected | = note: positional arguments are zero-based = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html error: 4 positional arguments in format string, but there are 3 arguments --> $DIR/ifmt-bad-arg.rs:81:15 | LL | println!("{} {:07$.*} {}", 1, 3.2, 4); | ^^ ^^-----^ ^^ --- this parameter corresponds to the precision flag | | | | | this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected | this width flag expects an `usize` argument at position 7, but there are 3 arguments | = note: positional arguments are zero-based = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html error: invalid reference to positional argument 7 (there are 3 arguments) --> $DIR/ifmt-bad-arg.rs:84:18 | LL | println!("{} {:07$} {}", 1, 3.2, 4); | ^^^--^ | | | this width flag expects an `usize` argument at position 7, but there are 3 arguments | = note: positional arguments are zero-based = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html ``` Fix #49384.
2019-07-30fix testsEsteban Küber-146/+187
2019-07-29review commentsEsteban Küber-9/+5
2019-07-29On `format!()` arg count mismatch provide extra infoEsteban Küber-24/+52
When positional width and precision formatting flags are present in a formatting string that has an argument count mismatch, provide extra information pointing at them making it easiser to understand where the problem may lay: ``` error: 4 positional arguments in format string, but there are 3 arguments --> $DIR/ifmt-bad-arg.rs:78:15 | LL | println!("{} {:.*} {}", 1, 3.2, 4); | ^^ ^^--^ ^^ --- this parameter corresponds to the precision flag | | | this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected | = note: positional arguments are zero-based = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html error: 4 positional arguments in format string, but there are 3 arguments --> $DIR/ifmt-bad-arg.rs:81:15 | LL | println!("{} {:07$.*} {}", 1, 3.2, 4); | ^^ ^^-----^ ^^ --- this parameter corresponds to the precision flag | | | | | this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected | this width flag expects an `usize` argument at position 7, but there are 3 arguments | = note: positional arguments are zero-based = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html error: 3 positional arguments in format string, but there are 3 arguments --> $DIR/ifmt-bad-arg.rs:84:15 | LL | println!("{} {:07$} {}", 1, 3.2, 4); | ^^ ^^---^ ^^ | | | this width flag expects an `usize` argument at position 7, but there are 3 arguments | = note: positional arguments are zero-based = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html ```
2019-07-29rustc: Compile the `fmt_macros` crate as an rlibAlex Crichton-1/+0
I think this was left out by accident from the "convert everything to rlibs" commit, there's no need for this to be a dylib just as everything else doesn't need to be a dylib!
2019-07-28Deny `unused_lifetimes` through rustbuildVadim Petrochenkov-2/+0
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-1/+0
rustbuild Remove some random unnecessary lint `allow`s
2019-07-22add rustc_private as a proper language feature gateAleksey Kladov-0/+1
At the moment, `rustc_private` as a (library) feature exists by accident: `char::is_xid_start`, `char::is_xid_continue` methods in libcore define it.
2019-07-07rustc: Remove `dylib` crate type from most rustc cratesAlex Crichton-0/+1
Now that procedural macros no longer link transitively to libsyntax, this shouldn't be needed any more! This commit is an experiment in removing all dynamic libraries from rustc except for librustc_driver itself. Let's see how far we can get with that!
2019-06-24Enable internal lints in bootstrapflip1995-1/+0
2019-06-16Separate libfmt_macros modulechansuke-245/+244
2019-06-12Rollup merge of #61568 - Mark-Simulacrum:symbol-fmt-macros, r=estebankMazdak Farrokhzad-66/+70
Use Symbol, Span in libfmt_macros I'm not super happy with this, personally, but I think it might be a decent start -- happy to take suggestions as to how to expand this or change things further. r? @estebank Fixes #60795
2019-06-11Add deny(unused_lifetimes) to all the crates that have deny(internal).Eduard-Mihai Burtescu-0/+1
2019-06-09Properly point at the last opening braceMark Rousskov-1/+1
2019-06-09Add comment about raw strings to self.styleMark Rousskov-0/+2
2019-06-09Introduce InnerSpan abstractionMark Rousskov-47/+42
This should be used when trying to get at subsets of a larger span, especially when the larger span is not available in the code attempting to work with those subsets (especially common in the fmt_macros crate). This is usually a good replacement for (BytePos, BytePos) and (usize, usize) tuples. This commit also removes from_inner_byte_pos, since it took usize arguments, which is error prone.
2019-06-09Use Symbol for named arguments in fmt_macrosMark Rousskov-15/+25
2019-06-09Inline raw methodMark Rousskov-6/+3
2019-04-17Deny `internal` in stage0Mateusz Mikuła-1/+1
2019-04-03Deny internal lints on two more cratesflip1995-0/+1
- libfmt_macros - librustdoc
2019-02-10Revert removed #![feature(nll)]Taiki Endo-0/+1
2019-02-07Remove images' url to make it work even without internet connectionGuillaume Gomez-3/+1
2019-02-03libfmt_macros => 2018Mazdak Farrokhzad-6/+8
2019-01-26Rollup merge of #57764 - Xanewok:tiny-tweaks, r=nikomatsakisMazdak Farrokhzad-0/+1
Fix some minor warnings Since apparently RLS works when initialized in the root repository (:tada:) I decided to fix some of the issues it caught. There are a lot of unused attribute warnings left on `rustc_on_unimplemented` and `rustc_layout_scalar_valid_range_start` but I imagine we can't do much about it due to 2-stage compilation?
2019-01-20Add missing #![feature(rustc_private)] annotationIgor Matuszewski-0/+1
2019-01-12Fix simple formatting optimizationShotaro Yamada-0/+9
name old2 ns/iter new2 ns/iter diff ns/iter diff % speedup fmt::write_str_macro1 12,295 12,308 13 0.11% x 1.00 fmt::write_str_macro2 24,079 21,451 -2,628 -10.91% x 1.12 fmt::write_str_macro_debug 238,363 230,807 -7,556 -3.17% x 1.03 fmt::write_str_ref 6,203 6,064 -139 -2.24% x 1.02 fmt::write_str_value 6,225 6,075 -150 -2.41% x 1.02 fmt::write_vec_macro1 17,144 17,121 -23 -0.13% x 1.00 fmt::write_vec_macro2 29,845 26,703 -3,142 -10.53% x 1.12 fmt::write_vec_macro_debug 248,840 242,117 -6,723 -2.70% x 1.03 fmt::write_vec_ref 5,954 6,438 484 8.13% x 0.92 fmt::write_vec_value 5,959 6,439 480 8.06% x 0.93
2018-12-26Point at correct span for arguments in format stringsEsteban Küber-4/+3
When a format string has escaped whitespace characters format arguments were shifted by one per each escaped character. Account for these escaped characters when synthesizing the spans. Fix #55155.
2018-12-26Various changes to string format diagnosticsEsteban Küber-40/+104
- Point at opening mismatched formatting brace - Account for differences between raw and regular strings - Account for differences between the code snippet and `InternedString` - Add more tests
2018-12-25Remove licensesMark Rousskov-10/+0
2018-10-03remove padding from multiline format string labelAndy Russell-1/+1
Fixes #53836.
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-1/+1
2018-09-11stabalize infer outlives requirements (RFC 2093).toidiu-1/+0
Co-authored-by: nikomatsakis
2018-08-24check that adding infer-outlives requirement to all crates worksNiko Matsakis-0/+1