Rollup merge of #46858 - QuietMisdreavus:external-doc-error, r=estebank
tweaks and fixes for doc(include) This PR makes a handful of changes around `#[doc(include="file.md")]` (https://github.com/rust-lang/rust/issues/44732): * Turns errors when loading files into full errors. This matches the original RFC text. * Makes the `missing_docs` lint check for `#[doc(include="file.md")]` as well as regular `#[doc="text"]` attributes. * Loads files included by `#[doc(include="file.md")]` into dep-info, mirroring the behavior of `include_str!()` and friends. * Adds or modifies tests to check for all of these.
This commit is contained in:
commit
696e951fe9
7 changed files with 56 additions and 9 deletions
16
src/test/compile-fail/external-doc-error.rs
Normal file
16
src/test/compile-fail/external-doc-error.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(external_doc)]
|
||||
|
||||
#[doc(include = "not-a-file.md")] //~ ERROR: couldn't read
|
||||
pub struct SomeStruct;
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -8,7 +8,7 @@ ifneq ($(shell uname),FreeBSD)
|
|||
ifndef IS_WINDOWS
|
||||
all:
|
||||
$(RUSTC) --emit dep-info main.rs
|
||||
$(CGREP) "input.txt" "input.bin" < $(TMPDIR)/main.d
|
||||
$(CGREP) "input.txt" "input.bin" "input.md" < $(TMPDIR)/main.d
|
||||
else
|
||||
all:
|
||||
|
||||
|
|
|
|||
1
src/test/run-make/include_bytes_deps/input.md
Normal file
1
src/test/run-make/include_bytes_deps/input.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Hello, world!
|
||||
|
|
@ -8,6 +8,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(external_doc)]
|
||||
|
||||
#[doc(include="input.md")]
|
||||
pub struct SomeStruct;
|
||||
|
||||
pub fn main() {
|
||||
const INPUT_TXT: &'static str = include_str!("input.txt");
|
||||
const INPUT_BIN: &'static [u8] = include_bytes!("input.bin");
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![feature(external_doc)]
|
||||
#![deny(missing_doc)]
|
||||
|
||||
#[doc(include="external-cross-doc.md")]
|
||||
pub struct NeedMoreDocs;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue