Skip to content

Commit 5d3b0f1

Browse files
committed
Auto merge of #26473 - Eljay:missing_docs, r=alexcrichton
Fixes #24249 I've tagged all items that were missing docs to allow them to compile for now, the ones in core/num should probably be documented at least. This is also a breaking change for any crates using `#[deny(missing_docs)]` that have undocumented constants, not sure there is any way to avoid this without making it a separate lint?
2 parents 7c1e339 + c0d485c commit 5d3b0f1

File tree

9 files changed

+65
-0
lines changed

9 files changed

+65
-0
lines changed

src/libcore/mem.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,17 +445,22 @@ macro_rules! repeat_u8_as_u64 {
445445
//
446446
// And of course, 0x00 brings back the old world of zero'ing on drop.
447447
#[unstable(feature = "filling_drop")]
448+
#[allow(missing_docs)]
448449
pub const POST_DROP_U8: u8 = 0x1d;
449450
#[unstable(feature = "filling_drop")]
451+
#[allow(missing_docs)]
450452
pub const POST_DROP_U32: u32 = repeat_u8_as_u32!(POST_DROP_U8);
451453
#[unstable(feature = "filling_drop")]
454+
#[allow(missing_docs)]
452455
pub const POST_DROP_U64: u64 = repeat_u8_as_u64!(POST_DROP_U8);
453456

454457
#[cfg(target_pointer_width = "32")]
455458
#[unstable(feature = "filling_drop")]
459+
#[allow(missing_docs)]
456460
pub const POST_DROP_USIZE: usize = POST_DROP_U32 as usize;
457461
#[cfg(target_pointer_width = "64")]
458462
#[unstable(feature = "filling_drop")]
463+
#[allow(missing_docs)]
459464
pub const POST_DROP_USIZE: usize = POST_DROP_U64 as usize;
460465

461466
/// Interprets `src` as `&U`, and then reads `src` without moving the contained

src/libcore/num/f32.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ use num::{Float, ParseFloatError};
2424
use num::FpCategory as Fp;
2525

2626
#[stable(feature = "rust1", since = "1.0.0")]
27+
#[allow(missing_docs)]
2728
pub const RADIX: u32 = 2;
2829

2930
#[stable(feature = "rust1", since = "1.0.0")]
31+
#[allow(missing_docs)]
3032
pub const MANTISSA_DIGITS: u32 = 24;
3133
#[stable(feature = "rust1", since = "1.0.0")]
34+
#[allow(missing_docs)]
3235
pub const DIGITS: u32 = 6;
3336

3437
#[stable(feature = "rust1", since = "1.0.0")]
38+
#[allow(missing_docs)]
3539
pub const EPSILON: f32 = 1.19209290e-07_f32;
3640

3741
/// Smallest finite f32 value
@@ -45,20 +49,27 @@ pub const MIN_POSITIVE: f32 = 1.17549435e-38_f32;
4549
pub const MAX: f32 = 3.40282347e+38_f32;
4650

4751
#[stable(feature = "rust1", since = "1.0.0")]
52+
#[allow(missing_docs)]
4853
pub const MIN_EXP: i32 = -125;
4954
#[stable(feature = "rust1", since = "1.0.0")]
55+
#[allow(missing_docs)]
5056
pub const MAX_EXP: i32 = 128;
5157

5258
#[stable(feature = "rust1", since = "1.0.0")]
59+
#[allow(missing_docs)]
5360
pub const MIN_10_EXP: i32 = -37;
5461
#[stable(feature = "rust1", since = "1.0.0")]
62+
#[allow(missing_docs)]
5563
pub const MAX_10_EXP: i32 = 38;
5664

5765
#[stable(feature = "rust1", since = "1.0.0")]
66+
#[allow(missing_docs)]
5867
pub const NAN: f32 = 0.0_f32/0.0_f32;
5968
#[stable(feature = "rust1", since = "1.0.0")]
69+
#[allow(missing_docs)]
6070
pub const INFINITY: f32 = 1.0_f32/0.0_f32;
6171
#[stable(feature = "rust1", since = "1.0.0")]
72+
#[allow(missing_docs)]
6273
pub const NEG_INFINITY: f32 = -1.0_f32/0.0_f32;
6374

6475
/// Basic mathematial constants.

src/libcore/num/f64.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ use num::FpCategory as Fp;
2424
use num::{Float, ParseFloatError};
2525

2626
#[stable(feature = "rust1", since = "1.0.0")]
27+
#[allow(missing_docs)]
2728
pub const RADIX: u32 = 2;
2829

2930
#[stable(feature = "rust1", since = "1.0.0")]
31+
#[allow(missing_docs)]
3032
pub const MANTISSA_DIGITS: u32 = 53;
3133
#[stable(feature = "rust1", since = "1.0.0")]
34+
#[allow(missing_docs)]
3235
pub const DIGITS: u32 = 15;
3336

3437
#[stable(feature = "rust1", since = "1.0.0")]
38+
#[allow(missing_docs)]
3539
pub const EPSILON: f64 = 2.2204460492503131e-16_f64;
3640

3741
/// Smallest finite f64 value
@@ -45,20 +49,27 @@ pub const MIN_POSITIVE: f64 = 2.2250738585072014e-308_f64;
4549
pub const MAX: f64 = 1.7976931348623157e+308_f64;
4650

4751
#[stable(feature = "rust1", since = "1.0.0")]
52+
#[allow(missing_docs)]
4853
pub const MIN_EXP: i32 = -1021;
4954
#[stable(feature = "rust1", since = "1.0.0")]
55+
#[allow(missing_docs)]
5056
pub const MAX_EXP: i32 = 1024;
5157

5258
#[stable(feature = "rust1", since = "1.0.0")]
59+
#[allow(missing_docs)]
5360
pub const MIN_10_EXP: i32 = -307;
5461
#[stable(feature = "rust1", since = "1.0.0")]
62+
#[allow(missing_docs)]
5563
pub const MAX_10_EXP: i32 = 308;
5664

5765
#[stable(feature = "rust1", since = "1.0.0")]
66+
#[allow(missing_docs)]
5867
pub const NAN: f64 = 0.0_f64/0.0_f64;
5968
#[stable(feature = "rust1", since = "1.0.0")]
69+
#[allow(missing_docs)]
6070
pub const INFINITY: f64 = 1.0_f64/0.0_f64;
6171
#[stable(feature = "rust1", since = "1.0.0")]
72+
#[allow(missing_docs)]
6273
pub const NEG_INFINITY: f64 = -1.0_f64/0.0_f64;
6374

6475
/// Basic mathematial constants.

src/libcore/num/int_macros.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,25 @@ macro_rules! int_module { ($T:ty, $bits:expr) => (
1616
// calling the `mem::size_of` function.
1717
#[unstable(feature = "num_bits_bytes",
1818
reason = "may want to be an associated function")]
19+
#[allow(missing_docs)]
1920
pub const BITS : usize = $bits;
2021
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
2122
// calling the `mem::size_of` function.
2223
#[unstable(feature = "num_bits_bytes",
2324
reason = "may want to be an associated function")]
25+
#[allow(missing_docs)]
2426
pub const BYTES : usize = ($bits / 8);
2527

