<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/compiler/rustc_builtin_macros/src/deriving/cmp, branch stable</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=stable</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=stable'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-07-17T15:42:54+00:00</updated>
<entry>
<title>Make `derive_const` usable within libcore again</title>
<updated>2025-07-17T15:42:54+00:00</updated>
<author>
<name>Oli Scherer</name>
<email>github333195615777966@oli-obk.de</email>
</author>
<published>2025-07-11T10:20:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=250648e871c1e685f09427bd31fd399090f15640'/>
<id>urn:sha1:250648e871c1e685f09427bd31fd399090f15640</id>
<content type='text'>
Also make it *only* usable on nightly
</content>
</entry>
<entry>
<title>Rollup merge of #141724 - Sol-Ell:issue-141141-fix, r=nnethercote</title>
<updated>2025-06-03T13:00:32+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>476013+matthiaskrgr@users.noreply.github.com</email>
</author>
<published>2025-06-03T13:00:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=19437666d9d6b38534a6b7bb575003033c180bff'/>
<id>urn:sha1:19437666d9d6b38534a6b7bb575003033c180bff</id>
<content type='text'>
fix(#141141): When expanding `PartialEq`, check equality of scalar types first.

Fixes rust-lang/rust#141141.

Now, `cs_eq` function of `partial_eq.rs` compares [scalar types](https://doc.rust-lang.org/rust-by-example/primitives.html#scalar-types) first.

- Add `is_scalar` field to `FieldInfo`.
- Add `is_scalar` method to `TyKind`.
- Pass `FieldInfo` via `CsFold::Combine` and refactor code relying on it.
- Implement `TryFrom&lt;&amp;str&gt;` and `TryFrom&lt;Symbol&gt;` for FloatTy.
- Implement `TryFrom&lt;&amp;str&gt;` and `TryFrom&lt;Symbol&gt;` for IntTy.
- Implement `TryFrom&lt;&amp;str&gt;` and `TryFrom&lt;Symbol&gt;` for UintTy.
</content>
</entry>
<entry>
<title>Separately check equality of the scalar types and compound types in the order of declaration.</title>
<updated>2025-06-02T12:29:34+00:00</updated>
<author>
<name>Ell</name>
<email>ahunpochoevjamshed@gmail.com</email>
</author>
<published>2025-05-30T07:57:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a6a1c1b247aa0fa404983efa3c226c25cafdd704'/>
<id>urn:sha1:a6a1c1b247aa0fa404983efa3c226c25cafdd704</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Reorder `ast::ItemKind::{Struct,Enum,Union}` fields.</title>
<updated>2025-05-28T05:48:45+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2025-05-27T22:20:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=4c4a40f6dfa7630a8817748a687cfdd1335a7358'/>
<id>urn:sha1:4c4a40f6dfa7630a8817748a687cfdd1335a7358</id>
<content type='text'>
So they match the order of the parts in the source code, e.g.:
```
struct Foo&lt;T, U&gt; { t: T, u: U }
       &lt;-&gt;&lt;----&gt; &lt;------------&gt;
       /   |       \
   ident generics  variant_data
```
</content>
</entry>
<entry>
<title>Move `ast::Item::ident` into `ast::ItemKind`.</title>
<updated>2025-04-01T03:08:57+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2025-03-20T22:47:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=df247968f267d30fb8b048c21f595f2293d8ff62'/>
<id>urn:sha1:df247968f267d30fb8b048c21f595f2293d8ff62</id>
<content type='text'>
`ast::Item` has an `ident` field.

- It's always non-empty for these item kinds: `ExternCrate`, `Static`,
  `Const`, `Fn`, `Mod`, `TyAlias`, `Enum`, `Struct`, `Union`,
  `Trait`, `TraitAlias`, `MacroDef`, `Delegation`.

- It's always empty for these item kinds: `Use`, `ForeignMod`,
  `GlobalAsm`, `Impl`, `MacCall`, `DelegationMac`.

There is a similar story for `AssocItemKind` and `ForeignItemKind`.

Some sites that handle items check for an empty ident, some don't. This
is a very C-like way of doing things, but this is Rust, we have sum
types, we can do this properly and never forget to check for the
exceptional case and never YOLO possibly empty identifiers (or possibly
dummy spans) around and hope that things will work out.

The commit is large but it's mostly obvious plumbing work. Some notable
things.

- `ast::Item` got 8 bytes bigger. This could be avoided by boxing the
  fields within some of the `ast::ItemKind` variants (specifically:
  `Struct`, `Union`, `Enum`). I might do that in a follow-up; this
  commit is big enough already.

- For the visitors: `FnKind` no longer needs an `ident` field because
  the `Fn` within how has one.

- In the parser, the `ItemInfo` typedef is no longer needed. It was used
  in various places to return an `Ident` alongside an `ItemKind`, but
  now the `Ident` (if present) is within the `ItemKind`.

- In a few places I renamed identifier variables called `name` (or
  `foo_name`) as `ident` (or `foo_ident`), to better match the type, and
  because `name` is normally used for `Symbol`s. It's confusing to see
  something like `foo_name.name`.
</content>
</entry>
<entry>
<title>Rustfmt</title>
<updated>2025-02-08T22:12:13+00:00</updated>
<author>
<name>bjorn3</name>
<email>17426603+bjorn3@users.noreply.github.com</email>
</author>
<published>2025-02-08T22:12:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=1fcae03369abb4c2cc180cd5a49e1f4440a81300'/>
<id>urn:sha1:1fcae03369abb4c2cc180cd5a49e1f4440a81300</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Re-export more `rustc_span::symbol` things from `rustc_span`.</title>
<updated>2024-12-18T02:38:53+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2024-12-12T23:29:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=2620eb42d72d24baa1ca1056a769862b92c85f7f'/>
<id>urn:sha1:2620eb42d72d24baa1ca1056a769862b92c85f7f</id>
<content type='text'>
`rustc_span::symbol` defines some things that are re-exported from
`rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some
closely related things such as `Ident` and `kw`. So you can do `use
rustc_span::{Symbol, sym}` but you have to do `use
rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good
reason.

This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`,
and changes many `rustc_span::symbol::` qualifiers in `compiler/` to
`rustc_span::`. This is a 200+ net line of code reduction, mostly
because many files with two `use rustc_span` items can be reduced to
one.
</content>
</entry>
<entry>
<title>Reformat using the new identifier sorting from rustfmt</title>
<updated>2024-09-22T23:11:29+00:00</updated>
<author>
<name>Michael Goulet</name>
<email>michael@errs.io</email>
</author>
<published>2024-09-22T23:05:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=c682aa162b0d41e21cc6748f4fecfe01efb69d1f'/>
<id>urn:sha1:c682aa162b0d41e21cc6748f4fecfe01efb69d1f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Reformat `use` declarations.</title>
<updated>2024-07-28T22:26:52+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2024-07-28T22:13:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=84ac80f1921afc243d71fd0caaa4f2838c294102'/>
<id>urn:sha1:84ac80f1921afc243d71fd0caaa4f2838c294102</id>
<content type='text'>
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
</content>
</entry>
<entry>
<title>Auto merge of #124157 - wutchzone:partial_eq, r=estebank</title>
<updated>2024-05-09T08:34:14+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2024-05-09T08:34:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cb93c24bf36b3367714516fc2308cf6856916eeb'/>
<id>urn:sha1:cb93c24bf36b3367714516fc2308cf6856916eeb</id>
<content type='text'>
Do not add leading asterisk in the `PartialEq`

I think we should address this issue, however I am not exactly sure, if this is the right way to do it. It is related to the #123056.

Imagine the simplified code:

```rust
trait MyTrait {}

impl PartialEq for dyn MyTrait {
    fn eq(&amp;self, _other: &amp;Self) -&gt; bool {
        true
    }
}

#[derive(PartialEq)]
enum Bar {
    Foo(Box&lt;dyn MyTrait&gt;),
}
```

On the nightly compiler, the `derive` produces invalid code with the weird error message:
```
error[E0507]: cannot move out of `*__arg1_0` which is behind a shared reference
  --&gt; src/main.rs:11:9
   |
9  | #[derive(PartialEq)]
   |          --------- in this derive macro expansion
10 | enum Things {
11 |     Foo(Box&lt;dyn MyTrait&gt;),
   |         ^^^^^^^^^^^^^^^^ move occurs because `*__arg1_0` has type `Box&lt;dyn MyTrait&gt;`, which does not implement the `Copy` trait
   |
   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
```

It may be related to the perfect derive problem, although requiring the _type_ to be `Copy` seems unfortunate because it is not necessary. Besides, we are adding the extra dereference only for the diagnostics?
</content>
</entry>
</feed>
