Skip to content

Commit 774c9ae

Browse files
committed
move strdup_uniq lang item to std::str
1 parent 768c9a4 commit 774c9ae

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/libstd/str.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,14 @@ pub mod raw {
959959
::cast::transmute(v)
960960
}
961961

962+
#[lang="strdup_uniq"]
963+
#[cfg(not(test))]
964+
#[allow(missing_doc)]
965+
#[inline]
966+
pub unsafe fn strdup_uniq(ptr: *u8, len: uint) -> ~str {
967+
from_buf_len(ptr, len)
968+
}
969+
962970
/// Create a Rust string from a null-terminated C string
963971
pub unsafe fn from_c_str(buf: *libc::c_char) -> ~str {
964972
let mut curr = buf;

src/libstd/unstable/lang.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,6 @@ pub unsafe fn check_not_borrowed(a: *u8,
9393
borrowck::check_not_borrowed(a, file, line)
9494
}
9595

96-
#[lang="strdup_uniq"]
97-
#[inline]
98-
pub unsafe fn strdup_uniq(ptr: *c_uchar, len: uint) -> ~str {
99-
str::raw::from_buf_len(ptr, len)
100-
}
101-
10296
#[lang="annihilate"]
10397
pub unsafe fn annihilate() {
10498
::cleanup::annihilate()

0 commit comments

Comments
 (0)