Skip to content

Commit 47410b2

Browse files
committed
Auto merge of #39076 - ollie27:rustdoc_stab_prim, r=GuillaumeGomez
rustdoc: Give primitive types stability attributes This is especially important for i128/u128 to make it clear they are unstable in the docs.
2 parents 11ad6fe + f48f3d7 commit 47410b2

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/librustdoc/clean/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
150150
name: Some(prim.to_url_str().to_string()),
151151
attrs: attrs.clone(),
152152
visibility: Some(Public),
153-
stability: None,
154-
deprecation: None,
153+
stability: get_stability(cx, def_id),
154+
deprecation: get_deprecation(cx, def_id),
155155
def_id: def_id,
156156
inner: PrimitiveItem(prim),
157157
}

src/libstd/primitive_docs.rs

+22
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
///
5757
/// Also, since `bool` implements the [`Copy`](marker/trait.Copy.html) trait, we don't
5858
/// have to worry about the move semantics (just like the integer and float primitives).
59+
#[stable(feature = "rust1", since = "1.0.0")]
5960
mod prim_bool { }
6061

6162
#[doc(primitive = "char")]
@@ -126,6 +127,7 @@ mod prim_bool { }
126127
/// assert_eq!(12, s.len() * std::mem::size_of::<u8>());
127128
/// assert_eq!(32, v.len() * std::mem::size_of::<char>());
128129
/// ```
130+
#[stable(feature = "rust1", since = "1.0.0")]
129131
mod prim_char { }
130132

131133
#[doc(primitive = "unit")]
@@ -163,6 +165,7 @@ mod prim_char { }
163165
/// };
164166
/// ```
165167
///
168+
#[stable(feature = "rust1", since = "1.0.0")]
166169
mod prim_unit { }
167170

168171
#[doc(primitive = "pointer")]
@@ -244,6 +247,7 @@ mod prim_unit { }
244247
///
245248
/// *[See also the `std::ptr` module](ptr/index.html).*
246249
///
250+
#[stable(feature = "rust1", since = "1.0.0")]
247251
mod prim_pointer { }
248252

249253
#[doc(primitive = "array")]
@@ -342,6 +346,7 @@ mod prim_pointer { }
342346
/// for x in &array { }
343347
/// ```
344348
///
349+
#[stable(feature = "rust1", since = "1.0.0")]
345350
mod prim_array { }
346351

347352
#[doc(primitive = "slice")]
@@ -372,6 +377,7 @@ mod prim_array { }
372377
///
373378
/// *[See also the `std::slice` module](slice/index.html).*
374379
///
380+
#[stable(feature = "rust1", since = "1.0.0")]
375381
mod prim_slice { }
376382

377383
#[doc(primitive = "str")]
@@ -438,6 +444,7 @@ mod prim_slice { }
438444
/// Note: This example shows the internals of `&str`. `unsafe` should not be
439445
/// used to get a string slice under normal circumstances. Use `.as_slice()`
440446
/// instead.
447+
#[stable(feature = "rust1", since = "1.0.0")]
441448
mod prim_str { }
442449

443450
#[doc(primitive = "tuple")]
@@ -536,13 +543,15 @@ mod prim_str { }
536543
/// assert_eq!(y, 5);
537544
/// ```
538545
///
546+
#[stable(feature = "rust1", since = "1.0.0")]
539547
mod prim_tuple { }
540548

541549
#[doc(primitive = "f32")]
542550
/// The 32-bit floating point type.
543551
///
544552
/// *[See also the `std::f32` module](f32/index.html).*
545553
///
554+
#[stable(feature = "rust1", since = "1.0.0")]
546555
mod prim_f32 { }
547556

548557
#[doc(primitive = "f64")]
@@ -551,6 +560,7 @@ mod prim_f32 { }
551560
///
552561
/// *[See also the `std::f64` module](f64/index.html).*
553562
///
563+
#[stable(feature = "rust1", since = "1.0.0")]
554564
mod prim_f64 { }
555565

556566
#[doc(primitive = "i8")]
@@ -562,6 +572,7 @@ mod prim_f64 { }
562572
/// However, please note that examples are shared between primitive integer
563573
/// types. So it's normal if you see usage of types like `i64` in there.
564574
///
575+
#[stable(feature = "rust1", since = "1.0.0")]
565576
mod prim_i8 { }
566577

