Propagate container across object cast by pnkfelix · Pull Request #22012 · rust-lang/rust (original) (raw)
@nrc when you say "so x as Box is essentially compiled as (x: Box<Foo>) as Box<Foo>
", you mean that is what you do on your branch?
If so, then I think that should be fine; the important thing was getting the type-hint that x
has some Box<_>
type, at least for my purposes.
If you look at appendix b from the most recent box/placement RFC, it shows the particular place where I needed this PR, namely the bit that says:
#[cfg(coerce_works3)] // (This one assumes PR 22012 has landed) pub fn coerce<'a, F>(f: F) -> BoxFn<'a> where F: Fn(), F: 'a { box_!( f ) as BoxFn }
so you should be able to take that code, put it into a file, and try your branch on it, to make sure you don't regress the behavior here. (I guess I should have maybe put in some tests to ensure this did not get regressed.)
In other words, make sure that this playpen does not stop working, and I'll be happy.