about summary refs log tree commit diff
path: root/compiler/rustc_errors
AgeCommit message (Collapse)AuthorLines
2022-08-07Rollup merge of #100071 - klensy:annotate-snippets-bump, r=Mark-SimulacrumMatthias Krüger-2/+6
deps: dedupe `annotate-snippets` crate versions Dedupes `annotate-snippets` crate versions (https://github.com/rust-lang/annotate-snippets-rs/blob/0.9.1/CHANGELOG.md). Should work, but there is not a lot of tests. Looks like switching to that crate a bit stalled.
2022-08-05move DiagnosticArgFromDisplay into rustc_errorsMichael Goulet-2/+22
2022-08-02dedupe 'annotate-snippets' crate versionsklensy-2/+6
2022-07-20Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisabors-1/+1
Remove the unused StableSet and StableMap types from rustc_data_structures. The current implementation is not "stable" in the same sense that `HashStable` and `StableHasher` are stable, i.e. across compilation sessions. So, in my opinion, it's better to remove those types (which are basically unused anyway) than to give the wrong impression that these are safe for incr. comp. I plan to provide new "stable" collection types soon that can be used to replace `FxHashMap` and `FxHashSet` in query results (see [draft](https://github.com/michaelwoerister/rust/commit/69d03ac7a7d651a397ab793e9d78f8fce3edf7a6)). It's unsound that `HashMap` and `HashSet` implement `HashStable` (see https://github.com/rust-lang/rust/issues/98890 for a recent P-critical bug caused by this) -- so we should make some progress there.
2022-07-20Remove unused StableMap and StableSet types from rustc_data_structuresMichael Woerister-1/+1
2022-07-20avoid `&str` to String conversionsTakayuki Maeda-8/+7
2022-07-19Mention first and last macro in backtraceMichael Goulet-6/+19
2022-07-16Rollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, ↵Matthias Krüger-1/+1
r=compiler-errors Avoid some `Symbol` to `String` conversions This patch removes some Symbol to String conversions.
2022-07-17avoid some `Symbol` to `String` conversionsTakayuki Maeda-1/+1
2022-07-15passes: migrate half of `check_attr`David Wood-0/+1
Migrate half of the `rustc_passes::check_attr` diagnostics to using diagnostic derives and being translatable.
2022-07-15errors: lint on `LintDiagnosticBuilder::build`David Wood-0/+1
Apply the `#[rustc_lint_diagnostics]` attribute to `LintDiagnosticBuilder::build` so that diagnostic migration lints will trigger for it. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-15errors: impl `IntoDiagnosticArg` for `char`David Wood-77/+33
Implements `IntoDiagnosticArg` for `char` using its `Debug` implementation and introduces a macro for those types which just delegate the implementation to `ToString`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-11Rollup merge of #99075 - danobi:dup_type_hint_sugg, r=petrochenkovMatthias Krüger-0/+9
Fix duplicated type annotation suggestion Before, there was more or less duplicated suggestions to add type hints. Fix by clearing more generic suggestions when a more specific suggestion is possible. This fixes #93506 .
2022-07-11rename a methodTakayuki Maeda-1/+1
2022-07-11implement `is_accessible_span`Takayuki Maeda-1/+1
2022-07-08Fix duplicated type annotation suggestionDaniel Xu-0/+9
Before, there was more or less duplicated suggestions to add type hints. Fix by clearing more generic suggestions when a more specific suggestion is possible. This fixes #93506 .
2022-07-08Rollup merge of #98657 - ↵Dylan DPC-0/+12
compiler-errors:rustc-const-eval-session-diagnostic-1, r=davidtwco Migrate some diagnostics from `rustc_const_eval` to `SessionDiagnostic` I'm still trying to get the hang of this, so it doesn't migrate _all_ of `rustc_const_eval`. Working on that later. r? `@davidtwco`
2022-07-08Rollup merge of #95635 - davidtwco:terminal-width-stabilization, r=oli-obkMatthias Krüger-16/+16
sess: stabilize `--terminal-width` as `--diagnostic-width` Formerly `-Zterminal-width`, `--terminal-width` allows the user or build tool to inform rustc of the width of the terminal so that diagnostics can be truncated. Pending agreement to stabilize, see tracking issue at #84673. r? ```@oli-obk```
2022-07-08Implement IntoDiagnosticArg for hir::ConstContextMichael Goulet-0/+12
2022-07-06session: `output-width` -> `diagnostic-width`David Wood-16/+16
Rename the `--output-width` flag to `--diagnostic-width` as this appears to be the preferred name within the compiler team. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-06session: `terminal-width` -> `output-width`David Wood-16/+16
Rename the `--terminal-width` flag to `--output-width` as the behaviour doesn't just apply to terminals (and so is slightly less accurate). Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-05errors: introduce `DecorateLint`David Wood-3/+11
Add a new trait to be generated by diagnostic derives which uses a `LintDiagnosticBuilder`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-05lint: `LintDiagnosticBuilder` into `rustc_errors`David Wood-1/+24
Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-05Rollup merge of #98624 - davidtwco:translation-on-lints, r=compiler-errorsDylan DPC-2/+84
lints: mostly translatable diagnostics As lints are created slightly differently than other diagnostics, intended to try make them translatable first and then look into the applicability of diagnostic structs but ended up just making most of the diagnostics in the crate translatable (which will still be useful if I do make a lot of them structs later anyway). r? ``@compiler-errors``
2022-07-03Auto merge of #98673 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrumbors-29/+29
Bump bootstrap compiler r? `@Mark-Simulacrum`
2022-07-01update cfg(bootstrap)sPietro Albini-29/+29
2022-06-30Rollup merge of #98695 - tshepang:or-pattern, r=compiler-errorsMatthias Krüger-1/+1
use "or pattern"
2022-06-30lint: port incomplete features diagnosticsDavid Wood-0/+6
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port keyword idents diagnosticsDavid Wood-1/+7
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port variant size difference diagnosticsDavid Wood-0/+48
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port overflowing literals diagnosticsDavid Wood-0/+12
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30lint: port non-fmt-panic diagnosticsDavid Wood-0/+10
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30middle: translation in `LintDiagnosticBuilder`David Wood-1/+1
Accept `DiagnosticMessage` in `LintDiagnosticBuilder::build` so that lints can be built with translatable diagnostic messages. Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30use "or pattern"Tshepang Mbambo-1/+1
2022-06-28Migrate some rustc_borrowck diagnostics to SessionDiagnosticMichael Goulet-2/+12
2022-06-20remove MAX_SUGGESTION_HIGHLIGHT_LINESMaybe Waffle-5/+0
2022-06-17Auto merge of #97892 - klensy:fix-spaces, r=oli-obkbors-4/+8
diagnostics: remove trailing spaces Remove few occurrences of trailing spaces and drive by fix of needless alloc of const string.
2022-06-17Rollup merge of #97798 - ↵Dylan DPC-77/+170
WaffleLapkin:allow_for_suggestions_that_are_quite_far_away_from_each_other, r=estebank Hide irrelevant lines in suggestions to allow for suggestions that are far from each other to be shown This is an attempt to fix suggestions one part of which is 6 lines or more far from the first. I've noticed "the problem" (of not showing some parts of the suggestion) here: https://github.com/rust-lang/rust/pull/97759#discussion_r889689230. I'm not sure about the implementation (this big closure is just bad and makes already complicated code even more so), but I want to at least discuss the result. Here is an example of how this changes the output: Before: ```text help: consider enclosing expression in a block | 3 ~ 'l: { match () { () => break 'l, 4 | 5 | 6 | 7 | 8 | ... ``` After: ```text help: consider enclosing expression in a block | 3 ~ 'l: { match () { () => break 'l, 4 | ... 31| 32~ } }; | ``` r? `@estebank` `@rustbot` label +A-diagnostics +A-suggestion-diagnostics
2022-06-16Add back MAX_SUGGESTION_HIGHLIGHT_LINES so clippy is happy & buildableMaybe Waffle-0/+5
2022-06-16Try to clean up code...Maybe Waffle-93/+150
I'm not sure if I succeeded
2022-06-16Improve suggestions when its parts are far from each otherMaybe Waffle-68/+99
Previously we only show at most 6 lines of suggestions and, if the suggestions are more than 6 lines apart, we've just showed ... at the end. This is probably fine, but quite confusing in my opinion. This commit is an attempt to show ... in places where there is nothing to suggest instead, for example: Before: ```text help: consider enclosing expression in a block | 3 ~ 'l: { match () { () => break 'l, 4 | 5 | 6 | 7 | 8 | ... ``` After: ```text help: consider enclosing expression in a block | 3 ~ 'l: { match () { () => break 'l, 4 | ... 31| 32~ } }; | ```
2022-06-16Fix a typoMaybe Waffle-1/+1
!(a & b) = !a | !b
2022-06-16drive by fix needless allocation of const string numberklensy-2/+6
2022-06-16 fix one more case of trailing spaceklensy-1/+1
2022-06-16diagnostics: fix trailing spaceklensy-1/+1
2022-06-16Rollup merge of #97757 - xFrednet:rfc-2383-expect-with-force-warn, ↵Matthias Krüger-38/+72
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-38/+72
2022-06-14Rollup merge of #97948 - davidtwco:diagnostic-translation-lints, r=oli-obkDylan DPC-0/+31
lint: add diagnostic translation migration lints Introduce allow-by-default lints for checking whether diagnostics are written in `SessionDiagnostic` or `AddSubdiagnostic` impls and whether diagnostics are translatable. These lints can be denied for modules once they are fully migrated to impls and translation. These lints are intended to be temporary - once all diagnostics have been changed then we can just change the APIs we have and that will enforce these constraints thereafter. r? `````@oli-obk`````
2022-06-10lint: add diagnostic translation migration lintsDavid Wood-0/+31
Introduce allow-by-default lints for checking whether diagnostics are written in `SessionDiagnostic`/`AddSubdiagnostic` impls and whether diagnostics are translatable. These lints can be denied for modules once they are fully migrated to impls and translation. Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-10Rollup merge of #97718 - xFrednet:95540-delayed-good-path-ice-for-expect, ↵Yuki Okushi-12/+17
r=wesleywiser Fix `delayed_good_path_bug` ice for expected diagnostics (RFC 2383) Fixes a small ICE with the `delayed_good_path_bug` check. --- r? ``@wesleywiser`` cc: ``@eddyb`` this might be interesting, since you've added a `FIXME` comment above the modified check which kind of discusses a case like this closes: https://github.com/rust-lang/rust/issues/95540 cc: https://github.com/rust-lang/rust/issues/85549