Skip to content

Rollup of 5 pull requests #45513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_errors/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
8 changes: 6 additions & 2 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
242 changes: 241 additions & 1 deletion src/libstd/os/linux/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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;
}
Expand Down