diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index cd58ff3109f..35d0f0a116d 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -530,7 +530,7 @@ extern { fn hoedown_buffer_new(unit: libc::size_t) -> *mut hoedown_buffer; fn hoedown_buffer_puts(b: *mut hoedown_buffer, c: *const libc::c_char); fn hoedown_buffer_free(b: *mut hoedown_buffer); - fn hoedown_buffer_put(b: *mut hoedown_buffer, c: *const libc::c_char, len: libc::size_t); + fn hoedown_buffer_put(b: *mut hoedown_buffer, c: *const u8, len: libc::size_t); } impl hoedown_buffer { @@ -620,7 +620,7 @@ pub fn render(w: &mut fmt::Formatter, Some("rust-example-rendered"), None, playground_button.as_ref().map(String::as_str))); - hoedown_buffer_put(ob, s.as_ptr() as *const libc::c_char, s.len()); + hoedown_buffer_put(ob, s.as_ptr(), s.len()); }) } } @@ -680,7 +680,7 @@ pub fn render(w: &mut fmt::Formatter, {sec}{}", s, lvl = level, id = id, sec = sec); - unsafe { hoedown_buffer_put(ob, text.as_ptr() as *const libc::c_char, text.len()); } + unsafe { hoedown_buffer_put(ob, text.as_ptr(), text.len()); } } extern fn codespan( @@ -697,9 +697,9 @@ pub fn render(w: &mut fmt::Formatter, collapse_whitespace(s) }; - let content = format!("{}", Escape(&content)).replace("\0", "\\0"); + let content = format!("{}", Escape(&content)); unsafe { - hoedown_buffer_put(ob, content.as_ptr() as *const libc::c_char, content.len()); + hoedown_buffer_put(ob, content.as_ptr(), content.len()); } // Return anything except 0, which would mean "also print the code span verbatim". 1 diff --git a/src/test/rustdoc/nul-error.rs b/src/test/rustdoc/nul-error.rs index f20d19d0e59..2c9d07f190d 100644 --- a/src/test/rustdoc/nul-error.rs +++ b/src/test/rustdoc/nul-error.rs @@ -13,6 +13,6 @@ #![crate_name = "foo"] -// @has foo/fn.foo.html '//code' '0' +// @has foo/fn.foo.html '//code' '' #[doc = "Attempted to pass a string containing `\0`"] pub fn foo() {}