From 3b818edeba4dbca7c605ca5600f2d1b4b000120b Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Mon, 22 Jul 2013 21:45:33 -0700 Subject: std and extra: use as_c_str instead of as_buf in a couple places These uses are assuming the strings are null terminated, so it should be using `as_c_str` instead of `as_buf` --- src/libstd/rt/borrowck.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libstd/rt') diff --git a/src/libstd/rt/borrowck.rs b/src/libstd/rt/borrowck.rs index 42e545ce1a9..1a468fcf215 100644 --- a/src/libstd/rt/borrowck.rs +++ b/src/libstd/rt/borrowck.rs @@ -76,7 +76,7 @@ unsafe fn fail_borrowed(box: *mut BoxRepr, file: *c_char, line: size_t) { match try_take_task_borrow_list() { None => { // not recording borrows let msg = "borrowed"; - do msg.as_buf |msg_p, _| { + do msg.as_c_str |msg_p| { sys::begin_unwind_(msg_p as *c_char, file, line); } } @@ -92,7 +92,7 @@ unsafe fn fail_borrowed(box: *mut BoxRepr, file: *c_char, line: size_t) { sep = " and at "; } } - do msg.as_buf |msg_p, _| { + do msg.as_c_str |msg_p| { sys::begin_unwind_(msg_p as *c_char, file, line) } } @@ -231,7 +231,7 @@ pub unsafe fn unrecord_borrow(a: *u8, old_ref_count: uint, let br = borrow_list.pop(); if br.box != a || br.file != file || br.line != line { let err = fmt!("wrong borrow found, br=%?", br); - do err.as_buf |msg_p, _| { + do err.as_c_str |msg_p| { sys::begin_unwind_(msg_p as *c_char, file, line) } } -- cgit 1.4.1-3-g733a5