File tree Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -183,7 +183,6 @@ fn from_chars(chs: [char]) -> str {
183
183
ret buf;
184
184
}
185
185
186
- // FIXME: not unsafe now
187
186
/*
188
187
Function: from_cstr
189
188
@@ -1371,35 +1370,30 @@ An unsafe buffer of bytes. Corresponds to a C char pointer.
1371
1370
*/
1372
1371
type sbuf = * u8 ;
1373
1372
1373
+ // Module: unsafe
1374
+ //
1375
+ // These functions may create invalid UTF-8 strings and eat your baby.
1374
1376
mod unsafe {
1375
1377
export
1376
1378
// UNSAFE
1377
1379
from_bytes,
1378
1380
from_byte;
1379
1381
1380
- /*
1381
- Function: unsafe::from_bytes
1382
-
1383
- Converts a vector of bytes to a string. Does not verify that the
1384
- vector contains valid UTF-8.
1385
-
1386
- FIXME: stop exporting
1387
- */
1382
+ // Function: unsafe::from_bytes
1383
+ //
1384
+ // Converts a vector of bytes to a string. Does not verify that the
1385
+ // vector contains valid UTF-8.
1388
1386
unsafe fn from_bytes ( v : [ const u8 ] ) -> str unsafe {
1389
1387
let vcopy: [ u8 ] = v + [ 0u8 ] ;
1390
1388
let scopy: str = :: unsafe:: reinterpret_cast ( vcopy) ;
1391
1389
:: unsafe:: leak ( vcopy) ;
1392
1390
ret scopy;
1393
1391
}
1394
1392
1395
- /*
1396
- Function: unsafe::from_byte
1397
-
1398
- Converts a byte to a string. Does not verify that the byte is
1399
- valid UTF-8.
1400
-
1401
- FIXME: stop exporting
1402
- */
1393
+ // Function: unsafe::from_byte
1394
+ //
1395
+ // Converts a byte to a string. Does not verify that the byte is
1396
+ // valid UTF-8.
1403
1397
unsafe fn from_byte ( u : u8 ) -> str { unsafe :: from_bytes ( [ u] ) }
1404
1398
}
1405
1399
You can’t perform that action at this time.
0 commit comments