Skip to content

Commit c371ea5

Browse files
committed
---
yaml --- r: 223730 b: refs/heads/beta c: 69579e4 h: refs/heads/master v: v3
1 parent 67f1d97 commit c371ea5

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 84f9c61c69d311457d7a259be95876f5e4f5825e
26+
refs/heads/beta: 69579e4d37849fe64cbdfc7e40dc614af802704d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 938f5d7af401e2d8238522fed4a612943b6e77fd
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/libstd/ffi/c_str.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,4 +538,19 @@ mod tests {
538538
let owned = unsafe { CStr::from_ptr(ptr).to_owned() };
539539
assert_eq!(owned.as_bytes_with_nul(), data);
540540
}
541+
542+
#[test]
543+
fn equal_hash() {
544+
use hash;
545+
546+
let data = b"123\xE2\xFA\xA6\0";
547+
let ptr = data.as_ptr() as *const libc::c_char;
548+
let cstr: &'static CStr = unsafe { CStr::from_ptr(ptr) };
549+
550+
let cstr_hash = hash::hash::<_, hash::SipHasher>(&cstr);
551+
let cstring_hash =
552+
hash::hash::<_, hash::SipHasher>(&CString::new(&data[..data.len() - 1]).unwrap());
553+
554+
assert_eq!(cstr_hash, cstring_hash);
555+
}
541556
}

branches/beta/src/libstd/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
#![feature(wrapping)]
151151
#![feature(zero_one)]
152152
#![cfg_attr(windows, feature(str_utf16))]
153-
#![cfg_attr(test, feature(float_from_str_radix, range_inclusive, float_extras))]
153+
#![cfg_attr(test, feature(float_from_str_radix, range_inclusive, float_extras, hash_default))]
154154
#![cfg_attr(test, feature(test, rustc_private, float_consts))]
155155
#![cfg_attr(target_env = "msvc", feature(link_args))]
156156

0 commit comments

Comments
 (0)