File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed
rustc_data_structures/src Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -34,11 +34,9 @@ pub trait HashStableContext {
3434 fn assert_default_hashing_controls ( & self , msg : & str ) ;
3535}
3636
37- // A type used to work around `Span` not being visible in this crate. It is the same size as
37+ // A type used to work around `Span` not being visible in this crate. It is the same layout as
3838// `Span`.
39- pub struct RawSpan {
40- _data : u64 ,
41- }
39+ pub struct RawSpan ( pub u32 , pub u16 , pub u16 ) ;
4240
4341// A type used to work around `DefId` not being visible in this crate. It is the same size as
4442// `DefId`.
Original file line number Diff line number Diff line change @@ -445,15 +445,12 @@ impl Span {
445445
446446 #[ inline]
447447 pub ( crate ) fn to_raw_span ( self ) -> RawSpan {
448- // SAFETY: we call `to_raw_span` and then `from_raw_span` immediately after, only when
449- // calling `HashStableContext::span_hash_stable`.
450- unsafe { std:: mem:: transmute :: < Span , RawSpan > ( self ) }
448+ RawSpan ( self . lo_or_index , self . len_with_tag_or_marker , self . ctxt_or_parent_or_marker )
451449 }
452450
453451 #[ inline]
454- pub fn from_raw_span ( raw_span : RawSpan ) -> Span {
455- // SAFETY: see the comment in `to_raw_span`.
456- unsafe { std:: mem:: transmute :: < RawSpan , Span > ( raw_span) }
452+ pub fn from_raw_span ( RawSpan ( x, y, z) : RawSpan ) -> Span {
453+ Span { lo_or_index : x, len_with_tag_or_marker : y, ctxt_or_parent_or_marker : z }
457454 }
458455}
459456
You can’t perform that action at this time.
0 commit comments