2628
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
2729
// calling the `Bounded::min_value` function.
2830
#[stable(feature = "rust1", since = "1.0.0")]
31+
#[allow(missing_docs)]
2932
pub const MIN: $T = (-1 as $T) << (BITS - 1);
3033
// FIXME(#9837): Compute MIN like this so the high bits that shouldn't exist are 0.
3134
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
3235
// calling the `Bounded::max_value` function.
3336
#[stable(feature = "rust1", since = "1.0.0")]
37+
#[allow(missing_docs)]
3438
pub const MAX: $T = !MIN;
3539

3640
) }

src/libcore/num/uint_macros.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => (
1414

1515
#[unstable(feature = "num_bits_bytes",
1616
reason = "may want to be an associated function")]
17+
#[allow(missing_docs)]
1718
pub const BITS : usize = $bits;
1819
#[unstable(feature = "num_bits_bytes",
1920
reason = "may want to be an associated function")]
21+
#[allow(missing_docs)]
2022
pub const BYTES : usize = ($bits / 8);
2123

2224
#[stable(feature = "rust1", since = "1.0.0")]
25+
#[allow(missing_docs)]
2326
pub const MIN: $T = 0 as $T;
2427
#[stable(feature = "rust1", since = "1.0.0")]
28+
#[allow(missing_docs)]
2529
pub const MAX: $T = !0 as $T;
2630

2731
) }

src/librustc_lint/builtin.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,8 @@ impl LintPass for MissingDoc {
16101610
}
16111611
return
16121612
},
1613+
ast::ItemConst(..) => "a constant",
1614+
ast::ItemStatic(..) => "a static",
16131615
_ => return
16141616
};
16151617

