mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Auto merge of #26894 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #26687, #26784, #26850, #26889, #26891, #26892, #26893 - Failed merges:
This commit is contained in:
commit
15952ac6cf
@ -1702,8 +1702,11 @@ fn run_codegen_test(config: &Config, props: &TestProps, testfile: &Path) {
|
||||
}
|
||||
|
||||
fn charset() -> &'static str {
|
||||
if cfg!(any(target_os = "bitrig", target_os = "freebsd")) {
|
||||
// FreeBSD 10.1 defaults to GDB 6.1.1 which doesn't support "auto" charset
|
||||
if cfg!(target_os = "bitrig") {
|
||||
"auto"
|
||||
} else if cfg!(target_os = "freebsd") {
|
||||
"ISO-8859-1"
|
||||
} else {
|
||||
"UTF-8"
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ Second, it makes cost explicit. In general, the only safe way to have a
|
||||
non-exhaustive match would be to panic the thread if nothing is matched, though
|
||||
it could fall through if the type of the `match` expression is `()`. This sort
|
||||
of hidden cost and special casing is against the language's philosophy. It's
|
||||
easy to ignore certain cases by using the `_` wildcard:
|
||||
easy to ignore all unspecified cases by using the `_` wildcard:
|
||||
|
||||
```rust,ignore
|
||||
match val.do_something() {
|
||||
|
@ -360,10 +360,12 @@ rand="0.3.0"
|
||||
The `[dependencies]` section of `Cargo.toml` is like the `[package]` section:
|
||||
everything that follows it is part of it, until the next section starts.
|
||||
Cargo uses the dependencies section to know what dependencies on external
|
||||
crates you have, and what versions you require. In this case, we’ve used version `0.3.0`.
|
||||
crates you have, and what versions you require. In this case, we’ve specified version `0.3.0`,
|
||||
which Cargo understands to be any release that’s compatible with this specific version.
|
||||
Cargo understands [Semantic Versioning][semver], which is a standard for writing version
|
||||
numbers. If we wanted to use the latest version we could use `*` or we could use a range
|
||||
of versions. [Cargo’s documentation][cargodoc] contains more details.
|
||||
numbers. If we wanted to use only `0.3.0` exactly, we could use `=0.3.0`. If we
|
||||
wanted to use the latest version we could use `*`; We could use a range of
|
||||
versions. [Cargo’s documentation][cargodoc] contains more details.
|
||||
|
||||
[semver]: http://semver.org
|
||||
[cargodoc]: http://doc.crates.io/crates-io.html
|
||||
|
@ -273,6 +273,8 @@ impl<'a> Display for Arguments<'a> {
|
||||
///
|
||||
/// Generally speaking, you should just `derive` a `Debug` implementation.
|
||||
///
|
||||
/// When used with the alternate format specifier `#?`, the output is pretty-printed.
|
||||
///
|
||||
/// For more information on formatters, see [the module-level documentation][module].
|
||||
///
|
||||
/// [module]: ../index.html
|
||||
@ -314,6 +316,12 @@ impl<'a> Display for Arguments<'a> {
|
||||
/// println!("The origin is: {:?}", origin);
|
||||
/// ```
|
||||
///
|
||||
/// This outputs:
|
||||
///
|
||||
/// ```text
|
||||
/// The origin is: Point { x: 0, y: 0 }
|
||||
/// ```
|
||||
///
|
||||
/// There are a number of `debug_*` methods on `Formatter` to help you with manual
|
||||
/// implementations, such as [`debug_struct`][debug_struct].
|
||||
///
|
||||
@ -321,6 +329,29 @@ impl<'a> Display for Arguments<'a> {
|
||||
/// on `Formatter` support pretty printing using the alternate flag: `{:#?}`.
|
||||
///
|
||||
/// [debug_struct]: ../std/fmt/struct.Formatter.html#method.debug_struct
|
||||
///
|
||||
/// Pretty printing with `#?`:
|
||||
///
|
||||
/// ```
|
||||
/// #[derive(Debug)]
|
||||
/// struct Point {
|
||||
/// x: i32,
|
||||
/// y: i32,
|
||||
/// }
|
||||
///
|
||||
/// let origin = Point { x: 0, y: 0 };
|
||||
///
|
||||
/// println!("The origin is: {:#?}", origin);
|
||||
/// ```
|
||||
///
|
||||
/// This outputs:
|
||||
///
|
||||
/// ```text
|
||||
/// The origin is: Point {
|
||||
/// x: 0,
|
||||
/// y: 0
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "`{Self}` cannot be formatted using `:?`; if it is \
|
||||
defined in your crate, add `#[derive(Debug)]` or \
|
||||
@ -379,6 +410,8 @@ pub trait Display {
|
||||
///
|
||||
/// The `Octal` trait should format its output as a number in base-8.
|
||||
///
|
||||
/// The alternate flag, `#`, adds a `0o` in front of the output.
|
||||
///
|
||||
/// For more information on formatters, see [the module-level documentation][module].
|
||||
///
|
||||
/// [module]: ../index.html
|
||||
@ -391,6 +424,7 @@ pub trait Display {
|
||||
/// let x = 42; // 42 is '52' in octal
|
||||
///
|
||||
/// assert_eq!(format!("{:o}", x), "52");
|
||||
/// assert_eq!(format!("{:#o}", x), "0o52");
|
||||
/// ```
|
||||
///
|
||||
/// Implementing `Octal` on a type:
|
||||
@ -423,6 +457,8 @@ pub trait Octal {
|
||||
///
|
||||
/// The `Binary` trait should format its output as a number in binary.
|
||||
///
|
||||
/// The alternate flag, `#`, adds a `0b` in front of the output.
|
||||
///
|
||||
/// For more information on formatters, see [the module-level documentation][module].
|
||||
///
|
||||
/// [module]: ../index.html
|
||||
@ -435,6 +471,7 @@ pub trait Octal {
|
||||
/// let x = 42; // 42 is '101010' in binary
|
||||
///
|
||||
/// assert_eq!(format!("{:b}", x), "101010");
|
||||
/// assert_eq!(format!("{:#b}", x), "0b101010");
|
||||
/// ```
|
||||
///
|
||||
/// Implementing `Binary` on a type:
|
||||
@ -468,6 +505,8 @@ pub trait Binary {
|
||||
/// The `LowerHex` trait should format its output as a number in hexidecimal, with `a` through `f`
|
||||
/// in lower case.
|
||||
///
|
||||
/// The alternate flag, `#`, adds a `0x` in front of the output.
|
||||
///
|
||||
/// For more information on formatters, see [the module-level documentation][module].
|
||||
///
|
||||
/// [module]: ../index.html
|
||||
@ -480,6 +519,7 @@ pub trait Binary {
|
||||
/// let x = 42; // 42 is '2a' in hex
|
||||
///
|
||||
/// assert_eq!(format!("{:x}", x), "2a");
|
||||
/// assert_eq!(format!("{:#x}", x), "0x2a");
|
||||
/// ```
|
||||
///
|
||||
/// Implementing `LowerHex` on a type:
|
||||
@ -513,6 +553,8 @@ pub trait LowerHex {
|
||||
/// The `UpperHex` trait should format its output as a number in hexidecimal, with `A` through `F`
|
||||
/// in upper case.
|
||||
///
|
||||
/// The alternate flag, `#`, adds a `0x` in front of the output.
|
||||
///
|
||||
/// For more information on formatters, see [the module-level documentation][module].
|
||||
///
|
||||
/// [module]: ../index.html
|
||||
@ -525,6 +567,7 @@ pub trait LowerHex {
|
||||
/// let x = 42; // 42 is '2A' in hex
|
||||
///
|
||||
/// assert_eq!(format!("{:X}", x), "2A");
|
||||
/// assert_eq!(format!("{:#X}", x), "0x2A");
|
||||
/// ```
|
||||
///
|
||||
/// Implementing `UpperHex` on a type:
|
||||
|
@ -1368,10 +1368,14 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
|
||||
///
|
||||
/// The `len` argument is the number of **elements**, not the number of bytes.
|
||||
///
|
||||
/// # Unsafety
|
||||
///
|
||||
/// This function is unsafe as there is no guarantee that the given pointer is
|
||||
/// valid for `len` elements, nor whether the lifetime inferred is a suitable
|
||||
/// lifetime for the returned slice.
|
||||
///
|
||||
/// `p` must be non-null, even for zero-length slices.
|
||||
///
|
||||
/// # Caveat
|
||||
///
|
||||
/// The lifetime for the returned slice is inferred from its usage. To
|
||||
|
@ -1844,11 +1844,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
visit::walk_ty_param_bounds_helper(this, bounds);
|
||||
|
||||
for trait_item in trait_items {
|
||||
// Create a new rib for the trait_item-specific type
|
||||
// parameters.
|
||||
//
|
||||
// FIXME #4951: Do we need a node ID here?
|
||||
|
||||
match trait_item.node {
|
||||
ast::ConstTraitItem(_, ref default) => {
|
||||
// Only impose the restrictions of
|
||||
|
@ -21,7 +21,7 @@ use io::{self, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom};
|
||||
use ptr;
|
||||
use iter;
|
||||
|
||||
/// Wraps a `Read` and buffers input from it
|
||||
/// Wraps a `Read` and buffers input from it.
|
||||
///
|
||||
/// It can be excessively inefficient to work directly with a `Read` instance.
|
||||
/// For example, every call to `read` on `TcpStream` results in a system call.
|
||||
@ -54,13 +54,13 @@ pub struct BufReader<R> {
|
||||
}
|
||||
|
||||
impl<R: Read> BufReader<R> {
|
||||
/// Creates a new `BufReader` with a default buffer capacity
|
||||
/// Creates a new `BufReader` with a default buffer capacity.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn new(inner: R) -> BufReader<R> {
|
||||
BufReader::with_capacity(DEFAULT_BUF_SIZE, inner)
|
||||
}
|
||||
|
||||
/// Creates a new `BufReader` with the specified buffer capacity
|
||||
/// Creates a new `BufReader` with the specified buffer capacity.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn with_capacity(cap: usize, inner: R) -> BufReader<R> {
|
||||
let mut buf = Vec::with_capacity(cap);
|
||||
@ -183,7 +183,7 @@ impl<R: Seek> Seek for BufReader<R> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Wraps a Writer and buffers output to it
|
||||
/// Wraps a Writer and buffers output to it.
|
||||
///
|
||||
/// It can be excessively inefficient to work directly with a `Write`. For
|
||||
/// example, every call to `write` on `TcpStream` results in a system call. A
|
||||
@ -205,13 +205,13 @@ pub struct BufWriter<W: Write> {
|
||||
pub struct IntoInnerError<W>(W, Error);
|
||||
|
||||
impl<W: Write> BufWriter<W> {
|
||||
/// Creates a new `BufWriter` with a default buffer capacity
|
||||
/// Creates a new `BufWriter` with a default buffer capacity.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn new(inner: W) -> BufWriter<W> {
|
||||
BufWriter::with_capacity(DEFAULT_BUF_SIZE, inner)
|
||||
}
|
||||
|
||||
/// Creates a new `BufWriter` with the specified buffer capacity
|
||||
/// Creates a new `BufWriter` with the specified buffer capacity.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn with_capacity(cap: usize, inner: W) -> BufWriter<W> {
|
||||
BufWriter {
|
||||
@ -253,11 +253,11 @@ impl<W: Write> BufWriter<W> {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn get_ref(&self) -> &W { self.inner.as_ref().unwrap() }
|
||||
|
||||
/// Gets a mutable reference to the underlying write.
|
||||
/// Gets a mutable reference to the underlying writer.
|
||||
///
|
||||
/// # Warning
|
||||
///
|
||||
/// It is inadvisable to directly read from the underlying writer.
|
||||
/// It is inadvisable to directly write to the underlying writer.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn get_mut(&mut self) -> &mut W { self.inner.as_mut().unwrap() }
|
||||
|
||||
|
@ -1,8 +1,14 @@
|
||||
-include ../tools.mk
|
||||
|
||||
# FIXME: ignore freebsd
|
||||
# This is a basic test of LLVM ExecutionEngine functionality using compiled
|
||||
# Rust code built using the `rustc` crate.
|
||||
|
||||
ifneq ($(shell uname),FreeBSD)
|
||||
all:
|
||||
$(RUSTC) test.rs
|
||||
$(call RUN,test $(RUSTC))
|
||||
else
|
||||
all:
|
||||
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user