Skip to content

Commit 3699156

Browse files
committed
---
yaml --- r: 235313 b: refs/heads/stable c: 69579e4 h: refs/heads/master i: 235311: 02ab304 v: v3
1 parent d51c364 commit 3699156

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
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 84f9c61c69d311457d7a259be95876f5e4f5825e
32+
refs/heads/stable: 69579e4d37849fe64cbdfc7e40dc614af802704d
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

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