Conversation
jchlanda
marked this pull request as draft
July 6, 2026 10:39
jchlanda
force-pushed
the
jakub/pac_config
branch
from
July 7, 2026 08:05
1c82b8f to
cf64be8
Compare
jchlanda
force-pushed
the
jakub/pac_ty_disc
branch
from
July 8, 2026 12:12
f8b5f7b to
79d7f97
Compare
jchlanda
force-pushed
the
jakub/pac_config
branch
3 times, most recently
from
July 9, 2026 11:37
24bde9f to
809c245
Compare
jchlanda
force-pushed
the
jakub/pac_ty_disc
branch
6 times, most recently
from
July 9, 2026 14:59
5b7b3bd to
f3316ab
Compare
jchlanda
force-pushed
the
jakub/pac_config
branch
from
July 13, 2026 08:18
809c245 to
7e15238
Compare
jchlanda
force-pushed
the
jakub/pac_ty_disc
branch
from
July 13, 2026 09:28
f3316ab to
927c43e
Compare
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
The macro is used in expressions, but the arm for eliminating a trailing comma introduces a semicolon.
```
error: lifetime may not live long enough
--> $DIR/higher-ranked-return.rs:11:46
|
LL | let x = async move |x: &str| -> &str {
| ________________________________-________-____^
| | | |
| | | let's call the lifetime of this reference `'2`
| | let's call the lifetime of this reference `'1`
LL | | x
LL | | };
| |_________^ returning this value requires that `'1` must outlive `'2`
```
instead of
```
error: lifetime may not live long enough
--> $DIR/higher-ranked-return.rs:11:46
|
LL | let x = async move |x: &str| -> &str {
| ________________________________-________----_^
| | | |
| | | return type of async closure `{async closure body@$DIR/higher-ranked-return.rs:11:46: 13:10}` contains a lifetime `'2`
| | let's call the lifetime of this reference `'1`
LL | | x
LL | | };
| |_________^ returning this value requires that `'1` must outlive `'2`
```
This optimisation is currently broken on s390x[^1]. It looks like a big-endian issue in general. but as we only know about the test fails on s390x we only disable it there. Should be reenabled when the problem is fixed and llvm backend is updated. [^1]: llvm/llvm-project#208712
emit `(lldb)` prefix to make commands more distinct As discussed in rust-lang#158298 r? @Kobzol, @jieyouxu
…-actions, r=jieyouxu Update actions/checkout action to v7 This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://redirect.github.com/actions/checkout) | action | major | `v5` → `v7.0.0` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v7.0.0`](https://redirect.github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v700) [Compare Source](https://redirect.github.com/actions/checkout/compare/v6.0.3...v7.0.0) - Block checking out fork PR for pull\_request\_target and workflow\_run by [@&rust-lang#8203;aiqiaoy](https://redirect.github.com/aiqiaoy) in [#&rust-lang#8203;2454](https://redirect.github.com/actions/checkout/pull/2454) - Bump actions/publish-immutable-action from 0.0.3 to 0.0.4 in the minor-actions-dependencies group across 1 directory by [@&rust-lang#8203;dependabot](https://redirect.github.com/dependabot)\[bot] in [#&rust-lang#8203;2458](https://redirect.github.com/actions/checkout/pull/2458) - Bump flatted from 3.3.1 to 3.4.2 by [@&rust-lang#8203;dependabot](https://redirect.github.com/dependabot)\[bot] in [#&rust-lang#8203;2460](https://redirect.github.com/actions/checkout/pull/2460) - Bump js-yaml from 4.1.0 to 4.2.0 by [@&rust-lang#8203;dependabot](https://redirect.github.com/dependabot)\[bot] in [#&rust-lang#8203;2461](https://redirect.github.com/actions/checkout/pull/2461) - Bump [@&rust-lang#8203;actions/core](https://redirect.github.com/actions/core) and [@&rust-lang#8203;actions/tool-cache](https://redirect.github.com/actions/tool-cache) and Remove uuid by [@&rust-lang#8203;dependabot](https://redirect.github.com/dependabot)\[bot] in [#&rust-lang#8203;2459](https://redirect.github.com/actions/checkout/pull/2459) - upgrade module to esm and update dependencies by [@&rust-lang#8203;aiqiaoy](https://redirect.github.com/aiqiaoy) in [#&rust-lang#8203;2463](https://redirect.github.com/actions/checkout/pull/2463) - Bump the minor-npm-dependencies group across 1 directory with 3 updates by [@&rust-lang#8203;dependabot](https://redirect.github.com/dependabot)\[bot] in [#&rust-lang#8203;2462](https://redirect.github.com/actions/checkout/pull/2462) ### [`v6.0.3`](https://redirect.github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v603) [Compare Source](https://redirect.github.com/actions/checkout/compare/v6.0.2...v6.0.3) - Fix checkout init for SHA-256 repositories by [@&rust-lang#8203;yaananth](https://redirect.github.com/yaananth) in [#&rust-lang#8203;2439](https://redirect.github.com/actions/checkout/pull/2439) - fix: expand merge commit SHA regex and add SHA-256 test cases by [@&rust-lang#8203;yaananth](https://redirect.github.com/yaananth) in [#&rust-lang#8203;2414](https://redirect.github.com/actions/checkout/pull/2414) ### [`v6.0.2`](https://redirect.github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v602) [Compare Source](https://redirect.github.com/actions/checkout/compare/v6.0.1...v6.0.2) - Fix tag handling: preserve annotations and explicit fetch-tags by [@&rust-lang#8203;ericsciple](https://redirect.github.com/ericsciple) in [#&rust-lang#8203;2356](https://redirect.github.com/actions/checkout/pull/2356) ### [`v6.0.1`](https://redirect.github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v601) [Compare Source](https://redirect.github.com/actions/checkout/compare/v6...v6.0.1) - Add worktree support for persist-credentials includeIf by [@&rust-lang#8203;ericsciple](https://redirect.github.com/ericsciple) in [#&rust-lang#8203;2327](https://redirect.github.com/actions/checkout/pull/2327) ### [`v6.0.0`](https://redirect.github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v600) [Compare Source](https://redirect.github.com/actions/checkout/compare/v5.0.1...v6) - Persist creds to a separate file by [@&rust-lang#8203;ericsciple](https://redirect.github.com/ericsciple) in [#&rust-lang#8203;2286](https://redirect.github.com/actions/checkout/pull/2286) - Update README to include Node.js 24 support details and requirements by [@&rust-lang#8203;salmanmkc](https://redirect.github.com/salmanmkc) in [#&rust-lang#8203;2248](https://redirect.github.com/actions/checkout/pull/2248) ### [`v5.0.1`](https://redirect.github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v501) [Compare Source](https://redirect.github.com/actions/checkout/compare/v5...v5.0.1) - Port v6 cleanup to v5 by [@&rust-lang#8203;ericsciple](https://redirect.github.com/ericsciple) in [#&rust-lang#8203;2301](https://redirect.github.com/actions/checkout/pull/2301) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - Between 12:00 AM and 03:59 AM, only on Monday (`* 0-3 * * 1`) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rust-lang/rust). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNjUuMSIsInVwZGF0ZWRJblZlciI6IjQzLjI2NS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
…nathanBrouwer Rollup of 18 pull requests Successful merges: - rust-lang#150679 (dirfd file operations (2/4)) - rust-lang#158758 (Rename `lazy_type_alias` feature gate to `checked_type_aliases` ) - rust-lang#159177 (Explicitly materialize debuginfo tests for all debuggers) - rust-lang#159392 (Update Rust crate rand to v0.9.3 [SECURITY]) - rust-lang#159393 (Update Rust crate rkyv to v0.8.16 [SECURITY]) - rust-lang#159394 (Update Rust crate tar to v0.4.46 [SECURITY]) - rust-lang#159395 (Update Rust crate tracing-subscriber [SECURITY]) - rust-lang#159193 (Port compiletest's CLI to clap) - rust-lang#158992 (Shorten types more when only interesting part is lifetimes) - rust-lang#159226 (Track extra_lifetime_params_map per-owner) - rust-lang#159273 (tidy: document u64 limit for numeric sort keys) - rust-lang#159322 (Fix safety doc in intrinsics::simd) - rust-lang#159329 (Fix the stale metrics directory warning) - rust-lang#159357 (Add regression tests for two fixed issues) - rust-lang#159360 (Remove FIXMEs referencing rust-lang#44232) - rust-lang#159375 (make a couple codegen-llvm tests compatible with 2021 edition) - rust-lang#159381 (emit `(lldb)` prefix to make commands more distinct) - rust-lang#159396 (Update actions/checkout action to v7)
…r=WaffleLapkin interpret: properly check for inhabitedness of nested references This implements the opsem from the ongoing FCP in rust-lang/unsafe-code-guidelines#413. The bit we were previously missing is that transmuting a `&&!` into existence was not caught as being immediate UB -- only the `&!` case behaved as expected. I did not adjust the layout computation because when we compute the layout of `&T`, we cannot know the layout of `T` (as that might be recursive). r? @oli-obk
Alongside Rust implementation of LLVM's SipHash-2-4.
This is only to be used when emitting an operand bundle, which might not have access to an Instance of the function, but for which FnAbi is guaranteed to be correct.
Start moving away from global schema, by cloning it into users. Helpers for fn ptr type discrimination status and value of the key.
This is a move away from a blind bitcast between the types. Now, when dealing with function pointers, transmute will detect a domain change (change of fn ptr type) and issue resigning.
As the libc changes was merged in to the main we do not need to patch it. cc-rs still needs to be patched as compiler/rustc_llvm/Cargo.toml still pins to an old version: cc = "=1.2.16"
…g get_fn_addr call sites
jchlanda
force-pushed
the
jakub/pac_ty_disc
branch
from
July 17, 2026 06:56
c224581 to
cff5996
Compare
jchlanda
pushed a commit
that referenced
this pull request
Jul 30, 2026
codegen: skip stores for entirely-uninit constant aggregate fields, attempt #2 This reverts both rust-lang#159825 and rust-lang#157797, and goes back to the original fix from rust-lang#157797, albeit with a small refactor to share code between the now three branches that do the same check. This preserves the original issue (rust-lang#157743) in a fixed state, but avoids the whack-a-mole the initially landed attempt created. Fixes: rust-lang#159867 r? @oli-obk
jchlanda
pushed a commit
that referenced
this pull request
Sep 1, 2026
…er_types, r=BoxyUwU fix ICE in generic_const_parameter_types with inherents tracking issue: rust-lang#137626 relevant PR where the code was added: rust-lang#154853 (fyi ping @lapla-cogito - nws that this was buggy, it's extreeeemely subtle and easy to miss! ❤️ I mean, I also reviewed that PR and missed it too :3 ) discovered when implementing a change that explicitly tracks whether the args for inherent associated consts are in "self form" or "impl form" Following along the test case: - `normalize_canonicalized_inherent_projection` is called with `AliasTermKind::InherentConst` with the generic args being in "self form", i.e. `[ThreeTypes<u8, u16, u32>]` - `traits::normalize_inherent_projection` is called with said alias - it calls `compute_inherent_assoc_term_args`, which does the dance of generating fresh vars for each param in the impl block, equating with the self type, and returning what the fresh vars solved to. This converts from "self args" to "impl args", i.e. `[u8, u16, u32]` - it then calls `const_of_item` and instantiates with `[u8, u16, u32]`. this is correct and good, `const_of_item` expects "impl form" args. - it then calls `push_const_arg_has_type_obligation` - which calls `type_of` and instantiates with `[u8, u16, u32]` to fetch the type of the const, to be able to register a `ConstArgHasType`. this is correct and good, `type_of` expects "impl form" args. - `traits::normalize_inherent_projection` returns, dropping the impl form args it computed - `normalize_canonicalized_inherent_projection` calls `ocx.register_obligations(const_arg_has_type_obligation(...))`, passing `goal`. Remember that `goal` has the original "self args" generic arg format. - `const_arg_has_type_obligation` calls `type_of` and instantiates with `[ThreeTypes<u8, u16, u32>]`. This is no good very bad!! `type_of` expects "impl form" args, not "self form"!! - ICE!! `type parameter T3/#2 (T3/#2/2) out of range when instantiating, args=[ThreeTypes<u8, u16, u32>]` The reason I filed this under `feature(generic_const_parameter_types)` is because for this bug to manifest, `type_of` must return a type that actually references a generic param to be able to trigger an ICE. Otherwise, the buggy incorrect args are silently ignored and compilation continues "fine". The fix: `normalize_inherent_projection` already registers a `ConstArgHasType`. why are we doing it a second time. just delete it. 💀 r? @BoxyUwU
jchlanda
pushed a commit
that referenced
this pull request
Sep 16, 2026
…ods, r=petrochenkov
delegation: supporting inherent impls
This PR adds support for delegation to inherent impl functions on the delegation side.
Support for inherent impls in delegation consists of two problems: we need to resolve inherent function through `ProbeContext` routine and then we need to generate delegation function knowing the `DefId` of the signature function. The first problem is a fundamental problem given current compiler architecture, and it is not solved in this PR. To imitate working resolution for tests we adopt simple resolution by name only in inherent impls (not trait impls, which would work if we implement fair resolution through `ProbeContext`). A `resolve_type_relative_delegations` query was created which tries to resolve unresolved delegations after resolve stage. In future, when we will be able to fairly resolve delegations through `ProbeContext` contents of this query can be changed and all other logic implemented in this pull request will work.
## Free to inherent impl
Unlike free to trait delegation where we generated explicit `Self` param, here we just use default parameter.
```rust
struct X<'a, T, const B: bool>(...);
impl<'a, T, const B: bool> X<'a, T, B> {
fn foo<'b, U, const X: usize>(&self) { ... }
}
reuse X::<'static, (), false>::foo as foo1;
reuse X::<'static, (), false,>::foo::<'static, (), 123> as foo3;
//Desugaring:
#[attr = Inline(Hint)]
fn foo1<'b, U, const X: _>(self: _) -> _ where
'b:'b { X<'static, (), false>::foo::<'b, U, X>(self) }
#[attr = Inline(Hint)]
fn foo3(self: _) -> _ { X<'static, (), false>::foo::<'static, (), 123>(self) }
```
## Trait to inherent impl
In trait to inherent impl delegation we replace the type of self parameter from impl's type to `Self` generic param (if the signature function is a method).
```rust
trait Trait {
reuse X::<'static, (), false>::foo as foo1;
reuse X::<'static, (), false,>::foo::<'static, (), true> as foo3;
}
// Desugaring:
trait Trait {
#[attr = Inline(Hint)]
fn foo1<'b, U, const X: _>(self: _) -> _ where
'b:'b { X<'static, (), false>::foo::<'b, U, X>(self) }
#[attr = Inline(Hint)]
fn foo3(self: _)
-> _ { X<'static, (), false>::foo::<'static, (), 123>(self) }
}
```
Note that we didn't specified target expression, so we would get errors like:
```rust
error[E0308]: mismatched types
--> $DIR/xd.rs:10:14
|
LL | trait Trait {
| ----------- found this type parameter
LL | reuse X::foo;
| ^^^
| |
| expected `&X<'_, T, B>`, found `&Self`
| arguments to this function are incorrect
|
= note: expected reference `&X<'_, T, B>`
found reference `&Self`
```
## Trait impl to inherent impl
Here the resolution should look signature in trait as in other cases where we delegate from trait impl. We generate function whose signature matches the resolved function in trait. We propagate only child generics if they are not specified.
```rust
trait Trait {
fn foo<A, B, C>(&self) { }
fn foo1<T, U, V>(&self) { }
fn foo2<'a, T, U, V>(&self) where 'a:'a { }
fn foo3(&self) { }
}
impl Trait for X {
reuse X::<'static, (), false>::foo as foo1;
reuse X::<'static, (), false,>::foo::<'static, (), 123> as foo3;
}
// Desugaring:
impl Trait for X<'_> {
#[attr = Inline(Hint)]
fn foo1<T, U, V>(self: _)
-> _ { X<'static, (), false>::foo::<T, U, V>(self) }
#[attr = Inline(Hint)]
fn foo3(self: _)
-> _ { X<'static, (), false>::foo::<'static, (), 123>(self) }
}
```
## Inherent impl to inherent impl
In inherent impl to inherent impl delegation we replace signature self type with delegation parent self type in case of methods.
```rust
trait Trait {
fn foo<A, B, C>(&self) { }
fn foo1<T, U, V>(&self) { }
fn foo2<'a, T, U, V>(&self) where 'a:'a { }
fn foo3(&self) { }
}
struct Y;
impl Trait for Y {
reuse X::<'static, (), false>::foo as foo1;
reuse X::<'static, (), false,>::foo::<'static, (), 123> as foo3;
}
impl Trait for Y {
#[attr = Inline(Hint)]
fn foo1<T, U, V>(self: _)
-> _ { X<'static, (), false>::foo::<T, U, V>(self) }
#[attr = Inline(Hint)]
fn foo3(self: _)
-> _ { X<'static, (), false>::foo::<'static, (), 123>(self) }
}
```
We did not specify target expression so we would get errors like:
```rust
error[E0308]: mismatched types
--> $DIR/xd.rs:12:14
|
LL | reuse X::foo;
| ^^^
| |
| expected `&X<'_, T, B>`, found `Y`
| arguments to this function are incorrect
|
= note: expected reference `&X<'_, T, B>`
found struct `Y`
```
## Generics
After some experiments I think that we should force user to always specify generics for parent segment of delegation to inherent impls. Consider the following example and imagine that we can use fair resolution through `ProbeContext`:
```rust
trait M1 {}
trait M2 {}
struct S1;
struct S2;
impl M1 for S1 {}
impl M2 for S2 {}
struct X<T, U>(T, U);
impl<T: M1> X<T, ()> {
fn foo() {}
}
impl<T: M2> X<T, usize> {
fn foo() {}
}
reuse X::foo;
```
How to resolve `X::foo`? If we generate parent generics (`fn foo<T, U>() { X::<T, U>::foo() }`) which clauses should we inherit? It is impossible to determine which function to reuse, and despite the fact that there may be some cases where it is possible, I don't think that we should write heuristics for that. So always specifying parent generics seems to be a good option. Also I think we should ban infers in parent segment too.
One implementation aspect of how we map generic args for signature and predicates inheritance, as we inherit predicates not from the ADT declaration but from the impl block we need to take generic args from this impl, not from the declaration. So indices of generic args are taken from the impl block and then they are used in mapping and future instantiation:
```rust
struct S<'a, A, const C: usize> {
xd: &'a [A; C],
}
// index of A = 3
// index of C = 4
impl<'a, 'b, 'c, A, const C: usize> S<A, C> {
fn foo_self<'d: 'd, 'e, T, const B: bool>(self) {}
}
trait Trait<'a, AA, BB> where Self: Sized {
reuse S::<(), ()>::foo_self;
// Args: [Self/#0, 'a/#1, AA/#2, BB/#3, '{region error}, 'd/rust-lang#4, (), {const error}, T/rust-lang#5, B/rust-lang#6]
// Mapping: {0: 0, 7: 9, 5: 5, 3: 6, 6: 8, 4: 7}, A (index 3) is mapped into index 6 (`()`), C (index 4) mapped into index 7 (const error)
}
```
## Other concerns
### Glob and list delegations
List delegations are supported, glob delegations are not supported:
```rust
struct X;
impl X {
fn foo(&self) {}
fn foo2(&self) {}
}
struct Y;
impl Y {
reuse X::{foo, foo2} { X }
}
impl Y {
reuse X::*;
//~^ ERROR: expected trait, found struct `X`
}
```
### Self type adjustments and target expression deletion
Adjustments for receiver are applied, adjustments for other parameters whose types contain `Self` are not applied as `Self` acts as a type alias to the struct, not a generic param which will can get replaced. The deletion of target expression should work as before.
```rust
enum X {
...
}
impl X {
fn static_f() {}
fn by_value(self) {}
fn by_ref(&self) {}
fn by_mut_ref(&mut self) {}
}
struct Y;
impl Y {
fn get_x(&self) -> X { X }
reuse X::{static_f, by_value, by_ref, by_mut_ref} { self.get_x() }
}
impl Y {
fn get_x(&self) -> X { X }
#[attr = Inline(Hint)]
fn static_f() -> _ { X::static_f() }
#[attr = Inline(Hint)]
fn by_value(self: _) -> _ { X::by_value(self.get_x()) }
#[attr = Inline(Hint)]
fn by_ref(self: _) -> _ { X::by_ref(self.get_x()) }
#[attr = Inline(Hint)]
fn by_mut_ref(self: _) -> _ { X::by_mut_ref(self.get_x()) }
}
fn main() {
let y = Y;
y.by_ref();
y.by_mut_ref();
//~^ ERROR: cannot borrow `y` as mutable, as it is not declared as mutable
y.by_value();
let y = &Y;
y.by_value();
//~^ ERROR: cannot move out of `*y` which is behind a shared reference
y.by_ref();
y.by_mut_ref();
//~^ ERROR: cannot borrow `*y` as mutable, as it is behind a `&` reference
let y = &mut Y;
y.by_value();
//~^ ERROR: cannot move out of `*y` which is behind a mutable reference
y.by_ref();
y.by_mut_ref();
}
```
### Recursive delegations
Works as before, we just check the resolution chain and we do not care whether it came from resolution at resolve stage or from resolution of type relative delegations.
r? @petrochenkov
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.