about summary refs log tree commit diff
path: root/src/tools/rustfmt
AgeCommit message (Collapse)AuthorLines
2023-07-01Merge commit 'dca1cf90ad6b8e45afbed2061803befbb2d159e9' into sync-rustfmtCaleb Cartwright-49/+1081
2023-06-21Rollup merge of #112790 - WaffleLapkin:syntactically, r=NilstriebNilstrieb-0/+2
Syntactically accept `become` expressions (explicit tail calls experiment) This adds `ast::ExprKind::Become`, implements parsing and properly gates the feature. cc `@scottmcm`
2023-06-19Merge commit '3f7c366fc0464e01ddcaefbd70647cb3da4202be' into rustfmt-syncCaleb Cartwright-366/+1622
2023-06-19Implement `become` expression formatting in rustfmtMaybe Waffle-0/+2
2023-05-06Rollup merge of #110989 - jyn514:bug-report-url, r=WaffleLapkinMatthias Krüger-0/+9
Make the BUG_REPORT_URL configurable by tools This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy the entire hook implementation. I haven't changed clippy in case they want to make the change upstream instead of the subtree, but I'm happy to do so here if the maintainers want - cc ````@rust-lang/clippy```` Fixes https://github.com/rust-lang/rust/issues/109486.
2023-05-02Rustfmt support for negative bounds, testMichael Goulet-2/+17
2023-05-02Make tools happyMichael Goulet-0/+2
2023-05-01Make the BUG_REPORT_URL configurable by toolsjyn-0/+9
This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy the entire hook implementation. - Switch clippy to the new hook This also adds a `extra_info` callback so clippy can include its own version number, which differs from rustc's. - Call `install_ice_hook` in rustfmt
2023-05-01remove rustfmt testcase for type ascriptionyukang-23/+0
2023-05-01fix testsyukang-42/+27
2023-04-27Tweak await spanMichael Goulet-4/+4
2023-04-21rustfmt fmtDrMeepster-1/+3
2023-04-21minor tweaksDrMeepster-2/+1
2023-04-21offset_ofDrMeepster-0/+2
2023-04-04box a bunch of large typesOli Scherer-13/+13
2023-04-04Split out ast::ItemKind::Const into its own structOli Scherer-4/+4
2023-04-04rust-analyzer guided tuple field to named fieldOli Scherer-1/+1
2023-04-04rust-analyzer guided enum variant structificationOli Scherer-1/+1
2023-03-27Rollup merge of #109354 - Swatinem:rm-closureid, r=compiler-errorsGuillaume Gomez-1/+1
Remove the `NodeId` of `ast::ExprKind::Async` This is a followup to https://github.com/rust-lang/rust/pull/104833#pullrequestreview-1314537416. In my original attempt, I was using `LoweringContext::expr`, which was not correct as it creates a fresh `DefId`. It now uses the correct `DefId` for the wrapping `Expr`, and also makes forwarding `#[track_caller]` attributes more explicit.
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-20/+5
2023-03-19Remove the `NodeId` of `ast::ExprKind::Async`Arpad Borsos-1/+1
2023-03-12Remove `box_syntax` from AST and use in toolsclubby789-9/+0
2023-03-12Remove uses of `box_syntax` in rustc and toolsclubby789-37/+0
2023-02-22various: translation resources from cg backendDavid Wood-2/+4
Extend `CodegenBackend` trait with a function returning the translation resources from the codegen backend, which can be added to the complete list of resources provided to the emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22errors: generate typed identifiers in each crateDavid Wood-1/+1
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-21Use `ThinVec` in a few more AST types.Nicholas Nethercote-7/+9
2023-02-21Use `ThinVec` in `ast::Block`.Nicholas Nethercote-1/+2
2023-02-21Use `ThinVec` in various AST types.Nicholas Nethercote-1/+4
This commit changes the sequence parsers to produce `ThinVec`, which triggers numerous conversions.
2023-02-09Introduce `-Zterminal-urls` to use OSC8 for error codesEsteban Küber-1/+2
Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-03Rename `Cursor`/`CursorRef` as `TokenTreeCursor`/`RefTokenTreeCursor`.Nicholas Nethercote-4/+4
This makes it clear they return token trees, and makes for a nice comparison against `TokenCursor` which returns tokens.
2023-01-26Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obkbors-1/+5
Move format_args!() into AST (and expand it during AST lowering) Implements https://github.com/rust-lang/compiler-team/issues/541 This moves FormatArgs from rustc_builtin_macros to rustc_ast_lowering. For now, the end result is the same. But this allows for future changes to do smarter things with format_args!(). It also allows Clippy to directly access the ast::FormatArgs, making things a lot easier. This change turns the format args types into lang items. The builtin macro used to refer to them by their path. After this change, the path is no longer relevant, making it easier to make changes in `core`. This updates clippy to use the new language items, but this doesn't yet make clippy use the ast::FormatArgs structure that's now available. That should be done after this is merged.
2023-01-24Merge commit '1d8491b120223272b13451fc81265aa64f7f4d5b' into sync-from-rustfmtCaleb Cartwright-187/+2591
2023-01-12parse const closuresDeadbeef-3/+17
2023-01-12Update rustfmt for ast::ExprKind::FormatArgs.Mara Bos-1/+5
Rustfmt doesn't expand macros, so that's easy: FormatArgs nodes do not occur in the unexpanded AST.
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-4/+4
2023-01-05Detect closures assigned to binding in blockEsteban Küber-0/+1
Fix #58497.
2022-12-31Add missing extern crate rustc_driverbjorn3-0/+5
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-2/+2
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-12Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkovbors-5/+7
Remove `token::Lit` from `ast::MetaItemLit`. Currently `ast::MetaItemLit` represents the literal kind twice. This PR removes that redundancy. Best reviewed one commit at a time. r? `@petrochenkov`
2022-12-03Rollup merge of #104199 - SarthakSingh31:issue-97417-1, r=cjgillotMatthias Krüger-0/+1
Keep track of the start of the argument block of a closure This removes a call to `tcx.sess.source_map()` from [compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs](https://github.com/rust-lang/rust/compare/master...SarthakSingh31:issue-97417-1?expand=1#diff-8406bbc0d0b43d84c91b1933305df896ecdba0d1f9269e6744f13d87a2ab268a) as required by #97417. VsCode automatically applied `rustfmt` to the files I edited under `src/tools`. I can undo that if its a problem. r? `@cjgillot`
2022-12-02Remove `token::Lit` from `ast::MetaItemLit`.Nicholas Nethercote-5/+7
`token::Lit` contains a `kind` field that indicates what kind of literal it is. `ast::MetaItemLit` currently wraps a `token::Lit` but also has its own `kind` field. This means that `ast::MetaItemLit` encodes the literal kind in two different ways. This commit changes `ast::MetaItemLit` so it no longer wraps `token::Lit`. It now contains the `symbol` and `suffix` fields from `token::Lit`, but not the `kind` field, eliminating the redundancy.
2022-12-01rustc_ast_lowering: Stop lowering imports into multiple itemsVadim Petrochenkov-1/+1
Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-11-28Keep track of the start of the argument block of a closureSarthak Singh-0/+1
2022-11-28Rename `NestedMetaItem::[Ll]iteral` as `NestedMetaItem::[Ll]it`.Nicholas Nethercote-7/+5
We already use a mix of `Literal` and `Lit`. The latter is better because it is shorter without causing any ambiguity.
2022-11-28Rename `ast::Lit` as `ast::MetaItemLit`.Nicholas Nethercote-7/+16
2022-11-23Fix rustfmtEsteban Küber-1/+1
2022-11-22Split `MacArgs` in two.Nicholas Nethercote-6/+6
`MacArgs` is an enum with three variants: `Empty`, `Delimited`, and `Eq`. It's used in two ways: - For representing attribute macro arguments (e.g. in `AttrItem`), where all three variants are used. - For representing function-like macros (e.g. in `MacCall` and `MacroDef`), where only the `Delimited` variant is used. In other words, `MacArgs` is used in two quite different places due to them having partial overlap. I find this makes the code hard to read. It also leads to various unreachable code paths, and allows invalid values (such as accidentally using `MacArgs::Empty` in a `MacCall`). This commit splits `MacArgs` in two: - `DelimArgs` is a new struct just for the "delimited arguments" case. It is now used in `MacCall` and `MacroDef`. - `AttrArgs` is a renaming of the old `MacArgs` enum for the attribute macro case. Its `Delimited` variant now contains a `DelimArgs`. Various other related things are renamed as well. These changes make the code clearer, avoids several unreachable paths, and disallows the invalid values.
2022-11-17Box `ExprKind::{Closure,MethodCall}`, and `QSelf` in expressions, types, and ↵Nicholas Nethercote-44/+49
patterns.
2022-11-16Use `token::Lit` in `ast::ExprKind::Lit`.Nicholas Nethercote-21/+26
Instead of `ast::Lit`. Literal lowering now happens at two different times. Expression literals are lowered when HIR is crated. Attribute literals are lowered during parsing. This commit changes the language very slightly. Some programs that used to not compile now will compile. This is because some invalid literals that are removed by `cfg` or attribute macros will no longer trigger errors. See this comment for more details: https://github.com/rust-lang/rust/pull/102944#issuecomment-1277476773
2022-11-11Introduce `ExprKind::IncludedBytes`clubby789-0/+2