src/libterm/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ pub fn stderr() -> Option<Box<Terminal<WriterWrapper> + Send>> {
152152

153153

154154
/// Terminal color definitions
155+
#[allow(missing_docs)]
155156
pub mod color {
156157
/// Number for a terminal color
157158
pub type Color = u16;

src/libterm/terminfo/parser/compiled.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use super::super::TermInfo;
1919

2020
// These are the orders ncurses uses in its compiled format (as of 5.9). Not sure if portable.
2121

22+
#[allow(missing_docs)]
2223
pub static boolfnames: &'static[&'static str] = &["auto_left_margin", "auto_right_margin",
2324
"no_esc_ctlc", "ceol_standout_glitch", "eat_newline_glitch", "erase_overstrike", "generic_type",
2425
"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
3132
"no_correctly_working_cr", "gnu_has_meta_key", "linefeed_is_newline", "has_hardware_tabs",
3233
"return_does_clr_eol"];
3334

35+
#[allow(missing_docs)]
3436
pub static boolnames: &'static[&'static str] = &["bw", "am", "xsb", "xhp", "xenl", "eo",
3537
"gn", "hc", "km", "hs", "in", "db", "da", "mir", "msgr", "os", "eslok", "xt", "hz", "ul", "xon",
3638
"nxon", "mc5i", "chts", "nrrmc", "npc", "ndscr", "ccc", "bce", "hls", "xhpa", "crxm", "daisy",
3739
"xvpa", "sam", "cpix", "lpix", "OTbs", "OTns", "OTnc", "OTMT", "OTNL", "OTpt", "OTxr"];
3840

41+
#[allow(missing_docs)]
3942
pub static numfnames: &'static[&'static str] = &[ "columns", "init_tabs", "lines",
4043
"lines_of_memory", "magic_cookie_glitch", "padding_baud_rate", "virtual_terminal",
4144
"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
4649
"bit_image_entwining", "bit_image_type", "magic_cookie_glitch_ul", "carriage_return_delay",
4750
"new_line_delay", "backspace_delay", "horizontal_tab_delay", "number_of_function_keys"];
4851

52+
#[allow(missing_docs)]
4953
pub static numnames: &'static[&'static str] = &[ "cols", "it", "lines", "lm", "xmc", "pb",
5054
"vt", "wsl", "nlab", "lh", "lw", "ma", "wnum", "colors", "pairs", "ncv", "bufsz", "spinv",
5155
"spinh", "maddr", "mjump", "mcs", "mls", "npins", "orc", "orl", "orhi", "orvi", "cps", "widcs",
5256
"btns", "bitwin", "bitype", "UTug", "OTdC", "OTdN", "OTdB", "OTdT", "OTkn"];
5357

58+
#[allow(missing_docs)]
5459
pub static stringfnames: &'static[&'static str] = &[ "back_tab", "bell", "carriage_return",
5560
"change_scroll_region", "clear_all_tabs", "clear_screen", "clr_eol", "clr_eos",
5661
"column_address", "command_character", "cursor_address", "cursor_down", "cursor_home",
@@ -124,6 +129,7 @@ pub static stringfnames: &'static[&'static str] = &[ "back_tab", "bell", "carria
124129
"acs_lrcorner", "acs_ltee", "acs_rtee", "acs_btee", "acs_ttee", "acs_hline", "acs_vline",
125130
"acs_plus", "memory_lock", "memory_unlock", "box_chars_1"];
126131

132+
#[allow(missing_docs)]
127133
pub static stringnames: &'static[&'static str] = &[ "cbt", "_", "cr", "csr", "tbc", "clear",
128134
"_", "_", "hpa", "cmdch", "cup", "cud1", "home", "civis", "cub1", "mrcup", "cnorm", "cuf1",
129135
"ll", "cuu1", "cvvis", "dch1", "dl1", "dsl", "hd", "smacs", "blink", "bold", "smcup", "smdc",

src/test/compile-fail/lint-missing-doc.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,27 @@ pub enum PubBaz3 {
149149
#[doc(hidden)]
150150
pub fn baz() {}
151151

152+
153+
const FOO: u32 = 0;
154+
/// dox
155+
pub const FOO1: u32 = 0;
156+
#[allow(missing_docs)]
157+
pub const FOO2: u32 = 0;
158+
#[doc(hidden)]
159+
pub const FOO3: u32 = 0;
160+
pub const FOO4: u32 = 0; //~ ERROR: missing documentation for a const
161+
162+
163+
static BAR: u32 = 0;
164+
/// dox
165+
pub static BAR1: u32 = 0;
166+
#[allow(missing_docs)]
167+
pub static BAR2: u32 = 0;
168+
#[doc(hidden)]
169+
pub static BAR3: u32 = 0;
170+
pub static BAR4: u32 = 0; //~ ERROR: missing documentation for a static
171+
172+
152173
mod internal_impl {
153174
/// dox
154175
pub fn documented() {}

0 commit comments

Comments
 (0)