File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ impl Name {
119119 pub fn as_str < ' a > ( & ' a self ) -> & ' a str {
120120 unsafe {
121121 // FIXME #12938: can't use copy_lifetime since &str isn't a &T
122- :: std:: mem:: transmute ( token:: get_name ( * self ) . get ( ) )
122+ :: std:: mem:: transmute :: < & str , & str > ( token:: get_name ( * self ) . get ( ) )
123123 }
124124 }
125125
Original file line number Diff line number Diff line change @@ -668,12 +668,12 @@ impl InternedString {
668668
669669impl BytesContainer for InternedString {
670670 fn container_as_bytes < ' a > ( & ' a self ) -> & ' a [ u8 ] {
671- // FIXME(pcwalton) : This is a workaround for the incorrect signature
671+ // FIXME #12938 : This is a workaround for the incorrect signature
672672 // of `BytesContainer`, which is itself a workaround for the lack of
673673 // DST.
674674 unsafe {
675675 let this = self . get ( ) ;
676- mem:: transmute ( this. container_as_bytes ( ) )
676+ mem:: transmute :: < & [ u8 ] , & [ u8 ] > ( this. container_as_bytes ( ) )
677677 }
678678 }
679679}
Original file line number Diff line number Diff line change @@ -169,17 +169,14 @@ pub fn to_string(f: |&mut State| -> IoResult<()>) -> String {
169169 let mut s = rust_printer ( box MemWriter :: new ( ) ) ;
170170 f ( & mut s) . unwrap ( ) ;
171171 eof ( & mut s. s ) . unwrap ( ) ;
172- unsafe {
172+ let wr = unsafe {
173173 // FIXME(pcwalton): A nasty function to extract the string from an `io::Writer`
174174 // that we "know" to be a `MemWriter` that works around the lack of checked
175175 // downcasts.
176- let obj: TraitObject = mem:: transmute_copy ( & s. s . out ) ;
177- let wr: Box < MemWriter > = mem:: transmute ( obj. data ) ;
178- let result =
179- String :: from_utf8 ( wr. get_ref ( ) . as_slice ( ) . to_vec ( ) ) . unwrap ( ) ;
180- mem:: forget ( wr) ;
181- result. to_string ( )
182- }
176+ let obj: & TraitObject = mem:: transmute ( & s. s . out ) ;
177+ mem:: transmute :: < * mut ( ) , & MemWriter > ( obj. data )
178+ } ;
179+ String :: from_utf8 ( wr. get_ref ( ) . to_vec ( ) ) . unwrap ( )
183180}
184181
185182pub fn binop_to_string ( op : BinOpToken ) -> & ' static str {
You can’t perform that action at this time.
0 commit comments