<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/compiler/rustc_hir_analysis/src/structured_errors, branch 1.78.0</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.78.0</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.78.0'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2024-03-05T01:15:12+00:00</updated>
<entry>
<title>Rename `StructuredDiagnostic` as `StructuredDiag`.</title>
<updated>2024-03-05T01:15:12+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2024-02-29T05:56:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f8429390ec8f335d17744773644e192b74734566'/>
<id>urn:sha1:f8429390ec8f335d17744773644e192b74734566</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rename `DiagnosticBuilder` as `Diag`.</title>
<updated>2024-02-27T21:55:35+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2024-02-22T23:20:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=899cb40809a85eb9d89f6da3268713b83175360a'/>
<id>urn:sha1:899cb40809a85eb9d89f6da3268713b83175360a</id>
<content type='text'>
Much better!

Note that this involves renaming (and updating the value of)
`DIAGNOSTIC_BUILDER` in clippy.
</content>
</entry>
<entry>
<title>Prefer `DiagnosticBuilder` over `Diagnostic` in diagnostic modifiers.</title>
<updated>2024-02-19T09:23:20+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2024-01-31T23:13:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=b18f3e11fa9c2d6fb8a6c4807229bebc3608d3ac'/>
<id>urn:sha1:b18f3e11fa9c2d6fb8a6c4807229bebc3608d3ac</id>
<content type='text'>
There are lots of functions that modify a diagnostic. This can be via a
`&amp;mut Diagnostic` or a `&amp;mut DiagnosticBuilder`, because the latter type
wraps the former and impls `DerefMut`.

This commit converts all the `&amp;mut Diagnostic` occurrences to `&amp;mut
DiagnosticBuilder`. This is a step towards greatly simplifying
`Diagnostic`. Some of the relevant function are made generic, because
they deal with both errors and warnings. No function bodies are changed,
because all the modifier methods are available on both `Diagnostic` and
`DiagnosticBuilder`.
</content>
</entry>
<entry>
<title>By tracking import use types to check whether it is scope uses or the other situations like module-relative uses, we can do more accurate redundant import checking.</title>
<updated>2024-02-18T08:38:11+00:00</updated>
<author>
<name>surechen</name>
<email>chenshuo17@huawei.com</email>
</author>
<published>2023-11-10T02:11:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a61126cef6c4083d57e22835033eb2eefdd31bac'/>
<id>urn:sha1:a61126cef6c4083d57e22835033eb2eefdd31bac</id>
<content type='text'>
fixes #117448

For example unnecessary imports in std::prelude that can be eliminated:

```rust
use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly
use std::option::Option::None; //~ WARNING the item `None` is imported redundantly
```
</content>
</entry>
<entry>
<title>hir: Remove `hir::Map::{opt_parent_id,parent_id,get_parent,find_parent}`</title>
<updated>2024-02-10T09:24:46+00:00</updated>
<author>
<name>Vadim Petrochenkov</name>
<email>vadim.petrochenkov@gmail.com</email>
</author>
<published>2024-02-09T20:58:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=b07283815be70d4e727187f646d5023911491001'/>
<id>urn:sha1:b07283815be70d4e727187f646d5023911491001</id>
<content type='text'>
</content>
</entry>
<entry>
<title>hir: Remove `fn opt_hir_id` and `fn opt_span`</title>
<updated>2024-02-07T06:38:24+00:00</updated>
<author>
<name>Vadim Petrochenkov</name>
<email>vadim.petrochenkov@gmail.com</email>
</author>
<published>2024-01-21T18:13:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a61019b29021b7635113b48e470dbac724c81c76'/>
<id>urn:sha1:a61019b29021b7635113b48e470dbac724c81c76</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Stop using `String` for error codes.</title>
<updated>2024-01-28T20:41:41+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2024-01-13T23:57:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5d9dfbd08f38c2a9bc71d39de8f5c7776afe0f9e'/>
<id>urn:sha1:5d9dfbd08f38c2a9bc71d39de8f5c7776afe0f9e</id>
<content type='text'>
Error codes are integers, but `String` is used everywhere to represent
them. Gross!

