get rid of duplicate primitive_docs

This commit is contained in:
Ralf Jung 2023-09-03 10:23:04 +02:00
parent df99bc151a
commit 7b7caae30e
25 changed files with 12 additions and 1645 deletions

View File

@ -1 +0,0 @@
../std/boxed/struct.Box.html#method.into_raw

View File

@ -1 +0,0 @@
../std/fs/struct.File.html

View File

@ -1 +0,0 @@
../std/io/trait.BufRead.html

View File

@ -1 +0,0 @@
../std/io/trait.Read.html

View File

@ -1 +0,0 @@
../std/io/trait.Seek.html

View File

@ -1 +0,0 @@
../std/io/trait.Write.html

View File

@ -1 +0,0 @@
../std/net/trait.ToSocketAddrs.html

View File

@ -1 +0,0 @@
../std/process/fn.exit.html

View File

@ -1 +0,0 @@
../std/string/struct.String.html

View File

@ -1,6 +1,3 @@
// `library/{std,core}/src/primitive_docs.rs` should have the same contents.
// These are different files so that relative links work properly without
// having to have `CARGO_PKG_NAME` set, but conceptually they should always be the same.
#[rustc_doc_primitive = "bool"]
#[doc(alias = "true")]
#[doc(alias = "false")]
@ -106,7 +103,7 @@ mod prim_bool {}
/// behaviour of the `!` type - expressions with type `!` will coerce into any other type.
///
/// [`u32`]: prim@u32
#[doc = concat!("[`exit`]: ", include_str!("../primitive_docs/process_exit.md"))]
/// [`exit`]: ../std/process/fn.exit.html
///
/// # `!` and generics
///
@ -191,7 +188,7 @@ mod prim_bool {}
/// because `!` coerces to `Result<!, ConnectionError>` automatically.
///
/// [`String::from_str`]: str::FromStr::from_str
#[doc = concat!("[`String`]: ", include_str!("../primitive_docs/string_string.md"))]
/// [`String`]: ../std/string/struct.String.html
/// [`FromStr`]: str::FromStr
///
/// # `!` and traits
@ -267,7 +264,7 @@ mod prim_bool {}
/// `impl` for this which simply panics, but the same is true for any type (we could `impl
/// Default` for (eg.) [`File`] by just making [`default()`] panic.)
///
#[doc = concat!("[`File`]: ", include_str!("../primitive_docs/fs_file.md"))]
/// [`File`]: ../std/fs/struct.File.html
/// [`Debug`]: fmt::Debug
/// [`default()`]: Default::default
///
@ -355,7 +352,7 @@ mod prim_never {}
/// assert_eq!(5, s.len() * std::mem::size_of::<u8>());
/// ```
///
#[doc = concat!("[`String`]: ", include_str!("../primitive_docs/string_string.md"))]
/// [`String`]: ../std/string/struct.String.html
///
/// As always, remember that a human intuition for 'character' might not map to
/// Unicode's definitions. For example, despite looking similar, the 'é'
@ -572,7 +569,7 @@ impl Copy for () {
/// [`null_mut`]: ptr::null_mut
/// [`is_null`]: pointer::is_null
/// [`offset`]: pointer::offset
#[doc = concat!("[`into_raw`]: ", include_str!("../primitive_docs/box_into_raw.md"))]
/// [`into_raw`]: ../std/boxed/struct.Box.html#method.into_raw
/// [`write`]: ptr::write
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_pointer {}
@ -1361,7 +1358,7 @@ mod prim_usize {}
///
/// [`std::fmt`]: fmt
/// [`Hash`]: hash::Hash
#[doc = concat!("[`ToSocketAddrs`]: ", include_str!("../primitive_docs/net_tosocketaddrs.md"))]
/// [`ToSocketAddrs`]: ../std/net/trait.ToSocketAddrs.html
///
/// `&mut T` references get all of the above except `ToSocketAddrs`, plus the following, if `T`
/// implements that trait:
@ -1381,10 +1378,10 @@ mod prim_usize {}
///
/// [`FusedIterator`]: iter::FusedIterator
/// [`TrustedLen`]: iter::TrustedLen
#[doc = concat!("[`Seek`]: ", include_str!("../primitive_docs/io_seek.md"))]
#[doc = concat!("[`BufRead`]: ", include_str!("../primitive_docs/io_bufread.md"))]
#[doc = concat!("[`Read`]: ", include_str!("../primitive_docs/io_read.md"))]
#[doc = concat!("[`io::Write`]: ", include_str!("../primitive_docs/io_write.md"))]
/// [`Seek`]: ../std/io/trait.Seek.html
/// [`BufRead`]: ../std/io/trait.BufRead.html
/// [`Read`]: ../std/io/trait.Read.html
/// [`io::Write`]: ../std/io/trait.Write.html
///
/// Note that due to method call deref coercion, simply calling a trait method will act like they
/// work on references as well as they do on owned values! The implementations described here are

View File

@ -1,4 +1,4 @@
// See src/libstd/primitive_docs.rs for documentation.
// See core/src/primitive_docs.rs for documentation.
use crate::cmp::Ordering::{self, *};
use crate::marker::ConstParamTy;

View File

@ -1 +0,0 @@
Box::into_raw

View File

@ -1 +0,0 @@
fs::File

View File

@ -1 +0,0 @@
io::BufRead

View File

@ -1 +0,0 @@
io::Read

View File

@ -1 +0,0 @@
io::Seek

View File

@ -1 +0,0 @@
io::Write

View File

@ -1 +0,0 @@
net::ToSocketAddrs

View File

@ -1 +0,0 @@
process::exit

View File

@ -1 +0,0 @@
string::String

View File

@ -673,7 +673,7 @@ pub use core::primitive;
// Include a number of private modules that exist solely to provide
// the rustdoc documentation for primitive types. Using `include!`
// because rustdoc only looks for these modules at the crate level.
include!("primitive_docs.rs");
include!("../../core/src/primitive_docs.rs");
// Include a number of private modules that exist solely to provide
// the rustdoc documentation for the existing keywords. Using `include!`

File diff suppressed because it is too large Load Diff

View File

@ -63,7 +63,6 @@ pub mod features;
pub mod fluent_alphabetical;
pub mod mir_opt_tests;
pub mod pal;
pub mod primitive_docs;
pub mod rustdoc_css_themes;
pub mod rustdoc_gui_tests;
pub mod style;

View File

@ -112,7 +112,6 @@ fn main() {
// Checks that only make sense for the std libs.
check!(pal, &library_path);
check!(primitive_docs, &library_path);
// Checks that need to be done for both the compiler and std libraries.
check!(unit_tests, &src_path);

View File

@ -1,17 +0,0 @@
//! Tidy check to make sure `library/{std,core}/src/primitive_docs.rs` are the same file. These are
//! different files so that relative links work properly without having to have `CARGO_PKG_NAME`
//! set, but conceptually they should always be the same.
use std::path::Path;
pub fn check(library_path: &Path, bad: &mut bool) {
let std_name = "std/src/primitive_docs.rs";
let core_name = "core/src/primitive_docs.rs";
let std_contents = std::fs::read_to_string(library_path.join(std_name))
.unwrap_or_else(|e| panic!("failed to read library/{std_name}: {e}"));
let core_contents = std::fs::read_to_string(library_path.join(core_name))
.unwrap_or_else(|e| panic!("failed to read library/{core_name}: {e}"));
if std_contents != core_contents {
tidy_error!(bad, "library/{core_name} and library/{std_name} have different contents");
}
}