diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 15e7cdbde408d..925ef7bd51ad1 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -414,17 +414,22 @@ macro_rules! repeat_u8_as_u64 { // // And of course, 0x00 brings back the old world of zero'ing on drop. #[unstable(feature = "filling_drop")] +#[allow(missing_docs)] pub const POST_DROP_U8: u8 = 0x1d; #[unstable(feature = "filling_drop")] +#[allow(missing_docs)] pub const POST_DROP_U32: u32 = repeat_u8_as_u32!(POST_DROP_U8); #[unstable(feature = "filling_drop")] +#[allow(missing_docs)] pub const POST_DROP_U64: u64 = repeat_u8_as_u64!(POST_DROP_U8); #[cfg(target_pointer_width = "32")] #[unstable(feature = "filling_drop")] +#[allow(missing_docs)] pub const POST_DROP_USIZE: usize = POST_DROP_U32 as usize; #[cfg(target_pointer_width = "64")] #[unstable(feature = "filling_drop")] +#[allow(missing_docs)] pub const POST_DROP_USIZE: usize = POST_DROP_U64 as usize; /// Interprets `src` as `&U`, and then reads `src` without moving the contained diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index aade9061657b7..2540bd4bb3662 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -24,14 +24,18 @@ use num::{Float, ParseFloatError}; use num::FpCategory as Fp; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const RADIX: u32 = 2; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MANTISSA_DIGITS: u32 = 24; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const DIGITS: u32 = 6; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const EPSILON: f32 = 1.19209290e-07_f32; /// Smallest finite f32 value @@ -45,20 +49,27 @@ pub const MIN_POSITIVE: f32 = 1.17549435e-38_f32; pub const MAX: f32 = 3.40282347e+38_f32; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MIN_EXP: i32 = -125; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MAX_EXP: i32 = 128; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MIN_10_EXP: i32 = -37; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MAX_10_EXP: i32 = 38; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const NAN: f32 = 0.0_f32/0.0_f32; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const INFINITY: f32 = 1.0_f32/0.0_f32; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32; /// Basic mathematial constants. diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index 7c9e846af9b10..d2ab2695f5e5c 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -24,14 +24,18 @@ use num::FpCategory as Fp; use num::{Float, ParseFloatError}; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const RADIX: u32 = 2; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MANTISSA_DIGITS: u32 = 53; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const DIGITS: u32 = 15; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const EPSILON: f64 = 2.2204460492503131e-16_f64; /// Smallest finite f64 value @@ -45,20 +49,27 @@ pub const MIN_POSITIVE: f64 = 2.2250738585072014e-308_f64; pub const MAX: f64 = 1.7976931348623157e+308_f64; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MIN_EXP: i32 = -1021; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MAX_EXP: i32 = 1024; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MIN_10_EXP: i32 = -307; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MAX_10_EXP: i32 = 308; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const NAN: f64 = 0.0_f64/0.0_f64; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const INFINITY: f64 = 1.0_f64/0.0_f64; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const NEG_INFINITY: f64 = -1.0_f64/0.0_f64; /// Basic mathematial constants. diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs index efc9123880978..cb9bffca84256 100644 --- a/src/libcore/num/int_macros.rs +++ b/src/libcore/num/int_macros.rs @@ -16,21 +16,25 @@ macro_rules! int_module { ($T:ty, $bits:expr) => ( // calling the `mem::size_of` function. #[unstable(feature = "num_bits_bytes", reason = "may want to be an associated function")] +#[allow(missing_docs)] pub const BITS : usize = $bits; // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // calling the `mem::size_of` function. #[unstable(feature = "num_bits_bytes", reason = "may want to be an associated function")] +#[allow(missing_docs)] pub const BYTES : usize = ($bits / 8); // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // calling the `Bounded::min_value` function. #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MIN: $T = (-1 as $T) << (BITS - 1); // FIXME(#9837): Compute MIN like this so the high bits that shouldn't exist are 0. // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // calling the `Bounded::max_value` function. #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MAX: $T = !MIN; ) } diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs index 0719d7c17cc4e..b31d6a73a7fa9 100644 --- a/src/libcore/num/uint_macros.rs +++ b/src/libcore/num/uint_macros.rs @@ -14,14 +14,18 @@ macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => ( #[unstable(feature = "num_bits_bytes", reason = "may want to be an associated function")] +#[allow(missing_docs)] pub const BITS : usize = $bits; #[unstable(feature = "num_bits_bytes", reason = "may want to be an associated function")] +#[allow(missing_docs)] pub const BYTES : usize = ($bits / 8); #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MIN: $T = 0 as $T; #[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] pub const MAX: $T = !0 as $T; ) } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index a4681acdd7550..53b1abe2d3148 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1612,6 +1612,8 @@ impl LintPass for MissingDoc { } return }, + ast::ItemConst(..) => "a constant", + ast::ItemStatic(..) => "a static", _ => return }; diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 5131e0b34e380..09dc1a3f6d69d 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -152,6 +152,7 @@ pub fn stderr() -> Option + Send>> { /// Terminal color definitions +#[allow(missing_docs)] pub mod color { /// Number for a terminal color pub type Color = u16; diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index ef42d8c2506b3..f71f7f7aac5fa 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -19,6 +19,7 @@ use super::super::TermInfo; // These are the orders ncurses uses in its compiled format (as of 5.9). Not sure if portable. +#[allow(missing_docs)] pub static boolfnames: &'static[&'static str] = &["auto_left_margin", "auto_right_margin", "no_esc_ctlc", "ceol_standout_glitch", "eat_newline_glitch", "erase_overstrike", "generic_type", "hard_copy", "has_meta_key", "has_status_line", "insert_null_glitch", "memory_above", @@ -31,11 +32,13 @@ pub static boolfnames: &'static[&'static str] = &["auto_left_margin", "auto_righ "no_correctly_working_cr", "gnu_has_meta_key", "linefeed_is_newline", "has_hardware_tabs", "return_does_clr_eol"]; +#[allow(missing_docs)] pub static boolnames: &'static[&'static str] = &["bw", "am", "xsb", "xhp", "xenl", "eo", "gn", "hc", "km", "hs", "in", "db", "da", "mir", "msgr", "os", "eslok", "xt", "hz", "ul", "xon", "nxon", "mc5i", "chts", "nrrmc", "npc", "ndscr", "ccc", "bce", "hls", "xhpa", "crxm", "daisy", "xvpa", "sam", "cpix", "lpix", "OTbs", "OTns", "OTnc", "OTMT", "OTNL", "OTpt", "OTxr"]; +#[allow(missing_docs)] pub static numfnames: &'static[&'static str] = &[ "columns", "init_tabs", "lines", "lines_of_memory", "magic_cookie_glitch", "padding_baud_rate", "virtual_terminal", "width_status_line", "num_labels", "label_height", "label_width", "max_attributes", @@ -46,11 +49,13 @@ pub static numfnames: &'static[&'static str] = &[ "columns", "init_tabs", "lines "bit_image_entwining", "bit_image_type", "magic_cookie_glitch_ul", "carriage_return_delay", "new_line_delay", "backspace_delay", "horizontal_tab_delay", "number_of_function_keys"]; +#[allow(missing_docs)] pub static numnames: &'static[&'static str] = &[ "cols", "it", "lines", "lm", "xmc", "pb", "vt", "wsl", "nlab", "lh", "lw", "ma", "wnum", "colors", "pairs", "ncv", "bufsz", "spinv", "spinh", "maddr", "mjump", "mcs", "mls", "npins", "orc", "orl", "orhi", "orvi", "cps", "widcs", "btns", "bitwin", "bitype", "UTug", "OTdC", "OTdN", "OTdB", "OTdT", "OTkn"]; +#[allow(missing_docs)] pub static stringfnames: &'static[&'static str] = &[ "back_tab", "bell", "carriage_return", "change_scroll_region", "clear_all_tabs", "clear_screen", "clr_eol", "clr_eos", "column_address", "command_character", "cursor_address", "cursor_down", "cursor_home", @@ -124,6 +129,7 @@ pub static stringfnames: &'static[&'static str] = &[ "back_tab", "bell", "carria "acs_lrcorner", "acs_ltee", "acs_rtee", "acs_btee", "acs_ttee", "acs_hline", "acs_vline", "acs_plus", "memory_lock", "memory_unlock", "box_chars_1"]; +#[allow(missing_docs)] pub static stringnames: &'static[&'static str] = &[ "cbt", "_", "cr", "csr", "tbc", "clear", "_", "_", "hpa", "cmdch", "cup", "cud1", "home", "civis", "cub1", "mrcup", "cnorm", "cuf1", "ll", "cuu1", "cvvis", "dch1", "dl1", "dsl", "hd", "smacs", "blink", "bold", "smcup", "smdc", diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs index 04db6c8c8f39c..5501835886104 100644 --- a/src/test/compile-fail/lint-missing-doc.rs +++ b/src/test/compile-fail/lint-missing-doc.rs @@ -149,6 +149,27 @@ pub enum PubBaz3 { #[doc(hidden)] pub fn baz() {} + +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 + + mod internal_impl { /// dox pub fn documented() {}