Ben Kimock
4cf21866e8
Move hashes from rustc_data_structure to rustc_hashes so they can be shared with rust-analyzer
2025-02-16 16:18:30 -05:00
Michael Goulet
6d71251cf9
Trim suggestion parts to the subset that is purely additive
2025-02-14 00:44:10 -08:00
Michael Goulet
f6406dfd4e
Consider add-prefix replacements too
2025-02-14 00:27:17 -08:00
Michael Goulet
b480a9214a
Use underline suggestions for purely 'additive' replacements
2025-02-14 00:27:13 -08:00
bjorn3
8a0adec05b
Avoid manually producing FatalError in a couple of places
2025-02-06 17:29:15 +00:00
Matthias Krüger
f1bdf3ba4a
Rollup merge of #136445 - bjorn3:diag_ctxt_cleanup, r=oli-obk
...
Couple of cleanups to DiagCtxt and EarlyDiagCtxt
2025-02-02 23:06:57 +01:00
bjorn3
6a566ee092
Replace ParseSess::set_dcx with DiagCtxt::set_emitter
...
Replacing the error emitter doesn't accidentally clear the error count.
2025-02-02 16:09:39 +00:00
bjorn3
6556147d15
Use fallback fluent bundle from inner emitter in SilentEmitter
2025-02-02 16:06:43 +00:00
bjorn3
aa2b870bb5
Slightly simplify DiagCtxt::make_silent
2025-02-02 16:06:43 +00:00
Esteban Küber
8e9422f94e
Make comma separated lists of anything easier to make for errors
...
Provide a new function `listify`, meant to be used in cases similar to `pluralize!`. When you have a slice of arbitrary elements that need to be presented to the user, `listify` allows you to turn that into a list of comma separated strings.
This reduces a lot of redundant logic that happens often in diagnostics.
2025-01-31 20:36:44 +00:00
Yotam Ofek
1951d86a35
Manual cleanup of some is_{or_none|some_and}
usages
2025-01-19 20:50:43 +00:00
Yotam Ofek
264fa0fc54
Run clippy --fix
for unnecessary_map_or
lint
2025-01-19 19:15:00 +00:00
Michael Goulet
85c9ce6d79
Remove a bunch of diagnostic stashing that doesn't do anything
2025-01-11 19:22:06 +00:00
The 8472
fe521506a6
update uses of extract_if in the compiler
2024-12-16 22:06:52 +01:00
Matthias Krüger
2ced8b31c7
Rollup merge of #134187 - nnethercote:rm-PErr, r=jieyouxu
...
Remove `PErr`.
It's just a synonym for `Diag` that adds no value and is only used in a few places.
r? ``@spastorino``
2024-12-12 08:07:05 +01:00
Matthias Krüger
1d784225f1
Rollup merge of #134154 - dev-ardi:field-expr-generics, r=compiler-errors
...
suppress field expr with generics error message if it's a method
Don't emit "field expressions may not have generic arguments" if it's a method call without `()`
r? estebank
Fixes #67680
Is this the best way to go? It's by far the simplest I could come up with.
2024-12-12 08:07:02 +01:00
Nicholas Nethercote
40c964510c
Remove PErr
.
...
It's just a synonym for `Diag` that adds no value and is only used in a
few places.
2024-12-12 11:31:55 +11:00
Orion Gonzalez
014363e89e
Don't emit "field expressions may not have generic arguments" if it's a method call without ()
2024-12-11 16:23:04 +01:00
Orion Gonzalez
55806e5655
document check_expr_field
2024-12-11 13:48:50 +01:00
bjorn3
618d4c3eeb
Handle unwinding out of the closure argument of run_compiler with pending delayed bugs
2024-12-06 18:42:31 +00:00
bjorn3
030545d8c3
Store a single copy of the error registry in DiagCtxt
...
And pass this to the individual emitters when necessary.
2024-12-06 18:42:31 +00:00
Rémy Rakic
c6659251c9
clarify must_produce_diag
ICE for debugging
2024-11-12 11:21:43 +00:00
Matthias Krüger
df61a0b1b2
Rollup merge of #131344 - nnethercote:ref-Lrc, r=compiler-errors
...
Avoid `&Lrc<T>` in various places
Seeing `&Lrc<T>` is a bit suspicious, and `&T` or `Lrc<T>` is often better.
r? `@oli-obk`
2024-10-07 12:23:54 +02:00
Nicholas Nethercote
731469fee5
Convert Option<&Lrc<T>>
return types to Option<&T>
.
...
It's simpler and more concise.
2024-10-07 13:56:29 +11:00
Nicholas Nethercote
25d1ef1993
Remove InferCtxt::err_count_on_creation
.
...
It's no longer used meaningfully.
This also means `DiagCtxtHandle::err_count_excluding_lint_errs` can be
removed.
2024-10-07 09:50:50 +11:00
Michael Goulet
c682aa162b
Reformat using the new identifier sorting from rustfmt
2024-09-22 19:11:29 -04:00
Lieselotte
db09345ef6
Add suggestions for expressions in patterns
2024-09-18 20:38:43 +02:00
Veera
741005792e
Implement a Method to Seal DiagInner
's Suggestions
2024-09-12 21:27:44 -04:00
Camille GILLOT
6dfc4033be
Do not ICE on expect(warnings).
2024-09-07 01:34:59 +00:00
Camille GILLOT
94f8347bae
Check AttrId for expectations.
2024-09-06 20:51:06 +00:00
Matthias Krüger
cfb12716e9
Rollup merge of #129875 - Sajjon:sajjon_fix_typos_batch_1, r=compiler-errors,jieyouxu
...
chore: Fix typos in 'compiler' (batch 1)
Batch 1/3: Fixes typos in `compiler`
(See [issue](https://github.com/rust-lang/rust/issues/129874 ) tracking all PRs with typos fixes)
2024-09-02 22:35:20 +02:00
Alexander Cyon
ac69544a17
chore: Fix typos in 'compiler' (batch 1)
2024-09-02 07:42:38 +02:00
Camille GILLOT
5f1f45b095
Remove attr_id from stable lint ids.
2024-08-31 14:01:07 +00:00
Camille GILLOT
4928b22fa8
Use AttrId key for unstable<->stable expectation map.
2024-08-31 13:58:01 +00:00
Nicholas Nethercote
5fd503ab44
Add warn(unreachable_pub)
to rustc_errors
.
2024-08-27 12:03:37 +10:00
Jaic1
8557b56ec7
Add |
to make the html doc of Level
rendered correctly
2024-08-14 13:38:03 +08:00
Guillaume Gomez
7c6dca9050
Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu
...
Use `assert_matches` around the compiler more
It's a useful assertion, especially since it actually prints out the LHS.
2024-08-12 17:09:19 +02:00
Michael Goulet
c361c924a0
Use assert_matches around the compiler
2024-08-11 12:25:39 -04:00
León Orell Valerian Liehr
c4c518d2d4
Use more slice patterns inside the compiler
2024-08-07 13:37:52 +02:00
Esteban Küber
8ce8c42e0b
Do not underline suggestions for code that is already there
...
When a suggestion part is for already present code, do not highlight it. If after that there are no highlights left, do not show the suggestion at all.
Fix clippy lint suggestion incorrectly treated as `span_help`.
2024-08-01 18:53:42 +00:00
Nicholas Nethercote
84ac80f192
Reformat use
declarations.
...
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Matthias Krüger
8e206c0387
Rollup merge of #126994 - Alexendoo:explain-markdown, r=tgross35
...
Support lists and stylings in more places for `rustc --explain`
Adds support for `*foo*`, stylings not immediately following whitespace e.g. ``(`Foo`)`` and lists starting with whitespace:
```md
* previously supported
```
```md
* now also supported
```
These are fairly common in the existing error docs, some before/after examples:
### E0460


### E0059


2024-07-23 19:42:35 +02:00
Alex Macleod
5824ab178b
Support lists and stylings in more places for rustc --explain
2024-07-10 13:41:36 +00:00
Oli Scherer
bd111f5c4b
Document new field and function
2024-06-27 09:45:26 +00:00
Oli Scherer
86c8eae774
Automatically taint InferCtxt when errors are emitted
2024-06-26 16:01:45 +00:00
Nicholas Nethercote
d6efcbb760
Fix another assertion failure for some Expect diagnostics.
...
Very similar to #126719 . So much so that I added a new case to the test
from that PR rather than creating a new one.
2024-06-21 14:29:25 +10:00
Nicholas Nethercote
19b7192c72
Fix assertion failure for some Expect
diagnostics.
...
In #120699 I moved some code dealing with `has_future_breakage` earlier
in `emit_diagnostic`. Issue #126521 identified a case where that
reordering was invalid (leading to an assertion failure) for some `Expect`
diagnostics.
This commit partially undoes the change, by moving the handling of
unstable `Expect` diagnostics earlier again. This makes
`emit_diagnostic` a bit uglier, but is necessary to fix the problem.
Fixes #126521 .
2024-06-20 10:17:40 +10:00
Oli Scherer
7ba82d61eb
Use a dedicated type instead of a reference for the diagnostic context
...
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18 15:42:11 +00:00
León Orell Valerian Liehr
9f67c50128
Remove DelayDm
...
With the removal of `LintDiagnostic::msg` / the `msg` param from
lint diag APIs, primary messages for lint diags are always constructed
lazily inside decorator fns rendering this wrapper type unused / useless.
2024-05-23 04:08:35 +02:00
Nicholas Nethercote
6341935a13
Remove extern crate tracing
from numerous crates.
2024-04-30 16:47:49 +10:00