From bf77985e25003d0571c5ff70b68923e14b865b87 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 16 Aug 2019 10:38:37 -0400 Subject: [PATCH] Fix broken links using rustdoc nightly Uses cross-crate documentation links so that rustdoc does the hard work of making relative links for us. Requires nightly version of rustdoc in order to generate links based on path names, see https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md for details. --- cranelift/codegen/src/binemit/memorysink.rs | 2 +- cranelift/faerie/src/backend.rs | 2 +- cranelift/frontend/src/frontend.rs | 6 +++--- cranelift/test-all.sh | 6 +++++- cranelift/wasm/src/module_translator.rs | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cranelift/codegen/src/binemit/memorysink.rs b/cranelift/codegen/src/binemit/memorysink.rs index cde6cd9c9a..b543d3e89c 100644 --- a/cranelift/codegen/src/binemit/memorysink.rs +++ b/cranelift/codegen/src/binemit/memorysink.rs @@ -85,7 +85,7 @@ pub trait RelocSink { /// A trait for receiving trap codes and offsets. /// /// If you don't need information about possible traps, you can use the -/// [`NullTrapSink`](binemit/trait.TrapSink.html) implementation. +/// [`NullTrapSink`](NullTrapSink) implementation. pub trait TrapSink { /// Add trap information for a specific offset. fn trap(&mut self, _: CodeOffset, _: SourceLoc, _: TrapCode); diff --git a/cranelift/faerie/src/backend.rs b/cranelift/faerie/src/backend.rs index bed56122f0..a33955a212 100644 --- a/cranelift/faerie/src/backend.rs +++ b/cranelift/faerie/src/backend.rs @@ -38,7 +38,7 @@ pub struct FaerieBuilder { impl FaerieBuilder { /// Create a new `FaerieBuilder` using the given Cranelift target, that /// can be passed to - /// [`Module::new`](cranelift_module/struct.Module.html#method.new]. + /// [`Module::new`](cranelift_module::Module::new) /// /// Faerie output requires that TargetIsa have PIC (Position Independent Code) enabled. /// diff --git a/cranelift/frontend/src/frontend.rs b/cranelift/frontend/src/frontend.rs index a68f131458..0961314559 100644 --- a/cranelift/frontend/src/frontend.rs +++ b/cranelift/frontend/src/frontend.rs @@ -96,7 +96,7 @@ impl FunctionBuilderContext { } } -/// Implementation of the [`InstBuilder`](../codegen/ir/builder/trait.InstBuilder.html) that has +/// Implementation of the [`InstBuilder`](cranelift_codegen::ir::InstBuilder) that has /// one convenience method per Cranelift IR instruction. pub struct FuncInstBuilder<'short, 'long: 'short> { builder: &'short mut FunctionBuilder<'long>, @@ -207,7 +207,7 @@ impl<'short, 'long> InstBuilderBase<'short> for FuncInstBuilder<'short, 'long> { /// modifies with the information stored in the mutable borrowed /// [`FunctionBuilderContext`](struct.FunctionBuilderContext.html). The function passed in /// argument should be newly created with -/// [`Function::with_name_signature()`](../function/struct.Function.html), whereas the +/// [`Function::with_name_signature()`](Function::with_name_signature), whereas the /// `FunctionBuilderContext` can be kept as is between two function translations. /// /// # Errors @@ -391,7 +391,7 @@ impl<'a> FunctionBuilder<'a> { self.func.create_heap(data) } - /// Returns an object with the [`InstBuilder`](../codegen/ir/builder/trait.InstBuilder.html) + /// Returns an object with the [`InstBuilder`](cranelift_codegen::ir::InstBuilder) /// trait that allows to conveniently append an instruction to the current `Ebb` being built. pub fn ins<'short>(&'short mut self) -> FuncInstBuilder<'short, 'a> { let ebb = self diff --git a/cranelift/test-all.sh b/cranelift/test-all.sh index 64f4343bf5..2509430414 100755 --- a/cranelift/test-all.sh +++ b/cranelift/test-all.sh @@ -49,7 +49,11 @@ RUST_BACKTRACE=1 cargo test --all # Make sure the documentation builds. banner "Rust documentation: $topdir/target/doc/cranelift/index.html" -cargo doc +cargo +nightly doc + +# Make sure the documentation doesn't have broken links. +banner "Rust documentation link test" +find ./target/doc -maxdepth 1 -type d -name "cranelift*" | xargs -I{} cargo deadlinks --dir {} # Ensure fuzzer works by running it with a single input # Note LSAN is disabled due to https://github.com/google/sanitizers/issues/764 diff --git a/cranelift/wasm/src/module_translator.rs b/cranelift/wasm/src/module_translator.rs index 669f9154e8..b35d1d4e38 100644 --- a/cranelift/wasm/src/module_translator.rs +++ b/cranelift/wasm/src/module_translator.rs @@ -10,7 +10,7 @@ use cranelift_codegen::timing; use wasmparser::{ModuleReader, SectionCode}; /// Translate a sequence of bytes forming a valid Wasm binary into a list of valid Cranelift IR -/// [`Function`](../codegen/ir/function/struct.Function.html). +/// [`Function`](cranelift_codegen::ir::Function). pub fn translate_module<'data>( data: &'data [u8], environ: &mut dyn ModuleEnvironment<'data>,