Skip to content

Pile of rustdoc fixes #13914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@
[submodule "src/compiler-rt"]
path = src/compiler-rt
url = https://github.com/rust-lang/compiler-rt.git
[submodule "src/rt/hoedown"]
path = src/rt/hoedown
url = https://github.com/rust-lang/hoedown.git
4 changes: 2 additions & 2 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# DEPS_<crate>
# These lists are the dependencies of the <crate> that is to be built.
# Rust dependencies are listed bare (i.e. std, green) and native
# dependencies have a "native:" prefix (i.e. native:sundown). All deps
# dependencies have a "native:" prefix (i.e. native:hoedown). All deps
# will be built before the crate itself is built.
#
# TOOL_DEPS_<tool>/TOOL_SOURCE_<tool>
Expand All @@ -63,7 +63,7 @@ DEPS_native := std
DEPS_syntax := std term serialize collections log
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
collections time log
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections \
DEPS_rustdoc := rustc native:hoedown serialize sync getopts collections \
test time
DEPS_flate := std native:miniz
DEPS_arena := std collections
Expand Down
3 changes: 2 additions & 1 deletion mk/dist.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT

PKG_TAR = dist/$(PKG_NAME).tar.gz

PKG_GITMODULES := $(S)src/libuv $(S)src/llvm $(S)src/gyp $(S)src/compiler-rt
PKG_GITMODULES := $(S)src/libuv $(S)src/llvm $(S)src/gyp $(S)src/compiler-rt \
$(S)src/rt/hoedown
PKG_FILES := \
$(S)COPYRIGHT \
$(S)LICENSE-APACHE \
Expand Down
20 changes: 0 additions & 20 deletions mk/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -141,26 +141,6 @@ doc/footer.inc: $(D)/footer.inc | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null

doc/FiraSans-Regular.woff: $(D)/FiraSans-Regular.woff | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null

doc/FiraSans-Medium.woff: $(D)/FiraSans-Medium.woff | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null

doc/Heuristica-Regular.woff: $(D)/Heuristica-Regular.woff | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null

doc/Heuristica-Italic.woff: $(D)/Heuristica-Italic.woff | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null

doc/Heuristica-Bold.woff: $(D)/Heuristica-Bold.woff | doc/
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null

# The (english) documentation for each doc item.

define DEF_SHOULD_BUILD_PDF_DOC
Expand Down
21 changes: 11 additions & 10 deletions mk/rt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@
# that's per-target so you're allowed to conditionally add files based on the
# target.
################################################################################
NATIVE_LIBS := rustrt sundown uv_support morestack miniz context_switch
NATIVE_LIBS := rustrt hoedown uv_support morestack miniz context_switch

# $(1) is the target triple
define NATIVE_LIBRARIES

NATIVE_DEPS_sundown_$(1) := sundown/src/autolink.c \
sundown/src/buffer.c \
sundown/src/stack.c \
sundown/src/markdown.c \
sundown/html/houdini_href_e.c \
sundown/html/houdini_html_e.c \
sundown/html/html_smartypants.c \
sundown/html/html.c
NATIVE_DEPS_hoedown_$(1) := hoedown/src/autolink.c \
hoedown/src/buffer.c \
hoedown/src/document.c \
hoedown/src/escape.c \
hoedown/src/html.c \
hoedown/src/html_blocks.c \
hoedown/src/html_smartypants.c \
hoedown/src/stack.c \
hoedown/src/version.c
NATIVE_DEPS_uv_support_$(1) := rust_uv.c
NATIVE_DEPS_miniz_$(1) = miniz.c
NATIVE_DEPS_rustrt_$(1) := rust_builtin.c \
Expand Down Expand Up @@ -79,7 +80,7 @@ $$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.c $$(MKFILE_DEPS)
@mkdir -p $$(@D)
@$$(call E, compile: $$@)
$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, \
-I $$(S)src/rt/sundown/src -I $$(S)src/rt/sundown/html \
-I $$(S)src/rt/hoedown/src \
-I $$(S)src/libuv/include -I $$(S)src/rt \
$$(RUNTIME_CFLAGS_$(1))) $$<

