about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-05-15 07:16:47 +0200
committerGitHub <noreply@github.com>2024-05-15 07:16:47 +0200
commit03ff673dcc7d3e9417062cbec0a5d4d2c232f404 (patch)
treeae300cbd04341f7be76e45287eea51533e075b8c /compiler/rustc_codegen_llvm/src
parent9e7aff794539aa040362f4424eb29207449ffce0 (diff)
parent35a5be2833a555b15a11280e9ed80f9d90fc0809 (diff)
downloadrust-03ff673dcc7d3e9417062cbec0a5d4d2c232f404.tar.gz
rust-03ff673dcc7d3e9417062cbec0a5d4d2c232f404.zip
Rollup merge of #124990 - fmease:expand-weak-aliases-within-cts, r=compiler-errors
Also expand weak alias tys inside consts inside `expand_weak_alias_tys`

Ever since #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
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions