Auto merge of #45513 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests - Successful merges: #45361, #45461, #45465, #45486, #45502 - Failed merges:
This commit is contained in:
commit
2f5ae25a34
5 changed files with 257 additions and 3 deletions
|
|
@ -446,6 +446,7 @@ impl Step for Openssl {
|
|||
"powerpc64-unknown-linux-gnu" => "linux-ppc64",
|
||||
"powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
|
||||
"s390x-unknown-linux-gnu" => "linux64-s390x",
|
||||
"sparc64-unknown-linux-gnu" => "linux64-sparcv9",
|
||||
"sparc64-unknown-netbsd" => "BSD-sparc64",
|
||||
"x86_64-apple-darwin" => "darwin64-x86_64-cc",
|
||||
"x86_64-linux-android" => "linux-x86_64",
|
||||
|
|
|
|||
|
|
@ -676,6 +676,10 @@ extern "rust-intrinsic" {
|
|||
pub fn min_align_of<T>() -> usize;
|
||||
pub fn pref_align_of<T>() -> usize;
|
||||
|
||||
/// The size of the referenced value in bytes.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is
|
||||
/// [`std::mem::size_of_val`](../../std/mem/fn.size_of_val.html).
|
||||
pub fn size_of_val<T: ?Sized>(_: &T) -> usize;
|
||||
pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;
|
||||
|
||||
|
|
@ -921,6 +925,9 @@ extern "rust-intrinsic" {
|
|||
///
|
||||
/// If the actual type neither requires drop glue nor implements
|
||||
/// `Copy`, then may return `true` or `false`.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is
|
||||
/// [`std::mem::needs_drop`](../../std/mem/fn.needs_drop.html).
|
||||
pub fn needs_drop<T>() -> bool;
|
||||
|
||||
/// Calculates the offset from a pointer.
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ impl Diagnostic {
|
|||
/// "try adding parentheses: `(tup.0).1`"
|
||||
///
|
||||
/// The message
|
||||
///
|
||||
/// * should not end in any punctuation (a `:` is added automatically)
|
||||
/// * should not be a question
|
||||
/// * should not contain any parts like "the following", "as shown"
|
||||
|
|
@ -248,6 +249,7 @@ impl Diagnostic {
|
|||
self
|
||||
}
|
||||
|
||||
/// Prints out a message with multiple suggested edits of the code.
|
||||
pub fn span_suggestions(&mut self, sp: Span, msg: &str, suggestions: Vec<String>) -> &mut Self {
|
||||
self.suggestions.push(CodeSuggestion {
|
||||
substitution_parts: vec![Substitution {
|
||||
|
|
|
|||
|
|
@ -820,8 +820,8 @@ span.since {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.content .out-of-band {
|
||||
display: none;
|
||||
.content h4 > .out-of-band {
|
||||
position: inherit;
|
||||
}
|
||||
|
||||
.toggle-wrapper > .collapse-toggle {
|
||||
|
|
@ -835,6 +835,10 @@ span.since {
|
|||
#search {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
|
|
|
|||
|
|
@ -24,9 +24,25 @@ pub trait MetadataExt {
|
|||
/// Gain a reference to the underlying `stat` structure which contains
|
||||
/// the raw information returned by the OS.
|
||||
///
|
||||
/// The contents of the returned `stat` are **not** consistent across
|
||||
/// The contents of the returned [`stat`] are **not** consistent across
|
||||
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
|
||||
/// cross-Unix abstractions contained within the raw stat.
|
||||
///
|
||||
/// [`stat`]: ../../../../std/os/linux/raw/struct.stat.html
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// let stat = meta.as_raw_stat();
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext", since = "1.1.0")]
|
||||
#[rustc_deprecated(since = "1.8.0",
|
||||
reason = "deprecated in favor of the accessor \
|
||||
|
|
@ -35,54 +51,278 @@ pub trait MetadataExt {
|
|||
fn as_raw_stat(&self) -> &raw::stat;
|
||||
|
||||
/// Returns the device ID on which this file resides.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_dev());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_dev(&self) -> u64;
|
||||
/// Returns the inode number.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_ino());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_ino(&self) -> u64;
|
||||
/// Returns the file type and mode.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_mode());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_mode(&self) -> u32;
|
||||
/// Returns the number of hard links to file.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_nlink());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_nlink(&self) -> u64;
|
||||
/// Returns the user ID of the file owner.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_uid());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_uid(&self) -> u32;
|
||||
/// Returns the group ID of the file owner.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_gid());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_gid(&self) -> u32;
|
||||
/// Returns the device ID that this file represents. Only relevant for special file.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_rdev());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_rdev(&self) -> u64;
|
||||
/// Returns the size of the file (if it is a regular file or a symbolic link) in bytes.
|
||||
///
|
||||
/// The size of a symbolic link is the length of the pathname it contains,
|
||||
/// without a terminating null byte.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_size());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_size(&self) -> u64;
|
||||
/// Returns the last access time.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_atime());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_atime(&self) -> i64;
|
||||
/// Returns the last access time, nano seconds part.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_atime_nsec());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_atime_nsec(&self) -> i64;
|
||||
/// Returns the last modification time.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_mtime());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_mtime(&self) -> i64;
|
||||
/// Returns the last modification time, nano seconds part.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_mtime_nsec());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_mtime_nsec(&self) -> i64;
|
||||
/// Returns the last status change time.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_ctime());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_ctime(&self) -> i64;
|
||||
/// Returns the last status change time, nano seconds part.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_ctime_nsec());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_ctime_nsec(&self) -> i64;
|
||||
/// Returns the "preferred" blocksize for efficient filesystem I/O.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_blksize());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_blksize(&self) -> u64;
|
||||
/// Returns the number of blocks allocated to the file, 512-byte units.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::fs;
|
||||
/// use std::os::linux::fs::MetadataExt;
|
||||
///
|
||||
/// # use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// let meta = fs::metadata("some_file")?;
|
||||
/// println!("{}", meta.st_blocks());
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[stable(feature = "metadata_ext2", since = "1.8.0")]
|
||||
fn st_blocks(&self) -> u64;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue