File tree 3 files changed +8
-11
lines changed
3 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ impl Name {
119
119
pub fn as_str < ' a > ( & ' a self ) -> & ' a str {
120
120
unsafe {
121
121
// 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 ( ) )
123
123
}
124
124
}
125
125
Original file line number Diff line number Diff line change @@ -668,12 +668,12 @@ impl InternedString {
668
668
669
669
impl BytesContainer for InternedString {
670
670
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
672
672
// of `BytesContainer`, which is itself a workaround for the lack of
673
673
// DST.
674
674
unsafe {
675
675
let this = self . get ( ) ;
676
- mem:: transmute ( this. container_as_bytes ( ) )
676
+ mem:: transmute :: < & [ u8 ] , & [ u8 ] > ( this. container_as_bytes ( ) )
677
677
}
678
678
}
679
679
}
Original file line number Diff line number Diff line change @@ -169,17 +169,14 @@ pub fn to_string(f: |&mut State| -> IoResult<()>) -> String {
169
169
let mut s = rust_printer ( box MemWriter :: new ( ) ) ;
170
170
f ( & mut s) . unwrap ( ) ;
171
171
eof ( & mut s. s ) . unwrap ( ) ;
172
- unsafe {
172
+ let wr = unsafe {
173
173
// FIXME(pcwalton): A nasty function to extract the string from an `io::Writer`
174
174
// that we "know" to be a `MemWriter` that works around the lack of checked
175
175
// 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 ( )
183
180
}
184
181
185
182
pub fn binop_to_string ( op : BinOpToken ) -> & ' static str {
You can’t perform that action at this time.
0 commit comments