From 774c9aebb3ea7d1cf97bde948b6bdec4badec261 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 10 Aug 2013 13:42:53 -0400 Subject: [PATCH] move `strdup_uniq` lang item to std::str --- src/libstd/str.rs | 8 ++++++++ src/libstd/unstable/lang.rs | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 81c9cde312e..0b270edc534 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -959,6 +959,14 @@ pub mod raw { ::cast::transmute(v) } + #[lang="strdup_uniq"] + #[cfg(not(test))] + #[allow(missing_doc)] + #[inline] + pub unsafe fn strdup_uniq(ptr: *u8, len: uint) -> ~str { + from_buf_len(ptr, len) + } + /// Create a Rust string from a null-terminated C string pub unsafe fn from_c_str(buf: *libc::c_char) -> ~str { let mut curr = buf; diff --git a/src/libstd/unstable/lang.rs b/src/libstd/unstable/lang.rs index 9e7ac1fd7db..f5074e08558 100644 --- a/src/libstd/unstable/lang.rs +++ b/src/libstd/unstable/lang.rs @@ -93,12 +93,6 @@ pub unsafe fn check_not_borrowed(a: *u8, borrowck::check_not_borrowed(a, file, line) } -#[lang="strdup_uniq"] -#[inline] -pub unsafe fn strdup_uniq(ptr: *c_uchar, len: uint) -> ~str { - str::raw::from_buf_len(ptr, len) -} - #[lang="annihilate"] pub unsafe fn annihilate() { ::cleanup::annihilate()