Nicholas Nethercote
2620eb42d7
Re-export more rustc_span::symbol things from rustc_span.
...
`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-12-18 13:38:53 +11:00
Michael Goulet
c682aa162b
Reformat using the new identifier sorting from rustfmt
2024-09-22 19:11:29 -04:00
Kornel
88b9edc9db
fmt-debug option
...
Allows disabling `fmt::Debug` derive and debug formatting.
2024-08-28 23:32:40 +01:00
Nicholas Nethercote
84ac80f192
Reformat use declarations.
...
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
ninad
4c8d210ab8
Improve semantics of int_ty_max functions
2024-04-15 00:39:28 +05:30
ninad
757f5bb3dc
Fix formatting
2024-04-14 20:29:30 +05:30
ninad
857f5dd475
Don't inline integer literals when out of range
2024-04-14 20:17:44 +05:30
Rémy Rakic
8beec62315
do not eat nested exprs result in format args visitor
2024-03-18 09:27:47 +00:00
Jason Newcomb
e760c44063
Use ControlFlow in AST visitors.
2024-03-05 19:03:20 -05:00
Nicholas Nethercote
99472c7049
Remove Session methods that duplicate DiagCtxt methods.
...
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier
access.
2023-12-24 08:05:28 +11:00
surechen
40ae34194c
remove redundant imports
...
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-10 10:56:22 +08:00
Nicholas Nethercote
5d1d384443
Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug.
...
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug`
follows the pattern used everywhere else: `span_err`, `span_warning`,
etc.
2023-12-02 09:01:19 +11:00
Nilstrieb
21a870515b
Fix clippy::needless_borrow in the compiler
...
`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-11-21 20:13:40 +01:00
Michael Goulet
b2d2184ede
Format all the let chains in compiler
2023-10-13 08:59:36 +00:00
Nicholas Nethercote
a2051dd578
Optimize some alloc_from_iter call sites.
...
There's no need to collect an iterator into a `Vec`, or to call
`into_iter` at the call sites.
2023-10-03 18:12:37 +11:00
Mara Bos
d5843ddaf1
Limit lifetime of format_args!() with inlined args.
2023-05-09 16:08:40 +02:00
Matthias Krüger
1b262b8b56
Rollup merge of #110823 - compiler-errors:tweak-await-span, r=b-naber
...
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-05-01 01:09:47 +02:00
Michael Goulet
f0fc4f9acf
Tweak await span
2023-04-27 17:18:11 +00:00
Mara Bos
0a28977740
Restructure std::fmt::rt a bit.
...
This moves more of the internal/lang items into the private rt module.
2023-04-24 16:16:14 +02:00
Mara Bos
5cf3cbf3b7
Remove "V1" from ArgumentsV1 and FlagsV1.
2023-04-24 16:16:14 +02:00
Mara Bos
441682cca9
Update comments in format args lowering.
...
These lang items have been moved/renamed.
2023-04-20 18:09:32 +02:00
Mara Bos
1b3fda4978
Use span of placeholders in format_args!() expansion.
2023-03-27 14:53:48 +02:00
Mara Bos
995e57b89e
Gate fmt args flattening behind -Zflatten-format-args.
2023-03-16 11:21:50 +01:00
Mara Bos
f2f6bcc499
Don't allow new const panic through format flattening.
...
panic!("a {}", "b") is still not allowed in const,
even if the hir flattens to panic!("a b").
2023-03-16 11:21:50 +01:00
Mara Bos
6a535dfff4
Also inline integer literals into format_args!().
2023-03-16 11:21:50 +01:00
Mara Bos
df8c14ca61
Check all arg indexes before removing inlined format args.
2023-03-16 11:21:50 +01:00
Mara Bos
0554401fcc
Remove unreachable branch in format_args ast lowering.
2023-03-16 11:21:48 +01:00
Mara Bos
b6c988b041
Fix argument index remapping in format_args flattening.
2023-03-16 11:19:31 +01:00
Mara Bos
b7678d48b8
Only inline {} string literals in format_args.
...
Placeholders like {:123} would incorrectly get inlined.
2023-03-16 11:19:31 +01:00
Mara Bos
caa6ba9e86
Support flattening/inlining format_args through & and ().
...
E.g. format_args!("{}", &(format_args!("abc"))).
2023-03-16 11:19:31 +01:00
Mara Bos
85ef2f0cfe
Inline string literals into format_args!().
2023-03-16 11:19:31 +01:00
Mara Bos
94ad7e881d
Coalesce adjacent literal pieces in expand_format_args.
2023-03-16 11:19:31 +01:00
Mara Bos
a769b30a93
Flatten nested format_args!() into one.
2023-03-16 11:19:30 +01:00
Michael Goulet
c0e58c3420
Add ErrorGuaranteed to HIR ExprKind::Err
2023-02-25 19:46:36 +00:00
Mara Bos
21cf9dbc85
Destructure format_options in make_format_spec.
2023-01-27 11:43:38 +01:00
Mara Bos
0abf8a0617
Replace format flags u32 by enums and bools.
2023-01-27 08:53:39 +01:00
Mara Bos
9f2ba59647
Change not-so-permanent link to a more permanent link.
2023-01-13 22:23:59 +01:00
Mara Bos
cd8ec6c787
Add note on optimization in format args ast lowering.
2023-01-12 20:14:31 +01:00
Mara Bos
8a23ad17f8
Update comments in rustc_ast_lowering/src/format.rs.
2023-01-12 20:06:38 +01:00
Mara Bos
298e160dc8
Assume there are no macros left in ast lowering.
2023-01-12 19:58:49 +01:00
Mara Bos
bcf388f4ac
Update outdated comment.
2023-01-12 00:39:46 +01:00
Mara Bos
a4dbcb525b
Expand format_args!() in rust_ast_lowering.
2023-01-12 00:25:45 +01:00