567578
#[doc(primitive = "i16")]
@@ -573,6 +584,7 @@ mod prim_i8 { }
573584
/// However, please note that examples are shared between primitive integer
574585
/// types. So it's normal if you see usage of types like `i32` in there.
575586
///
587+
#[stable(feature = "rust1", since = "1.0.0")]
576588
mod prim_i16 { }
577589

578590
#[doc(primitive = "i32")]
@@ -584,6 +596,7 @@ mod prim_i16 { }
584596
/// However, please note that examples are shared between primitive integer
585597
/// types. So it's normal if you see usage of types like `i16` in there.
586598
///
599+
#[stable(feature = "rust1", since = "1.0.0")]
587600
mod prim_i32 { }
588601

589602
#[doc(primitive = "i64")]
@@ -595,6 +608,7 @@ mod prim_i32 { }
595608
/// However, please note that examples are shared between primitive integer
596609
/// types. So it's normal if you see usage of types like `i8` in there.
597610
///
611+
#[stable(feature = "rust1", since = "1.0.0")]
598612
mod prim_i64 { }
599613

600614
#[doc(primitive = "i128")]
@@ -606,6 +620,7 @@ mod prim_i64 { }
606620
/// However, please note that examples are shared between primitive integer
607621
/// types. So it's normal if you see usage of types like `i8` in there.
608622
///
623+
#[unstable(feature = "i128", issue="35118")]
609624
mod prim_i128 { }
610625

611626
#[doc(primitive = "u8")]
@@ -617,6 +632,7 @@ mod prim_i128 { }
617632
/// However, please note that examples are shared between primitive integer
618633
/// types. So it's normal if you see usage of types like `u64` in there.
619634
///
635+
#[stable(feature = "rust1", since = "1.0.0")]
620636
mod prim_u8 { }
621637

622638
#[doc(primitive = "u16")]
@@ -628,6 +644,7 @@ mod prim_u8 { }
628644
/// However, please note that examples are shared between primitive integer
629645
/// types. So it's normal if you see usage of types like `u32` in there.
630646
///
647+
#[stable(feature = "rust1", since = "1.0.0")]
631648
mod prim_u16 { }
632649

633650
#[doc(primitive = "u32")]
@@ -639,6 +656,7 @@ mod prim_u16 { }
639656
/// However, please note that examples are shared between primitive integer
640657
/// types. So it's normal if you see usage of types like `u16` in there.
641658
///
659+
#[stable(feature = "rust1", since = "1.0.0")]
642660
mod prim_u32 { }
643661

644662
#[doc(primitive = "u64")]
@@ -650,6 +668,7 @@ mod prim_u32 { }
650668
/// However, please note that examples are shared between primitive integer
651669
/// types. So it's normal if you see usage of types like `u8` in there.
652670
///
671+
#[stable(feature = "rust1", since = "1.0.0")]
653672
mod prim_u64 { }
654673

655674
#[doc(primitive = "u128")]
@@ -661,6 +680,7 @@ mod prim_u64 { }
661680
/// However, please note that examples are shared between primitive integer
662681
/// types. So it's normal if you see usage of types like `u8` in there.
663682
///
683+
#[unstable(feature = "i128", issue="35118")]
664684
mod prim_u128 { }
665685

666686
#[doc(primitive = "isize")]
@@ -672,6 +692,7 @@ mod prim_u128 { }
672692
/// However, please note that examples are shared between primitive integer
673693
/// types. So it's normal if you see usage of types like `usize` in there.
674694
///
695+
#[stable(feature = "rust1", since = "1.0.0")]
675696
mod prim_isize { }
676697

677698
#[doc(primitive = "usize")]
@@ -683,4 +704,5 @@ mod prim_isize { }
683704
/// However, please note that examples are shared between primitive integer
684705
/// types. So it's normal if you see usage of types like `isize` in there.
685706
///
707+
#[stable(feature = "rust1", since = "1.0.0")]
686708
mod prim_usize { }

0 commit comments

Comments
 (0)