Expand Down
9 changes: 5 additions & 4 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ ALL_CS := $(wildcard $(S)src/rt/*.cpp \
$(S)src/rt/*/*/*.cpp \
$(S)src/rustllvm/*.cpp)
ALL_CS := $(filter-out $(S)src/rt/miniz.cpp \
$(wildcard $(S)src/rt/sundown/src/*.c) \
$(wildcard $(S)src/rt/sundown/html/*.c) \
$(wildcard $(S)src/rt/hoedown/src/*.c) \
$(wildcard $(S)src/rt/hoedown/bin/*.c) \
,$(ALL_CS))
ALL_HS := $(wildcard $(S)src/rt/*.h \
$(S)src/rt/*/*.h \
Expand All @@ -232,8 +232,8 @@ ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
$(S)src/rt/msvc/typeof.h \
$(S)src/rt/msvc/stdint.h \
$(S)src/rt/msvc/inttypes.h \
$(wildcard $(S)src/rt/sundown/src/*.h) \
$(wildcard $(S)src/rt/sundown/html/*.h) \
$(wildcard $(S)src/rt/hoedown/src/*.h) \
$(wildcard $(S)src/rt/hoedown/bin/*.h) \
,$(ALL_HS))

# Run the tidy script in multiple parts to avoid huge 'echo' commands
Expand Down Expand Up @@ -266,6 +266,7 @@ tidy:
-and -not -name '*.sh' \
| grep '^$(S)src/llvm' -v \
| grep '^$(S)src/libuv' -v \
| grep '^$(S)src/rt/hoedown' -v \
| grep '^$(S)src/gyp' -v \
| grep '^$(S)src/etc' -v \
| grep '^$(S)src/doc' -v \
Expand Down
4 changes: 2 additions & 2 deletions src/doc/complement-cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ use std::str;

let x: Option<~str> = str::from_utf8_owned(~[104u8,105u8]);
let y: ~str = x.unwrap();
~~~~
~~~

To return a [`MaybeOwned`](http://static.rust-lang.org/doc/master/std/str/enum.MaybeOwned.html) use the str helper function [`from_utf8_lossy`](http://static.rust-lang.org/doc/master/std/str/fn.from_utf8_owned.html). This function also replaces non-valid utf-8 sequences with U+FFFD replacement character.

Expand All @@ -71,7 +71,7 @@ use std::str;

let x = bytes!(72u8,"ello ",0xF0,0x90,0x80,"World!");
let y = str::from_utf8_lossy(x);
~~~~
~~~

# File operations

Expand Down
2 changes: 1 addition & 1 deletion src/doc/complement-lang-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ For simplicity, we do not plan to do so. Implementing automatic semicolon insert

**Short answer** set the RUST_LOG environment variable to the name of your source file, sans extension.

``` {.sh .notrust}
```notrust,sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the {...} syntax no longer work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was having some trouble, but I have to admit that I didn't investigate it thoroughly. I'll take a look into this later today.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With some testing, it appears that hoedown doesn't like anything with a space in it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(it doesn't segfault, it appears to just ignore it)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This notation is less verbose anyway.

rustc hello.rs
export RUST_LOG=hello
./hello
Expand Down
2 changes: 1 addition & 1 deletion src/doc/guide-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl Iterator<int> for ZeroStream {
Some(0)
}
}
~~~~
~~~

Reaching the end of the iterator is signalled by returning `None` instead of
`Some(item)`:
Expand Down
32 changes: 11 additions & 21 deletions src/doc/guide-ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ snappy includes a C interface (documented in
The following is a minimal example of calling a foreign function which will
compile if snappy is installed:

~~~~
~~~~no_run
extern crate libc;
use libc::size_t;

#[link(name = "snappy")]
# #[cfg(ignore_this)]
extern {
fn snappy_max_compressed_length(source_length: size_t) -> size_t;
}
# unsafe fn snappy_max_compressed_length(a: size_t) -> size_t { a }

fn main() {
let x = unsafe { snappy_max_compressed_length(100) };
Expand All @@ -46,7 +44,7 @@ keeping the binding correct at runtime.

The `extern` block can be extended to cover the entire snappy API:

~~~~ {.ignore}
~~~~no_run
extern crate libc;
use libc::{c_int, size_t};

Expand All @@ -67,6 +65,7 @@ extern {
fn snappy_validate_compressed_buffer(compressed: *u8,
compressed_length: size_t) -> c_int;
}
# fn main() {}
~~~~

# Creating a safe interface
Expand Down Expand Up @@ -209,19 +208,16 @@ A basic example is:

Rust code:

~~~~
~~~~no_run
extern fn callback(a:i32) {
println!("I'm called from C with value {0}", a);
}

#[link(name = "extlib")]
# #[cfg(ignore)]
extern {
fn register_callback(cb: extern fn(i32)) -> i32;
fn trigger_callback();
}
# unsafe fn register_callback(cb: extern fn(i32)) -> i32 { 0 }
# unsafe fn trigger_callback() { }

fn main() {
unsafe {
Expand Down Expand Up @@ -265,7 +261,7 @@ referenced Rust object.

Rust code:

~~~~
~~~~no_run

struct RustObject {
a: i32,
Expand All @@ -281,15 +277,11 @@ extern fn callback(target: *mut RustObject, a:i32) {
}

#[link(name = "extlib")]
# #[cfg(ignore)]
extern {
fn register_callback(target: *mut RustObject,
cb: extern fn(*mut RustObject, i32)) -> i32;
fn trigger_callback();
}
# unsafe fn register_callback(a: *mut RustObject,
# b: extern fn(*mut RustObject, i32)) -> i32 { 0 }
# unsafe fn trigger_callback() {}

fn main() {
// Create the object that will be referenced in the callback
Expand Down Expand Up @@ -398,9 +390,12 @@ the `link_args` attribute. This attribute is applied to `extern` blocks and
specifies raw flags which need to get passed to the linker when producing an
artifact. An example usage would be:

~~~ {.ignore}
~~~ no_run
#![feature(link_args)]

#[link_args = "-foo -bar -baz"]
extern {}
# fn main() {}
~~~

Note that this feature is currently hidden behind the `feature(link_args)` gate
Expand Down Expand Up @@ -434,15 +429,13 @@ Foreign APIs often export a global variable which could do something like track
global state. In order to access these variables, you declare them in `extern`
blocks with the `static` keyword:

~~~
~~~no_run
extern crate libc;

#[link(name = "readline")]
# #[cfg(ignore)]
extern {
static rl_readline_version: libc::c_int;
}
# static rl_readline_version: libc::c_int = 0;

fn main() {
println!("You have readline version {} installed.",
Expand All @@ -454,16 +447,14 @@ Alternatively, you may need to alter global state provided by a foreign
interface. To do this, statics can be declared with `mut` so rust can mutate
them.

~~~
~~~no_run
extern crate libc;
use std::ptr;

#[link(name = "readline")]
# #[cfg(ignore)]
extern {
static mut rl_prompt: *libc::c_char;
}
# static mut rl_prompt: *libc::c_char = 0 as *libc::c_char;

fn main() {
"[my-awesome-shell] $".with_c_str(|buf| {
Expand All @@ -488,7 +479,6 @@ extern crate libc;
extern "stdcall" {
fn SetEnvironmentVariableA(n: *u8, v: *u8) -> libc::c_int;
}

# fn main() { }
~~~~

Expand Down
4 changes: 2 additions & 2 deletions src/doc/guide-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ fn stringifier(channel: &sync::DuplexStream<~str, uint>) {
}
}
# }
~~~~
~~~

The implementation of `DuplexStream` supports both sending and
receiving. The `stringifier` function takes a `DuplexStream` that can
Expand Down Expand Up @@ -538,7 +538,7 @@ assert!(from_child.recv() == "23".to_owned());
assert!(from_child.recv() == "0".to_owned());

# }
~~~~
~~~

The parent task first calls `DuplexStream` to create a pair of bidirectional
endpoints. It then uses `task::spawn` to create the child task, which captures
Expand Down
Loading