You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use core::marker::PhantomData;pubtraitTypeTag<'a>:'static {typeType: ?Sized;}pubunsafetraitPointerTag<'a>:TypeTag<'a>whereSelf::Type:Sized,{typePointee:TypeTag<'a>;fninto_raw(this:Self::Type) -> *mut <Self::PointeeasTypeTag<'a>>::Type;}pubstructRc<I>(PhantomData<I>);impl<'a,I:TypeTag<'a>>TypeTag<'a>forRc<I>{typeType = std::rc::Rc<I::Type>;}unsafeimpl<'a,I:TypeTag<'a>>PointerTag<'a>forRc<I>{typePointee = I;fninto_raw(this:Self::Type) -> *mutI::Type{
std::rc::Rc::into_raw(this)/* as *const I::Type */as*mutI::Type}}
results in the error
error[[E0606]](https://doc.rust-lang.org/nightly/error-index.html#E0606): casting `*const <I as TypeTag<'_>>::Type` as `*mut <I as TypeTag<'a>>::Type` is invalid
--> src/lib.rs:26:9
|
26 | std::rc::Rc::into_raw(this) /* as *const I::Type */ as *mut I::Type
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: vtable kinds may not match
For more information about this error, try `rustc --explain E0606`.
Uncommenting the as *const I::Type lets this compile without error.
…, r=eholk
Check fat pointer metadata compatibility modulo regions
Regions don't really mean anything anyways during hir typeck.
If this `erase_regions` makes anyone nervous, it's probably equally valid to just equate the types using a type relation, but regardless we should _not_ be using strict type equality while region variables are present.
Fixesrust-lang#103384
[playground]
results in the error
Uncommenting the
as *const I::Type
lets this compile without error.Meta
playground 1.66.0-nightly (2022-10-20 dcb3761)
The text was updated successfully, but these errors were encountered: