<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/compiler/rustc_middle/src/query/keys.rs, branch cargo_update</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=cargo_update</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=cargo_update'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-06-16T15:00:22+00:00</updated>
<entry>
<title>trait_sel: `{Meta,Pointee}Sized` on `?Sized` types</title>
<updated>2025-06-16T15:00:22+00:00</updated>
<author>
<name>David Wood</name>
<email>david.wood2@arm.com</email>
</author>
<published>2025-01-16T14:27:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=3b0e1c17d285f5e8f93c07b5fc8f9c6aa277c0dd'/>
<id>urn:sha1:3b0e1c17d285f5e8f93c07b5fc8f9c6aa277c0dd</id>
<content type='text'>
Expand the automatic implementation of `MetaSized` and `PointeeSized` so
that it is also implemented on non-`Sized` types, just not `ty::Foreign`
(extern type).
</content>
</entry>
<entry>
<title>Move methods from `Map` to `TyCtxt`, part 5.</title>
<updated>2025-04-01T23:00:46+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2025-04-01T20:04:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6713f34ee4f0ef669f8860b7f8ab1442440071b3'/>
<id>urn:sha1:6713f34ee4f0ef669f8860b7f8ab1442440071b3</id>
<content type='text'>
This eliminates all methods on `Map`. Actually removing `Map` will occur
in a follow-up PR.
</content>
</entry>
<entry>
<title>Add `TyCtx::env_var_os`</title>
<updated>2025-03-26T14:46:05+00:00</updated>
<author>
<name>Mads Marquart</name>
<email>mads@marquart.dk</email>
</author>
<published>2025-03-26T14:46:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=17db054141f909277a0c57b4698f420636a2c511'/>
<id>urn:sha1:17db054141f909277a0c57b4698f420636a2c511</id>
<content type='text'>
Along with `TyCtx::env_var` helper. These can be used to track
environment variable accesses in the query system.

Since `TyCtx::env_var_os` uses `OsStr`, this commit also adds the
necessary trait implementations for that to work.
</content>
</entry>
<entry>
<title>Only use implied bounds hack if bevy, and use deeply normalize in implied bounds hack</title>
<updated>2025-03-04T18:18:48+00:00</updated>
<author>
<name>Michael Goulet</name>
<email>michael@errs.io</email>
</author>
<published>2025-03-04T18:00:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d75995813112b0297ec727ab4de32c48adb7d695'/>
<id>urn:sha1:d75995813112b0297ec727ab4de32c48adb7d695</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Notes on types/traits used for in-memory query caching</title>
<updated>2025-02-03T11:36:01+00:00</updated>
<author>
<name>Zalathar</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2025-02-03T10:31:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=623d6e8ca423e37daf435136da32697e3cdd605b'/>
<id>urn:sha1:623d6e8ca423e37daf435136da32697e3cdd605b</id>
<content type='text'>
When the word "cache" appears in the context of the query system, it often
isn't obvious whether that is referring to the in-memory query cache or the
on-disk incremental cache.

For these types, we can assure the reader that they are for in-memory caching.
</content>
</entry>
<entry>
<title>Auto merge of #135318 - compiler-errors:vtable-fixes, r=lcnr</title>
<updated>2025-01-31T04:09:11+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2025-01-31T04:09:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=c37fbd873a15e7cdc92476f7d7b964f6c05e64cd'/>
<id>urn:sha1:c37fbd873a15e7cdc92476f7d7b964f6c05e64cd</id>
<content type='text'>
Fix deduplication mismatches in vtables leading to upcasting unsoundness

We currently have two cases where subtleties in supertraits can trigger disagreements in the vtable layout, e.g. leading to a different vtable layout being accessed at a callsite compared to what was prepared during unsizing. Namely:

### #135315

In this example, we were not normalizing supertraits when preparing vtables. In the example,

```
trait Supertrait&lt;T&gt; {
    fn _print_numbers(&amp;self, mem: &amp;[usize; 100]) {
        println!("{mem:?}");
    }
}
impl&lt;T&gt; Supertrait&lt;T&gt; for () {}

trait Identity {
    type Selff;
}
impl&lt;Selff&gt; Identity for Selff {
    type Selff = Selff;
}

trait Middle&lt;T&gt;: Supertrait&lt;()&gt; + Supertrait&lt;T&gt; {
    fn say_hello(&amp;self, _: &amp;usize) {
        println!("Hello!");
    }
}
impl&lt;T&gt; Middle&lt;T&gt; for () {}

trait Trait: Middle&lt;&lt;() as Identity&gt;::Selff&gt; {}
impl Trait for () {}

fn main() {
    (&amp;() as &amp;dyn Trait as &amp;dyn Middle&lt;()&gt;).say_hello(&amp;0);
}
```

When we prepare `dyn Trait`, we see a supertrait of `Middle&lt;&lt;() as Identity&gt;::Selff&gt;`, which itself has two supertraits `Supertrait&lt;()&gt;` and `Supertrait&lt;&lt;() as Identity&gt;::Selff&gt;`. These two supertraits are identical, but they are not duplicated because we were using structural equality and *not* considering normalization. This leads to a vtable layout with two trait pointers.

When we upcast to `dyn Middle&lt;()&gt;`, those two supertraits are now the same, leading to a vtable layout with only one trait pointer. This leads to an offset error, and we call the wrong method.

