about summary refs log tree commit diff
path: root/src/tools/rustfmt
AgeCommit message (Collapse)AuthorLines
2023-11-04fixes for rustfmt + ast visitorDinu Blanovschi-2/+2
2023-10-27Add gen blocks to ast and do some broken ast loweringOli Scherer-6/+6
2023-10-23Auto merge of #116033 - bvanjoi:fix-116032, r=petrochenkovbors-0/+2
report `unused_import` for empty reexports even it is pub Fixes #116032 An easy fix. r? `@petrochenkov` (Discovered this issue while reviewing #115993.)
2023-10-22Merge commit '81fe905ca83cffe84322f27ca43950b617861ff7' into rustfmt-syncCaleb Cartwright-788/+2818
2023-10-22use visibility to check unused imports and delete some stmtsbohan-0/+2
2023-10-20Rename lots of files that had `generator` in their nameOli Scherer-0/+0
2023-10-20s/generator/coroutine/Oli Scherer-3/+3
2023-10-04Fix spans for comments in rustfmtMichael Goulet-1/+2
2023-09-11Update tools and fulldeps testsMatthew Jasper-1/+1
2023-09-03Use relative positions inside a SourceFile.Camille GILLOT-1/+1
2023-08-30Use conditional synchronization for LockJohn Kåre Alsaker-7/+7
2023-08-24Parse unnamed fields and anonymous structs or unionsFrank King-0/+21
Anonymous structs or unions are only allowed in struct field definitions. Co-authored-by: carbotaniuman <41451839+carbotaniuman@users.noreply.github.com>
2023-08-04Auto merge of #114481 - matthiaskrgr:rollup-58pczpl, r=matthiaskrgrbors-5/+5
Rollup of 9 pull requests Successful merges: - #113945 (Fix wrong span for trait selection failure error reporting) - #114351 ([rustc_span][perf] Remove unnecessary string joins and allocs.) - #114418 (bump parking_lot to 0.12) - #114434 (Improve spans for indexing expressions) - #114450 (Fix ICE failed to get layout for ReferencesError) - #114461 (Fix unwrap on None) - #114462 (interpret: add mplace_to_ref helper method) - #114472 (Reword `confusable_idents` lint) - #114477 (Account for `Rc` and `Arc` when suggesting to clone) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-04Rollup merge of #114434 - Nilstrieb:indexing-spans, r=est31Matthias Krüger-5/+5
Improve spans for indexing expressions fixes #114388 Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location. This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR. r? compiler-errors
2023-08-04Auto merge of #114104 - oli-obk:syn2, r=compiler-errorsbors-13/+2
Lots of tiny incremental simplifications of `EmitterWriter` internals ignore the first commit, it's https://github.com/rust-lang/rust/pull/114088 squashed and rebased, but it's needed to use to use `derive_setters`, as they need a newer `syn` version. Then this PR starts out with removing many arguments that are almost always defaulted to `None` or `false` and replace them with builder methods that can set these fields in the few cases that want to set them. After that it's one commit after the other that removes or merges things until everything becomes some very simple trait objects
2023-08-04Improve spans for indexing expressionsNilstrieb-5/+5
Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location. This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR.
2023-08-03Rollup merge of #114300 - MU001999:fix/turbofish-pat, r=estebankMatthias Krüger-1/+1
Suggests turbofish in patterns Fixes #114112 r? ```@estebank```
2023-08-03Remove `MacDelimiter`.Nicholas Nethercote-6/+2
It's the same as `Delimiter`, minus the `Invisible` variant. I'm generally in favour of using types to make impossible states unrepresentable, but this one feels very low-value, and the conversions between the two types are annoying and confusing. Look at the change in `src/tools/rustfmt/src/expr.rs` for an example: the old code converted from `MacDelimiter` to `Delimiter` and back again, for no good reason. This suggests the author was confused about the types.
2023-08-03Fix rustfmt depMu001999-1/+1
2023-07-31Use builder pattern instead of lots of arguments for `EmitterWriter::new`Oli Scherer-13/+2
2023-07-28Auto merge of #114115 - nnethercote:less-token-tree-cloning, r=petrochenkovbors-14/+14
Less `TokenTree` cloning `TokenTreeCursor` has this comment on it: ``` // FIXME: Many uses of this can be replaced with by-reference iterator to avoid clones. ``` This PR completes that FIXME. It doesn't have much perf effect, but at least we now know that. r? `@petrochenkov`
2023-07-27Avoid `into_trees` usage in rustfmt.Nicholas Nethercote-14/+14
Token tree cloning is only needed in one place.
2023-07-26Unite bless environment variables under `RUSTC_BLESS`Trevor Gross-5/+3
Currently, Clippy, Miri, Rustfmt, and rustc all use an environment variable to indicate that output should be blessed, but they use different variable names. In order to improve consistency, this patch applies the following changes: - Emit `RUSTC_BLESS` within `prepare_cargo_test` so it is always available - Change usage of `MIRI_BLESS` in the Miri subtree to use `RUSTC_BLESS` - Change usage of `BLESS` in the Clippy subtree to `RUSTC_BLESS` - Change usage of `BLESS` in the Rustfmt subtree to `RUSTC_BLESS` - Adjust the blessable test in `rustc_errors` to use this same convention - Update documentation where applicable Any tools that uses `RUSTC_BLESS` should check that it is set to any value other than `"0"`.
2023-07-26Make `x test src/tools/rustfmt --bless` format rustfmt with the freshly ↵Oli Scherer-9/+13
built in-tree version
2023-07-25Use a builder instead of boolean/option argumentsOli Scherer-4/+1
2023-07-19On nightly, dump ICE backtraces to diskEsteban Küber-1/+2
Implement rust-lang/compiler-team#578. When an ICE is encountered on nightly releases, the new rustc panic handler will also write the contents of the backtrace to disk. If any `delay_span_bug`s are encountered, their backtrace is also added to the file. The platform and rustc version will also be collected.
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>