diff options
| author | bors <bors@rust-lang.org> | 2022-09-14 18:10:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-14 18:10:51 +0000 |
| commit | e4d2f94a834f0679d18ae03ef47bddb59a2ac042 (patch) | |
| tree | dffa94039be268c9cc81990ba5a42b5f8e7a2c00 | |
| parent | 11c831d6960b96bbf23e788291ddc25c9aa2cb23 (diff) | |
| parent | 6d544a8a4c9ab5cd4b228532e2501980881801b7 (diff) | |
| download | rust-e4d2f94a834f0679d18ae03ef47bddb59a2ac042.tar.gz rust-e4d2f94a834f0679d18ae03ef47bddb59a2ac042.zip | |
Auto merge of #101212 - eholk:dyn-star, r=compiler-errors
Initial implementation of dyn* This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things: * Introduce `dyn_star` feature flag * Adds parsing for `dyn* Trait` types * Defines `dyn* Trait` as a sized type * Adds support for explicit casts, like `42usize as dyn* Debug` * Including const evaluation of such casts * Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope * Adds codegen for method calls, at least for methods that take `&self` Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits. Joint work with `@nikomatsakis` and `@compiler-errors.` r? `@bjorn3`
| -rw-r--r-- | src/base.rs | 4 | ||||
| -rw-r--r-- | src/value_and_place.rs | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/base.rs b/src/base.rs index 2aa11ac2eea..399474d79e3 100644 --- a/src/base.rs +++ b/src/base.rs @@ -701,6 +701,10 @@ fn codegen_stmt<'tcx>( let operand = codegen_operand(fx, operand); operand.unsize_value(fx, lval); } + Rvalue::Cast(CastKind::DynStar, _, _) => { + // FIXME(dyn-star) + unimplemented!() + } Rvalue::Discriminant(place) => { let place = codegen_place(fx, place); let value = place.to_cvalue(fx); diff --git a/src/value_and_place.rs b/src/value_and_place.rs index 2ee98546c99..cfaadca9491 100644 --- a/src/value_and_place.rs +++ b/src/value_and_place.rs @@ -815,7 +815,8 @@ pub(crate) fn assert_assignable<'tcx>( ); // fn(&T) -> for<'l> fn(&'l T) is allowed } - (&ty::Dynamic(from_traits, _), &ty::Dynamic(to_traits, _)) => { + (&ty::Dynamic(from_traits, _, _from_kind), &ty::Dynamic(to_traits, _, _to_kind)) => { + // FIXME(dyn-star): Do the right thing with DynKinds for (from, to) in from_traits.iter().zip(to_traits) { let from = fx.tcx.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), from); |