### #135316

This one is a bit more interesting, and is the bulk of the changes in this PR. It's a bit similar, except it uses binder equality instead of normalization to make the compiler get confused about two vtable layouts. In the example,

```
trait Supertrait&lt;T&gt; {
    fn _print_numbers(&amp;self, mem: &amp;[usize; 100]) {
        println!("{mem:?}");
    }
}
impl&lt;T&gt; Supertrait&lt;T&gt; for () {}

trait Trait&lt;T, U&gt;: Supertrait&lt;T&gt; + Supertrait&lt;U&gt; {
    fn say_hello(&amp;self, _: &amp;usize) {
        println!("Hello!");
    }
}
impl&lt;T, U&gt; Trait&lt;T, U&gt; for () {}

fn main() {
    (&amp;() as &amp;'static dyn for&lt;'a&gt; Trait&lt;&amp;'static (), &amp;'a ()&gt;
        as &amp;'static dyn Trait&lt;&amp;'static (), &amp;'static ()&gt;)
        .say_hello(&amp;0);
}
```

When we prepare the vtable for `dyn for&lt;'a&gt; Trait&lt;&amp;'static (), &amp;'a ()&gt;`, we currently consider the PolyTraitRef of the vtable as the key for a supertrait. This leads two two supertraits -- `Supertrait&lt;&amp;'static ()&gt;` and `for&lt;'a&gt; Supertrait&lt;&amp;'a ()&gt;`.

However, we can upcast[^up] without offsetting the vtable from `dyn for&lt;'a&gt; Trait&lt;&amp;'static (), &amp;'a ()&gt;` to `dyn Trait&lt;&amp;'static (), &amp;'static ()&gt;`. This is just instantiating the principal trait ref for a specific `'a = 'static`. However, when considering those supertraits, we now have only one distinct supertrait -- `Supertrait&lt;&amp;'static ()&gt;` (which is deduplicated since there are two supertraits with the same substitutions). This leads to similar offsetting issues, leading to the wrong method being called.

[^up]: I say upcast but this is a cast that is allowed on stable, since it's not changing the vtable at all, just instantiating the binder of the principal trait ref for some lifetime.

The solution here is to recognize that a vtable isn't really meaningfully higher ranked, and to just treat a vtable as corresponding to a `TraitRef` so we can do this deduplication more faithfully. That is to say, the vtable for `dyn for&lt;'a&gt; Tr&lt;'a&gt;` and `dyn Tr&lt;'x&gt;` are always identical, since they both would correspond to a set of free regions on an impl... Do note that `Tr&lt;for&lt;'a&gt; fn(&amp;'a ())&gt;` and `Tr&lt;fn(&amp;'static ())&gt;` are still distinct.

----

There's a bit more that can be cleaned up. In codegen, we can stop using `PolyExistentialTraitRef` basically everywhere. We can also fix SMIR to stop storing `PolyExistentialTraitRef` in its vtable allocations.

As for testing, it's difficult to actually turn this into something that can be tested with `rustc_dump_vtable`, since having multiple supertraits that are identical is a recipe for ambiguity errors. Maybe someone else is more creative with getting that attr to work, since the tests I added being run-pass tests is a bit unsatisfying. Miri also doesn't help here, since it doesn't really generate vtables that are offset by an index in the same way as codegen.

r? `@lcnr` for the vibe check? Or reassign, idk. Maybe let's talk about whether this makes sense.

&lt;sup&gt;(I guess an alternative would also be to not do any deduplication of vtable supertraits (or only a really conservative subset) rather than trying to normalize and deduplicate more faithfully here. Not sure if that works and is sufficient tho.)&lt;/sup&gt;

cc `@steffahn` -- ty for the minimizations
cc `@WaffleLapkin` -- since you're overseeing the feature stabilization :3

Fixes #135315
Fixes #135316
</content>
</entry>
<entry>
<title>introduce `ty::Value`</title>
<updated>2025-01-30T16:47:44+00:00</updated>
<author>
<name>Lukas Markeffsky</name>
<email>@</email>
</author>
<published>2025-01-27T03:30:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=10fc0b159ee6e5281bf38f65680082961dd7bec3'/>
<id>urn:sha1:10fc0b159ee6e5281bf38f65680082961dd7bec3</id>
<content type='text'>
Co-authored-by: FedericoBruzzone &lt;federico.bruzzone.i@gmail.com&gt;
</content>
</entry>
<entry>
<title>Do not treat vtable supertraits as distinct when bound with different bound vars</title>
<updated>2025-01-30T15:33:58+00:00</updated>
<author>
<name>Michael Goulet</name>
<email>michael@errs.io</email>
</author>
<published>2025-01-10T04:36:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=fdc4bd22b7b8117f4a3864c342773df600f5b956'/>
<id>urn:sha1:fdc4bd22b7b8117f4a3864c342773df600f5b956</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>Rename ty_def_id so people will stop using it by accident</title>
<updated>2024-12-13T16:36:38+00:00</updated>
<author>
<name>Michael Goulet</name>
<email>michael@errs.io</email>
</author>
<published>2024-12-13T16:18:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=efb66e7e385da37015925b23c199efdf3b246d35'/>
<id>urn:sha1:efb66e7e385da37015925b23c199efdf3b246d35</id>
<content type='text'>
</content>
</entry>
</feed>
