Expand weak alias types before collecting constrained/referenced late bound regions + refactorings by fmease · Pull Request #121344 · rust-lang/rust

@fmease added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-types

Relevant to the types team, which will review and decide on the PR/issue.

F-lazy_type_alias

`#![feature(lazy_type_alias)]`

labels

Feb 20, 2024

fmease

fmease

fmease

fmease

fmease

@fmease fmease changed the title Expand weak alias types before collecting constrained and referenced late bound regions + refactorings Expand weak alias types before collecting constrained & referenced late bound regions + refactorings

Feb 20, 2024

@fmease fmease changed the title Expand weak alias types before collecting constrained & referenced late bound regions + refactorings Expand weak alias types before collecting constrained/referenced late bound regions + refactorings

Feb 20, 2024

fmease

oli-obk

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Feb 20, 2024

@bors bors added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

labels

Feb 20, 2024

@bors bors removed the S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

label

Feb 20, 2024

@bors bors added the S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

label

Feb 20, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Feb 20, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#119203 (Correct the simd_masked_{load,store} intrinsic docs)
 - rust-lang#121277 (Refactor trait implementations in `core::convert::num`.)
 - rust-lang#121322 (Don't ICE when hitting overflow limit in fulfillment loop in next solver)
 - rust-lang#121323 (Don't use raw parameter types in `find_builder_fn`)
 - rust-lang#121344 (Expand weak alias types before collecting constrained/referenced late bound regions + refactorings)
 - rust-lang#121350 (Fix stray trait mismatch in `resolve_associated_item` for `AsyncFn`)
 - rust-lang#121352 (docs: add missing "the" to `str::strip_prefix` doc)

Failed merges:

 - rust-lang#121340 (bootstrap: apply most of clippy's suggestions)

r? `@ghost`
`@rustbot` modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Feb 21, 2024
Rollup merge of rust-lang#121344 - fmease:lta-constr-by-input, r=oli-obk

Expand weak alias types before collecting constrained/referenced late bound regions + refactorings

Fixes rust-lang#114220.
Follow-up to rust-lang#120780.

r? `@oli-obk`

@fmease fmease deleted the lta-constr-by-input branch

February 21, 2024 04:08

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

May 15, 2024
…cts, r=compiler-errors

Also expand weak alias tys inside consts inside `expand_weak_alias_tys`

Ever since rust-lang#121344 has been merged, I couldn't let go of the fear that I might've slipped a tiny bug into rustc (:P).

Checking the type flags of the `Const` is strictly more correct than only checking the ones of the `Const`'s `Ty`. I don't think it's possible to trigger an ICE rn (i.e., one of the two `bug!("unexpected weak alias type")` I added in branches where `expand_weak_alias_tys` should've expanded *all* weak alias tys) because presently const exprs aren't allowed to capture late-bound vars. To be future-proof however, we should iron this out.

A possible reproducer would be the following if I'm not mistaken (currently fails to compile due to the aforementioned restriction):

```rs
#![feature(lazy_type_alias, adt_const_params, generic_const_exprs)]

type F = for<'a> fn(A<{ S::<Weak<'a>>(loop {}) }>) -> &'a ();

type A<const N: S<Weak<'static>>> = ();

#[derive(PartialEq, Eq, std::marker::ConstParamTy)]
struct S<T>(T);

type Weak<'a> = &'a ();
```

Whether a late-bound region should actually be considered constrained by a const expr is a separate question — one which we don't need to answer until / unless we actually allow them in such contexts (probable answer: only inside the return exprs of a block but not inside the stmts).

r? oli-obk (he's not available rn but that's fine) or types or compiler

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

May 15, 2024
Rollup merge of rust-lang#124990 - fmease:expand-weak-aliases-within-cts, r=compiler-errors

Also expand weak alias tys inside consts inside `expand_weak_alias_tys`

Ever since rust-lang#121344 has been merged, I couldn't let go of the fear that I might've slipped a tiny bug into rustc (:P).

Checking the type flags of the `Const` is strictly more correct than only checking the ones of the `Const`'s `Ty`. I don't think it's possible to trigger an ICE rn (i.e., one of the two `bug!("unexpected weak alias type")` I added in branches where `expand_weak_alias_tys` should've expanded *all* weak alias tys) because presently const exprs aren't allowed to capture late-bound vars. To be future-proof however, we should iron this out.

A possible reproducer would be the following if I'm not mistaken (currently fails to compile due to the aforementioned restriction):

```rs
#![feature(lazy_type_alias, adt_const_params, generic_const_exprs)]

type F = for<'a> fn(A<{ S::<Weak<'a>>(loop {}) }>) -> &'a ();

type A<const N: S<Weak<'static>>> = ();

#[derive(PartialEq, Eq, std::marker::ConstParamTy)]
struct S<T>(T);

type Weak<'a> = &'a ();
```

Whether a late-bound region should actually be considered constrained by a const expr is a separate question — one which we don't need to answer until / unless we actually allow them in such contexts (probable answer: only inside the return exprs of a block but not inside the stmts).

r? oli-obk (he's not available rn but that's fine) or types or compiler

@fmease fmease added the T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

label

Oct 9, 2025