This commit introduces `ErrCode`, an integral newtype for error codes,
replacing `String`. It also introduces a constant for every error code,
e.g. `E0123`, and removes the `error_code!` macro. The constants are
imported wherever used with `use rustc_errors::codes::*`.

With the old code, we have three different ways to specify an error code
at a use point:
```
error_code!(E0123)  // macro call

struct_span_code_err!(dcx, span, E0123, "msg");  // bare ident arg to macro call

\#[diag(name, code = "E0123")]  // string
struct Diag;
```

With the new code, they all use the `E0123` constant.
```
E0123  // constant

struct_span_code_err!(dcx, span, E0123, "msg");  // constant

\#[diag(name, code = E0123)]  // constant
struct Diag;
```

The commit also changes the structure of the error code definitions:
- `rustc_error_codes` now just defines a higher-order macro listing the
  used error codes and nothing else.
- Because that's now the only thing in the `rustc_error_codes` crate, I
  moved it into the `lib.rs` file and removed the `error_codes.rs` file.
- `rustc_errors` uses that macro to define everything, e.g. the error
  code constants and the `DIAGNOSTIC_TABLES`. This is in its new
  `codes.rs` file.
</content>
</entry>
<entry>
<title>Rework how diagnostic lints are stored.</title>
<updated>2024-01-14T03:04:25+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2024-01-13T02:11:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d71f535a6f39e82313b46ac3157c4ed9267a2e40'/>
<id>urn:sha1:d71f535a6f39e82313b46ac3157c4ed9267a2e40</id>
<content type='text'>
`Diagnostic::code` has the type `DiagnosticId`, which has `Error` and
`Lint` variants. Plus `Diagnostic::is_lint` is a bool, which should be
redundant w.r.t. `Diagnostic::code`.

Seems simple. Except it's possible for a lint to have an error code, in
which case its `code` field is recorded as `Error`, and `is_lint` is
required to indicate that it's a lint. This is what happens with
`derive(LintDiagnostic)` lints. Which means those lints don't have a
lint name or a `has_future_breakage` field because those are stored in
the `DiagnosticId::Lint`.

It's all a bit messy and confused and seems unintentional.

This commit:
- removes `DiagnosticId`;
- changes `Diagnostic::code` to `Option&lt;String&gt;`, which means both
  errors and lints can straightforwardly have an error code;
- changes `Diagnostic::is_lint` to `Option&lt;IsLint&gt;`, where `IsLint` is a
  new type containing a lint name and a `has_future_breakage` bool, so
  all lints can have those, error code or not.
</content>
</entry>
<entry>
<title>Rename consuming chaining methods on `DiagnosticBuilder`.</title>
<updated>2024-01-09T20:40:00+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2024-01-08T22:08:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ed76b0b882d0acff9295bcd76c2b119cf83e7219'/>
<id>urn:sha1:ed76b0b882d0acff9295bcd76c2b119cf83e7219</id>
<content type='text'>
In #119606 I added them and used a `_mv` suffix, but that wasn't great.

A `with_` prefix has three different existing uses.
- Constructors, e.g. `Vec::with_capacity`.
- Wrappers that provide an environment to execute some code, e.g.
  `with_session_globals`.
- Consuming chaining methods, e.g. `Span::with_{lo,hi,ctxt}`.

The third case is exactly what we want, so this commit changes
`DiagnosticBuilder::foo_mv` to `DiagnosticBuilder::with_foo`.

Thanks to @compiler-errors for the suggestion.
</content>
</entry>
<entry>
<title>Remove all eight `DiagnosticBuilder::*_with_code` methods.</title>
<updated>2024-01-08T05:00:34+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2024-01-03T10:50:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6682f243dcb9babd67525bbf9798dca302f60588'/>
<id>urn:sha1:6682f243dcb9babd67525bbf9798dca302f60588</id>
<content type='text'>
These all have relatively low use, and can be perfectly emulated with
a simpler construction method combined with `code` or `code_mv`.
</content>
</entry>
</feed>
