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