2013-05-28 20:44:53 +00:00
|
|
|
// When denying at the crate level, be sure to not get random warnings from the
|
|
|
|
// injected intrinsics by the compiler.
|
2014-10-27 22:37:07 +00:00
|
|
|
#![deny(missing_docs)]
|
2014-03-22 01:05:05 +00:00
|
|
|
#![allow(dead_code)]
|
2015-07-30 22:18:34 +00:00
|
|
|
#![feature(associated_type_defaults)]
|
2013-05-28 20:44:53 +00:00
|
|
|
|
2013-11-26 06:12:14 +00:00
|
|
|
//! Some garbage docs for the crate here
|
2014-03-22 01:05:05 +00:00
|
|
|
#![doc="More garbage"]
|
2013-11-26 06:12:14 +00:00
|
|
|
|
2014-12-05 04:20:09 +00:00
|
|
|
type Typedef = String;
|
2015-02-23 19:33:52 +00:00
|
|
|
pub type PubTypedef = String; //~ ERROR: missing documentation for a type alias
|
2014-12-05 04:20:09 +00:00
|
|
|
|
2013-05-28 20:44:53 +00:00
|
|
|
struct Foo {
|
2015-01-08 10:54:35 +00:00
|
|
|
a: isize,
|
|
|
|
b: isize,
|
2013-05-28 20:44:53 +00:00
|
|
|
}
|
|
|
|
|
2015-02-23 19:33:52 +00:00
|
|
|
pub struct PubFoo { //~ ERROR: missing documentation for a struct
|
|
|
|
pub a: isize, //~ ERROR: missing documentation for a struct field
|
2015-01-08 10:54:35 +00:00
|
|
|
b: isize,
|
2013-05-28 20:44:53 +00:00
|
|
|
}
|
|
|
|
|
2014-10-27 22:37:07 +00:00
|
|
|
#[allow(missing_docs)]
|
2013-05-28 20:44:53 +00:00
|
|
|
pub struct PubFoo2 {
|
2015-01-08 10:54:35 +00:00
|
|
|
pub a: isize,
|
|
|
|
pub c: isize,
|
2013-05-28 20:44:53 +00:00
|
|
|
}
|
|
|
|
|
2013-10-13 02:02:46 +00:00
|
|
|
mod module_no_dox {}
|
2015-02-23 19:33:52 +00:00
|
|
|
pub mod pub_module_no_dox {} //~ ERROR: missing documentation for a module
|
2013-10-13 02:02:46 +00:00
|
|
|
|
2013-05-28 20:44:53 +00:00
|
|
|
/// dox
|
|
|
|
pub fn foo() {}
|
2015-02-23 19:33:52 +00:00
|
|
|
pub fn foo2() {} //~ ERROR: missing documentation for a function
|
2013-05-28 20:44:53 +00:00
|
|
|
fn foo3() {}
|
2014-10-27 22:37:07 +00:00
|
|
|
#[allow(missing_docs)] pub fn foo4() {}
|
2013-05-28 20:44:53 +00:00
|
|
|
|
|
|
|
/// dox
|
2013-11-12 04:17:47 +00:00
|
|
|
pub trait A {
|
|
|
|
/// dox
|
2015-02-12 15:29:52 +00:00
|
|
|
fn foo(&self);
|
2013-11-12 04:17:47 +00:00
|
|
|
/// dox
|
2015-02-12 15:29:52 +00:00
|
|
|
fn foo_with_impl(&self) {}
|
2013-05-28 20:44:53 +00:00
|
|
|
}
|
2015-02-12 15:29:52 +00:00
|
|
|
|
2014-10-27 22:37:07 +00:00
|
|
|
#[allow(missing_docs)]
|
2013-11-12 04:17:47 +00:00
|
|
|
trait B {
|
2015-02-12 15:29:52 +00:00
|
|
|
fn foo(&self);
|
|
|
|
fn foo_with_impl(&self) {}
|
2013-11-12 04:17:47 +00:00
|
|
|
}
|
2015-02-12 15:29:52 +00:00
|
|
|
|
2015-02-23 19:33:52 +00:00
|
|
|
pub trait C { //~ ERROR: missing documentation for a trait
|
2015-03-10 10:28:44 +00:00
|
|
|
fn foo(&self); //~ ERROR: missing documentation for a trait method
|
2015-03-11 21:38:58 +00:00
|
|
|
fn foo_with_impl(&self) {} //~ ERROR: missing documentation for a trait method
|
2015-02-12 15:29:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(missing_docs)]
|
|
|
|
pub trait D {
|
|
|
|
fn dummy(&self) { }
|
2013-11-12 04:17:47 +00:00
|
|
|
}
|
2013-05-28 20:44:53 +00:00
|
|
|
|
2015-02-23 19:07:37 +00:00
|
|
|
/// dox
|
|
|
|
pub trait E {
|
2015-02-23 19:33:52 +00:00
|
|
|
type AssociatedType; //~ ERROR: missing documentation for an associated type
|
|
|
|
type AssociatedTypeDef = Self; //~ ERROR: missing documentation for an associated type
|
2015-02-23 19:07:37 +00:00
|
|
|
|
|
|
|
/// dox
|
|
|
|
type DocumentedType;
|
|
|
|
/// dox
|
|
|
|
type DocumentedTypeDef = Self;
|
|
|
|
/// dox
|
|
|
|
fn dummy(&self) {}
|
|
|
|
}
|
|
|
|
|
2013-05-28 20:44:53 +00:00
|
|
|
impl Foo {
|
2013-11-20 23:15:34 +00:00
|
|
|
pub fn foo() {}
|
|
|
|
fn bar() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PubFoo {
|
2015-02-23 19:33:52 +00:00
|
|
|
pub fn foo() {} //~ ERROR: missing documentation for a method
|
2013-05-28 20:44:53 +00:00
|
|
|
/// dox
|
|
|
|
pub fn foo1() {}
|
|
|
|
fn foo2() {}
|
2014-10-27 22:37:07 +00:00
|
|
|
#[allow(missing_docs)] pub fn foo3() {}
|
2013-05-28 20:44:53 +00:00
|
|
|
}
|
|
|
|
|
2014-10-27 22:37:07 +00:00
|
|
|
#[allow(missing_docs)]
|
2013-05-28 20:44:53 +00:00
|
|
|
trait F {
|
2013-08-09 08:25:24 +00:00
|
|
|
fn a();
|
2013-05-28 20:44:53 +00:00
|
|
|
fn b(&self);
|
|
|
|
}
|
|
|
|
|
|
|
|
// should need to redefine documentation for implementations of traits
|
|
|
|
impl F for Foo {
|
2013-08-09 08:25:24 +00:00
|
|
|
fn a() {}
|
2013-05-28 20:44:53 +00:00
|
|
|
fn b(&self) {}
|
|
|
|
}
|
|
|
|
|
2014-10-27 22:37:07 +00:00
|
|
|
// It sure is nice if doc(hidden) implies allow(missing_docs), and that it
|
2013-05-28 21:53:43 +00:00
|
|
|
// applies recursively
|
|
|
|
#[doc(hidden)]
|
|
|
|
mod a {
|
|
|
|
pub fn baz() {}
|
|
|
|
pub mod b {
|
|
|
|
pub fn baz() {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-02 06:26:45 +00:00
|
|
|
enum Baz {
|
|
|
|
BazA {
|
2015-01-08 10:54:35 +00:00
|
|
|
a: isize,
|
|
|
|
b: isize
|
2013-10-02 06:26:45 +00:00
|
|
|
},
|
|
|
|
BarB
|
|
|
|
}
|
|
|
|
|
2015-02-23 19:33:52 +00:00
|
|
|
pub enum PubBaz { //~ ERROR: missing documentation for an enum
|
|
|
|
PubBazA { //~ ERROR: missing documentation for a variant
|
|
|
|
a: isize, //~ ERROR: missing documentation for a struct field
|
2013-10-02 06:26:45 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
/// dox
|
|
|
|
pub enum PubBaz2 {
|
|
|
|
/// dox
|
|
|
|
PubBaz2A {
|
|
|
|
/// dox
|
2015-01-08 10:54:35 +00:00
|
|
|
a: isize,
|
2013-10-02 06:26:45 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2014-10-27 22:37:07 +00:00
|
|
|
#[allow(missing_docs)]
|
2013-10-02 06:26:45 +00:00
|
|
|
pub enum PubBaz3 {
|
|
|
|
PubBaz3A {
|
2015-01-08 10:54:35 +00:00
|
|
|
b: isize
|
2013-10-02 06:26:45 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2013-05-28 21:53:43 +00:00
|
|
|
#[doc(hidden)]
|
|
|
|
pub fn baz() {}
|
|
|
|
|
2015-08-06 23:36:44 +00:00
|
|
|
|
|
|
|
const FOO: u32 = 0;
|
|
|
|
/// dox
|
|
|
|
pub const FOO1: u32 = 0;
|
|
|
|
#[allow(missing_docs)]
|
|
|
|
pub const FOO2: u32 = 0;
|
|
|
|
#[doc(hidden)]
|
|
|
|
pub const FOO3: u32 = 0;
|
|
|
|
pub const FOO4: u32 = 0; //~ ERROR: missing documentation for a const
|
|
|
|
|
|
|
|
|
|
|
|
static BAR: u32 = 0;
|
|
|
|
/// dox
|
|
|
|
pub static BAR1: u32 = 0;
|
|
|
|
#[allow(missing_docs)]
|
|
|
|
pub static BAR2: u32 = 0;
|
|
|
|
#[doc(hidden)]
|
|
|
|
pub static BAR3: u32 = 0;
|
|
|
|
pub static BAR4: u32 = 0; //~ ERROR: missing documentation for a static
|
|
|
|
|
|
|
|
|
2013-11-12 04:17:47 +00:00
|
|
|
mod internal_impl {
|
|
|
|
/// dox
|
|
|
|
pub fn documented() {}
|
2015-02-23 19:33:52 +00:00
|
|
|
pub fn undocumented1() {} //~ ERROR: missing documentation for a function
|
|
|
|
pub fn undocumented2() {} //~ ERROR: missing documentation for a function
|
2013-11-12 04:17:47 +00:00
|
|
|
fn undocumented3() {}
|
|
|
|
/// dox
|
|
|
|
pub mod globbed {
|
|
|
|
/// dox
|
|
|
|
pub fn also_documented() {}
|
2015-02-23 19:33:52 +00:00
|
|
|
pub fn also_undocumented1() {} //~ ERROR: missing documentation for a function
|
2013-11-12 04:17:47 +00:00
|
|
|
fn also_undocumented2() {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// dox
|
|
|
|
pub mod public_interface {
|
2014-08-13 02:25:05 +00:00
|
|
|
pub use internal_impl::documented as foo;
|
|
|
|
pub use internal_impl::undocumented1 as bar;
|
2013-11-12 04:17:47 +00:00
|
|
|
pub use internal_impl::{documented, undocumented2};
|
|
|
|
pub use internal_impl::globbed::*;
|
|
|
|
}
|
|
|
|
|
2013-05-28 20:44:53 +00:00
|
|
|
fn main() {}
|