diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2024-04-24 14:00:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-24 14:00:56 +0200 |
| commit | dc81f6d549d97b4fc148c2700e23425f67296ee5 (patch) | |
| tree | e195905d0e6fe3706d02f1874de9b7e288e7b34b /compiler/rustc_codegen_llvm/src/errors.rs | |
| parent | 453c23f0f53b4234c54bc13a2acd4d3f280f2844 (diff) | |
| parent | 5c55d6a128638c56f1a8cac4bff5b5d206469e63 (diff) | |
| download | rust-dc81f6d549d97b4fc148c2700e23425f67296ee5.tar.gz rust-dc81f6d549d97b4fc148c2700e23425f67296ee5.zip | |
Rollup merge of #123794 - oli-obk:define_opaque_types2, r=lcnr
More DefineOpaqueTypes::Yes
This accepts more code on stable. It is now possible to have match arms return a function item `foo::<ConcreteType>` and a function item `foo::<OpaqueTypeInDefiningScope>` in another, and that will constrain `OpaqueTypeInDefiningScope` to have the hidden type `ConcreteType`. So the following function will now compile, but on master it errors with a type mismatch on the second match arm
```rust
// The function item whose generic params we want to merge.
fn foo<T>(t: T) -> T { t }
// Helper ensuring we can constrain `T` on `F` without explicitly specifying it
fn bind<T, F: FnOnce(T) -> T>(_: T, f: F) -> F { f }
fn k() -> impl Sized {
let x = match true {
true => {
// `f` is `FnDef(foo, [infer_var])`
let f = foo;
// Get a value of an opaque type on stable
let t = k();
// this returns `FnDef(foo, [k::return])`
bind(t, f)
}
false => foo::<()>,
};
todo!()
}
```
r? ``@compiler-errors``
cc https://github.com/rust-lang/rust/issues/116652
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
