Skip to content

Commit 582c2eb

Browse files
committed
---
yaml --- r: 228242 b: refs/heads/try c: 69579e4 h: refs/heads/master v: v3
1 parent 92857e7 commit 582c2eb

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 84f9c61c69d311457d7a259be95876f5e4f5825e
4+
refs/heads/try: 69579e4d37849fe64cbdfc7e40dc614af802704d
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/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/try/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)