about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/format.rs
AgeCommit message (Collapse)AuthorLines
2025-08-26Remove 1-argument special case from format_args!().Mara Bos-20/+0
The argument needs to be lifetime-extended, so this special case isn't actually perfectly equivalent to the general case.
2025-07-28Complete span lowering.Camille GILLOT-0/+2
2025-07-07compiler: Parse `p-` specs in datalayout string, allow definition of custom ↵Edoardo Marangoni-2/+2
default data address space
2025-06-22Implement DesugaringKind::FormatLiteralmejrs-1/+8
2025-06-19Use expr_ref.Mara Bos-2/+1
2025-06-18Fix span of AddrOf in format_args!() expansion.Mara Bos-1/+1
Diagnostics should know that the `&` for arguments in format_args!() come from the macro expansion rather than from the original source.
2025-06-18Allow storing `format_args!()` in `let`.Mara Bos-129/+78
This uses `super let` to allow let f = format_args!("Hello {}", world); println!("{f}"); to work.
2025-05-22Rename `kw::Empty` as `sym::empty`.Nicholas Nethercote-2/+2
Because the empty string is not a keyword.
2025-03-30Simplify expansion for format_args!().Mara Bos-15/+13
Instead of calling new(), we can just use a struct expression directly. Before: Placeholder::new(…, …, …, …) After: Placeholder { position: …, flags: …, width: …, precision: …, }
2025-03-12Reduce FormattingOptions to 64 bits.Mara Bos-19/+21
2025-03-10Limit formatting width and precision to 16 bits.Mara Bos-1/+1
2025-02-08Rustfmtbjorn3-3/+6
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-8/+5
2024-08-28fmt-debug optionKornel-2/+6
Allows disabling `fmt::Debug` derive and debug formatting.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-9/+7
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-04-15Improve semantics of int_ty_max functionsninad-34/+26
2024-04-14Fix formattingninad-1/+3
2024-04-14Don't inline integer literals when out of rangeninad-77/+123
2024-03-18do not eat nested exprs result in format args visitorRémy Rakic-2/+1
2024-03-05Use `ControlFlow` in AST visitors.Jason Newcomb-8/+11
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-2/+2
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-10remove redundant importssurechen-1/+1
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-2/+2
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-2/+2
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-10-13Format all the let chains in compilerMichael Goulet-2/+5
2023-10-03Optimize some `alloc_from_iter` call sites.Nicholas Nethercote-29/+18
There's no need to collect an iterator into a `Vec`, or to call `into_iter` at the call sites.
2023-05-09Limit lifetime of format_args!() with inlined args.Mara Bos-1/+24
2023-05-01Rollup merge of #110823 - compiler-errors:tweak-await-span, r=b-naberMatthias Krüger-1/+1
Tweak await span to not contain dot Fixes a discrepancy between method calls and await expressions where the latter are desugared to have a span that *contains* the dot (i.e. `.await`) but method call identifiers don't contain the dot. This leads to weird suggestions suggestions in borrowck -- see linked issue. Fixes #110761 This mostly touches a bunch of tests to tighten their `await` span.
2023-04-27Tweak await spanMichael Goulet-1/+1
2023-04-24Restructure std::fmt::rt a bit.Mara Bos-1/+1
This moves more of the internal/lang items into the private rt module.
2023-04-24Remove "V1" from ArgumentsV1 and FlagsV1.Mara Bos-9/+9
2023-04-20Update comments in format args lowering.Mara Bos-7/+7
These lang items have been moved/renamed.
2023-03-27Use span of placeholders in format_args!() expansion.Mara Bos-23/+43
2023-03-16Gate fmt args flattening behind -Zflatten-format-args.Mara Bos-2/+5
2023-03-16Don't allow new const panic through format flattening.Mara Bos-1/+17
panic!("a {}", "b") is still not allowed in const, even if the hir flattens to panic!("a b").
2023-03-16Also inline integer literals into format_args!().Mara Bos-5/+18
2023-03-16Check all arg indexes before removing inlined format args.Mara Bos-13/+15
2023-03-16Remove unreachable branch in format_args ast lowering.Mara Bos-19/+8
2023-03-16Fix argument index remapping in format_args flattening.Mara Bos-28/+36
2023-03-16Only inline `{}` string literals in format_args.Mara Bos-0/+1
Placeholders like {:123} would incorrectly get inlined.
2023-03-16Support flattening/inlining format_args through & and ().Mara Bos-6/+12
E.g. format_args!("{}", &(format_args!("abc"))).
2023-03-16Inline string literals into format_args!().Mara Bos-3/+61
2023-03-16Coalesce adjacent literal pieces in expand_format_args.Mara Bos-16/+16
2023-03-16Flatten nested format_args!() into one.Mara Bos-2/+100
2023-02-25Add ErrorGuaranteed to HIR ExprKind::ErrMichael Goulet-3/+16
2023-01-27Destructure format_options in make_format_spec.Mara Bos-11/+21
2023-01-27Replace format flags u32 by enums and bools.Mara Bos-1/+8
2023-01-13Change not-so-permanent link to a more permanent link.Mara Bos-1/+1
2023-01-12Add note on optimization in format args ast lowering.Mara Bos-0/+3