Skip to content

Commit dab4fda

Browse files
aochagaviaalexcrichton
authored andcommitted
---
yaml --- r: 153728 b: refs/heads/try2 c: 0fe894e h: refs/heads/master v: v3
1 parent 544f88d commit dab4fda

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 6e509d3462d20b696a1b5d18f14884b4e391a6ba
8+
refs/heads/try2: 0fe894e49be235ff0ac22231d7fa3579a4192f0a
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libcollections/str.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ pub mod raw {
558558
use core::mem;
559559
use core::raw::Slice;
560560
use core::ptr::RawPtr;
561-
use string::{mod, String};
561+
use string;
562+
use string::String;
562563
use vec::Vec;
563564

564565
use MutableSeq;

branches/try2/src/libcollections/string.rs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ impl String {
4949
}
5050
}
5151

52-
/// Creates a new string buffer from length, capacity, and a pointer.
53-
#[inline]
54-
pub unsafe fn from_raw_parts(length: uint, capacity: uint, ptr: *mut u8) -> String {
55-
String {
56-
vec: Vec::from_raw_parts(length, capacity, ptr),
57-
}
58-
}
59-
6052
/// Creates a new string buffer from the given string.
6153
#[inline]
6254
pub fn from_str(string: &str) -> String {
@@ -65,6 +57,13 @@ impl String {
6557
}
6658
}
6759

60+
/// Deprecated. Replaced by `string::raw::from_parts`
61+
#[inline]
62+
#[deprecated = "Replaced by string::raw::from_parts"]
63+
pub unsafe fn from_raw_parts(length: uint, capacity: uint, ptr: *mut u8) -> String {
64+
raw::from_parts(length, capacity, ptr)
65+
}
66+
6867
#[allow(missing_doc)]
6968
#[deprecated = "obsoleted by the removal of ~str"]
7069
#[inline]
@@ -577,6 +576,18 @@ pub mod raw {
577576
use super::String;
578577
use vec::Vec;
579578

579+
/// Creates a new `String` from length, capacity, and a pointer.
580+
///
581+
/// This is unsafe because:
582+
/// * We call `Vec::from_raw_parts` to get a `Vec<u8>`
583+
/// * We assume that the `Vec` contains valid UTF-8
584+
#[inline]
585+
pub unsafe fn from_parts(length: uint, capacity: uint, ptr: *mut u8) -> String {
586+
String {
587+
vec: Vec::from_raw_parts(length, capacity, ptr),
588+
}
589+
}
590+
580591
/// Converts a vector of bytes to a new `String` without checking if
581592
/// it contains valid UTF-8. This is unsafe because it assumes that
582593
/// the utf-8-ness of the vector has already been validated.

0 commit comments

Comments
 (0)