about summary refs log tree commit diff
path: root/src/tools/rustfmt
AgeCommit message (Collapse)AuthorLines
2022-03-29Merge commit '5ff7b632a95bac6955611d85040859128902c580' into ↵Caleb Cartwright-235/+2013
sync-rustfmt-subtree
2022-03-20Take &mut Diagnostic in emit_diagnostic.Camille GILLOT-2/+4
Taking a Diagnostic by move would break the usual pattern `diag.label(..).emit()`.
2022-03-17Rollup merge of #94960 - codehorseman:master, r=oli-obkDylan DPC-2/+2
Fix many spelling mistakes Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16rustc_error: make ErrorReported impossible to constructmark-3/+3
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-2/+2
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-15Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuberbors-4/+8
More robust fallback for `use` suggestion Our old way to suggest where to add `use`s would first look for pre-existing `use`s in the relevant crate/module, and if there are *no* uses, it would fallback on trying to use another item as the basis for the suggestion. But this was fragile, as illustrated in issue #87613 This PR instead identifies span of the first token after any inner attributes, and uses *that* as the fallback for the `use` suggestion. Fix #87613
2022-03-07placate rustfmt in rustfmt.Felix S. Klock II-9/+3
2022-03-06Rollup merge of #94617 - pierwill:update-itertools, r=Mark-SimulacrumMatthias Krüger-1/+1
Update `itertools` Update to 0.10.1
2022-03-05Change syntax for TyAlias where clausesJack Huey-34/+74
2022-03-04Placate tidy in submodule.Felix S. Klock II-2/+11
2022-03-04Update `itertools`pierwill-1/+1
Update to 0.10.1
2022-03-03Adjusted diagnostic output so that if there is no `use` in a item sequence,Felix S. Klock II-2/+2
then we just suggest the first legal position where you could inject a use. To do this, I added `inject_use_span` field to `ModSpans`, and populate it in parser (it is the span of the first token found after inner attributes, if any). Then I rewrote the use-suggestion code to utilize it, and threw out some stuff that is now unnecessary with this in place. (I think the result is easier to understand.) Then I added a test of issue 87613.
2022-03-03Associate multiple with a crate too.Felix S. Klock II-3/+4
2022-03-03refactor: prepare to associate multiple spans with a module.Felix S. Klock II-2/+2
2022-02-25Enable rustc_pass_by_value for SpanMark Rousskov-2/+2
2022-02-23rustc_errors: take `self` by value in `DiagnosticBuilder::cancel`.Eduard-Mihai Burtescu-16/+5
2022-02-23rustc_errors: add `downgrade_to_delayed_bug` to `Diagnostic` itself.Eduard-Mihai Burtescu-11/+7
2022-01-24rustc_errors: only box the `diagnostic` field in `DiagnosticBuilder`.Eduard-Mihai Burtescu-1/+1
2022-01-17Add term to ExistentialProjectionkadmin-1/+1
Also prevent ICE when adding a const in associated const equality.
2022-01-17Add termkadmin-6/+8
Instead of having a separate enum variant for types and consts have one but have either a const or type.
2022-01-17add eq constraints on associated constantskadmin-8/+9
2022-01-17Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieubors-4/+1
Remove deprecated LLVM-style inline assembly The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it is time to remove `llvm_asm!` to avoid continued maintenance cost. Closes #70173. Closes #92794. Closes #87612. Closes #82065. cc `@rust-lang/wg-inline-asm` r? `@Amanieu`
2022-01-14fix(rustfmt): resolve generated file formatting issueCaleb Cartwright-5/+25
2022-01-12Remove LLVM-style inline assembly from rustfmtTomasz Miąsko-4/+1
2022-01-09Compute most of Public/Exported access level in rustc_resolveLamb-0/+1
Mak DefId to AccessLevel map in resolve for export hir_id to accesslevel in resolve and applied in privacy using local def id removing tracing probes making function not recursive and adding comments Move most of Exported/Public res to rustc_resolve moving public/export res to resolve fix missing stability attributes in core, std and alloc move code to access_levels.rs return for some kinds instead of going through them Export correctness, macro changes, comments add comment for import binding add comment for import binding renmae to access level visitor, remove comments, move fn as closure, remove new_key fmt fix rebase fix rebase fmt fmt fix: move macro def to rustc_resolve fix: reachable AccessLevel for enum variants fmt fix: missing stability attributes for other architectures allow unreachable pub in rustfmt fix: missing impl access level + renaming export to reexport Missing impl access level was found thanks to a test in clippy
2021-12-29Merge commit '4a053f206fd6799a25823c307f7d7f9d897be118' into ↵Caleb Cartwright-410/+710
sync-rustfmt-subtree
2021-12-15Remove unnecessary sigils around `Ident::as_str()` calls.Nicholas Nethercote-7/+7
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-4/+4
2021-12-15Remove `SymbolStr`.Nicholas Nethercote-6/+8
By changing `as_str()` to take `&self` instead of `self`, we can just return `&str`. We're still lying about lifetimes, but it's a smaller lie than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-02Merge commit '8da837185714cefbb261e93e9846afb11c1dc60e' into ↵Caleb Cartwright-435/+1730
sync-rustfmt-subtree
2021-11-24Change how the fn params span is calculatedEsteban Kuber-10/+2
Use the available Generics span field to avoid issues with `T: Fn()` bounds. This is necessary to land #85346.
2021-11-07Merge commit 'ea199bacef07213dbe008841b89c450e3bf0c638' into rustfmt-syncCaleb Cartwright-372/+670
2021-11-07ast: Fix naming conventions in AST structuresVadim Petrochenkov-56/+86
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-10-21fix doc issue in rustfmtCaleb Cartwright-1/+1
2021-10-20ensure cargo-fmt tests are excluded from root workspaceCaleb Cartwright-0/+2
2021-10-20Merge commit 'efa8f5521d3813cc897ba29ea0ef98c7aef66bb6' into rustfmt-subtreeCaleb Cartwright-918/+2902
2021-09-20Migrate to 2021Mark Rousskov-1/+1
2021-09-15Rollup merge of #88775 - pnkfelix:revert-anon-union-parsing, r=davidtwcoManish Goregaokar-65/+12
Revert anon union parsing Revert PR #84571 and #85515, which implemented anonymous union parsing in a manner that broke the context-sensitivity for the `union` keyword and thus broke stable Rust code. Fix #88583.
2021-09-11Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkovbors-3/+8
Encode spans relative to the enclosing item The aim of this PR is to avoid recomputing queries when code is moved without modification. MCP at https://github.com/rust-lang/compiler-team/issues/443 This is achieved by : 1. storing the HIR owner LocalDefId information inside the span; 2. encoding and decoding spans relative to the enclosing item in the incremental on-disk cache; 3. marking a dependency to the `source_span(LocalDefId)` query when we translate a span from the short (`Span`) representation to its explicit (`SpanData`) representation. Since all client code uses `Span`, step 3 ensures that all manipulations of span byte positions actually create the dependency edge between the caller and the `source_span(LocalDefId)`. This query return the actual absolute span of the parent item. As a consequence, any source code motion that changes the absolute byte position of a node will either: - modify the distance to the parent's beginning, so change the relative span's hash; - dirty `source_span`, and trigger the incremental recomputation of all code that depends on the span's absolute byte position. With this scheme, I believe the dependency tracking to be accurate. For the moment, the spans are marked during lowering. I'd rather do this during def-collection, but the AST MutVisitor is not practical enough just yet. The only difference is that we attach macro-expanded spans to their expansion point instead of the macro itself.
2021-09-10Keep a parent LocalDefId in SpanData.Camille GILLOT-3/+8
2021-09-09Ignore automatically derived impls of `Clone` and `Debug` in dead code analysisFabian Wolff-31/+6
2021-09-09Revert "Allow formatting `Anonymous{Struct, Union}` declarations"Felix S. Klock II-65/+12
This reverts commit 64acb7d92135ae722dfce89f0ca9d7cf6576de66.
2021-09-06Auto merge of #88493 - chenyukang:fix-duplicated-diagnostic, r=estebankbors-0/+1
Fix #88256 remove duplicated diagnostics Fix #88256
2021-09-04Fix #88256, remove duplicated diagnosticyukang-0/+1
2021-09-03Detect bare blocks with type ascription that were meant to be a `struct` literalEsteban Kuber-0/+1
Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-08-30Temporary fix rustfmt for let-elseCameron Steffen-4/+11
2021-08-27Fix rustfmt testDeadbeef-21/+9
2021-08-27Introduce `~const`Deadbeef-14/+12
- [x] Removed `?const` and change uses of `?const` - [x] Added `~const` to the AST. It is gated behind const_trait_impl. - [x] Validate `~const` in ast_validation. - [ ] Add enum `BoundConstness` to the HIR. (With variants `NotConst` and `ConstIfConst` allowing future extensions) - [ ] Adjust trait selection and pre-existing code to use `BoundConstness`. - [ ] Optional steps (*for this PR, obviously*) - [ ] Fix #88155 - [ ] Do something with constness bounds in chalk
2021-08-22Fix typos “an”→“a” and a few different ones that appeared in the ↵Frank Steffahn-4/+4
same search
2021-08-22Fix more “a”/“an” typosFrank Steffahn-1/+1