about summary refs log tree commit diff
path: root/src/tools/rustfmt
AgeCommit message (Collapse)AuthorLines
2022-07-12Add rustfmt test for formatting `for<>` before closuresMaybe Waffle-0/+16
2022-07-12implement rustfmt formatting for `for<>` closure bindersMaybe Waffle-13/+40
2022-07-02ast: Add span to `Extern`Nixon Enraght-Moony-3/+3
2022-06-22Merge commit 'c4416f20dcaec5d93077f72470e83e150fb923b1' into sync-rustfmtCaleb Cartwright-11633/+533
2022-06-16Rollup merge of #97757 - xFrednet:rfc-2383-expect-with-force-warn, ↵Matthias Krüger-4/+4
r=wesleywiser,flip1995 Support lint expectations for `--force-warn` lints (RFC 2383) Rustc has a `--force-warn` flag, which overrides lint level attributes and forces the diagnostics to always be warn. This means, that for lint expectations, the diagnostic can't be suppressed as usual. This also means that the expectation would not be fulfilled, even if a lint had been triggered in the expected scope. This PR now also tracks the expectation ID in the `ForceWarn` level. I've also made some minor adjustments, to possibly catch more bugs and make the whole implementation more robust. This will probably conflict with https://github.com/rust-lang/rust/pull/97718. That PR should ideally be reviewed and merged first. The conflict itself will be trivial to fix. --- r? `@wesleywiser` cc: `@flip1995` since you've helped with the initial review and also discussed this topic with me. :upside_down_face: Follow-up of: https://github.com/rust-lang/rust/pull/87835 Issue: https://github.com/rust-lang/rust/issues/85549 Yeah, and that's it.
2022-06-16Support lint expectations for `--force-warn` lints (RFC 2383)xFrednet-4/+4
2022-06-12Merge commit '7b73b60faca71d01d900e49831fcb84553e93019' into sync-rustfmtCaleb Cartwright-1186/+12890
2022-05-21Merge crate and restricted visibilitiesJacob Pratt-8/+3
2022-05-21Remove feature: `crate` visibility modifierJacob Pratt-10/+5
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-28/+2
2022-05-20Fix typoydah-2/+2
This PR is fixes typo "avaiable" to "available".
2022-05-18fix rustfmtklensy-2/+2
2022-05-11ast: Introduce some traits to get AST node properties genericallyVadim Petrochenkov-14/+3
And use them to avoid constructing some artificial `Nonterminal` tokens during expansion
2022-05-11Rollup merge of #96543 - nnethercote:rm-make_token_stream-hacks, r=Aaron1011Yuki Okushi-3/+1
Remove hacks in `make_token_stream`. `make_tokenstream` has three commented hacks, and a comment at the top referring to #67062. These hacks have no observable effect, at least as judged by running the test suite. The hacks were added in #82608, with an explanation [here](https://github.com/rust-lang/rust/pull/82608#issuecomment-812877329). It appears that one of the following is true: (a) they never did anything useful, (b) they do something useful but we have no test coverage for them, or (c) something has changed in the meantime that means they are no longer necessary. This commit removes the hacks and the comments, in the hope that (b) is not true. r? `@Aaron1011`
2022-05-11Remove some unnecessary invisible delimiter checks.Nicholas Nethercote-3/+1
These seem to have no useful effect... they don't seem useful from a code inspection point of view, and they affect anything in the test suite.
2022-04-30Fix the rustfmt buildScott McMurray-0/+5
2022-04-28rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`Vadim Petrochenkov-51/+51
2022-04-27Make explicit an unreachable `NoDelim` case in `rustfmt`.Nicholas Nethercote-1/+1
2022-04-27Avoid producing `NoDelim` values in `MacArgs::delim()`.Nicholas Nethercote-1/+1
2022-04-17Visit generics inside visit_fn.Camille GILLOT-11/+20
2022-04-15Rollup merge of #94461 - jhpratt:2024-edition, r=pnkfelixDylan DPC-0/+6
Create (unstable) 2024 edition [On Zulip](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Deprecating.20macro.20scoping.20shenanigans/near/272860652), there was a small aside regarding creating the 2024 edition now as opposed to later. There was a reasonable amount of support and no stated opposition. This change creates the 2024 edition in the compiler and creates a prelude for the 2024 edition. There is no current difference between the 2021 and 2024 editions. Cargo and other tools will need to be updated separately, as it's not in the same repository. This change permits the vast majority of work towards the next edition to proceed _now_ instead of waiting until 2024. For sanity purposes, I've merged the "hello" UI tests into a single file with multiple revisions. Otherwise we'd end up with a file per edition, despite them being essentially identical. ````@rustbot```` label +T-lang +S-waiting-on-review Not sure on the relevant team, to be honest.
2022-04-13errors: lazily load fallback fluent bundleDavid Wood-5/+5
Loading the fallback bundle in compilation sessions that won't go on to emit any errors unnecessarily degrades compile time performance, so lazily create the Fluent bundle when it is first required. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05session: opt for enabling directionality markersDavid Wood-1/+1
Add an option for enabling and disabling Fluent's directionality isolation markers in output. Disabled by default as these can render in some terminals and applications. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05errors: implement sysroot/testing bundle loadingDavid Wood-1/+3
Extend loading of Fluent bundles so that bundles can be loaded from the sysroot based on the language requested by the user, or using a nightly flag. Sysroot bundles are loaded from `$sysroot/share/locale/$locale/*.ftl`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05errors: implement fallback diagnostic translationDavid Wood-0/+22
This commit updates the signatures of all diagnostic functions to accept types that can be converted into a `DiagnosticMessage`. This enables existing diagnostic calls to continue to work as before and Fluent identifiers to be provided. The `SessionDiagnostic` derive just generates normal diagnostic calls, so these APIs had to be modified to accept Fluent identifiers. In addition, loading of the "fallback" Fluent bundle, which contains the built-in English messages, has been implemented. Each diagnostic now has "arguments" which correspond to variables in the Fluent messages (necessary to render a Fluent message) but no API for adding arguments has been added yet. Therefore, diagnostics (that do not require interpolation) can be converted to use Fluent identifiers and will be output as before.
2022-04-05span: move `MultiSpan`David Wood-1/+2
`MultiSpan` contains labels, which are more complicated with the introduction of diagnostic translation and will use types from `rustc_errors` - however, `rustc_errors` depends on `rustc_span` so `rustc_span` cannot use types like `DiagnosticMessage` without dependency cycles. Introduce a new `rustc_error_messages` crate that can contain `DiagnosticMessage` and `MultiSpan`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-02Create 2024 editionJacob Pratt-0/+6
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