Skip to content
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

Rollup of 11 pull requests #51082

Merged
merged 27 commits into from
May 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2daa013
Underline multiple suggested replacements in the same line
estebank May 23, 2018
50eefc0
Account for negative offsets in suggestions
estebank May 24, 2018
1c2abda
Add `Once::new` as a way of constructing a `Once`
tbu- May 24, 2018
2a900e2
Update the `Once` docs to use `Once::new`
tbu- May 24, 2018
6a0806b
Remove unused lowering field and method
oli-obk May 24, 2018
f36c643
Fix impl Trait suggestion
estebank May 24, 2018
fe9a195
Add documentation about env! second argument
GuillaumeGomez May 23, 2018
6ff9409
Add more missing examples for Formatter
GuillaumeGomez May 24, 2018
8429d11
Use AllFacts from polonius-engine
spastorino May 24, 2018
de12d43
What does an expression look like, that consists only of special char…
oberien May 25, 2018
7c97203
Call it
oberien May 25, 2018
5ad84cf
Don't use a char that's already used within the expr
oberien May 25, 2018
37cbd11
Update nomicon link in transmute docs
mbrubeck May 25, 2018
91f7ae2
Add inner links in documentation
mcarton May 25, 2018
5724dad
Fail typecheck if we encounter a bogus break
est31 May 26, 2018
a49bc9c
Rename TokenStream::empty to TokenStream::new
dtolnay May 26, 2018
103abdb
Rollup merge of #50987 - estebank:underline-multiple-suggestions, r=p…
kennytm May 26, 2018
ee18e92
Rollup merge of #51014 - GuillaumeGomez:env_docs, r=QuietMisdreavus
kennytm May 26, 2018
e66ba0f
Rollup merge of #51034 - oli-obk:lowering, r=pnkfelix
kennytm May 26, 2018
e667e7b
Rollup merge of #51047 - spastorino:use_polonius_engine_facts, r=niko…
kennytm May 26, 2018
08b4170
Rollup merge of #51048 - GuillaumeGomez:formatter-examples, r=QuietMi…
kennytm May 26, 2018
e0e598b
Rollup merge of #51056 - tbu-:pr_once_new, r=dtolnay
kennytm May 26, 2018
5d95492
Rollup merge of #51059 - oberien:patch-1, r=nikomatsakis
kennytm May 26, 2018
18028eb
Rollup merge of #51065 - mbrubeck:docs, r=rkruppe
kennytm May 26, 2018
239e3d2
Rollup merge of #51067 - mcarton:patch-1, r=steveklabnik
kennytm May 26, 2018
5089ebc
Rollup merge of #51070 - est31:fix_break_const_ice, r=estebank
kennytm May 26, 2018
84b2e14
Rollup merge of #51073 - dtolnay:empty, r=alexcrichton
kennytm May 26, 2018
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
8 changes: 8 additions & 0 deletions src/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,11 @@ name = "pkg-config"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "polonius-engine"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "precomputed-hash"
version = "0.1.1"
Expand Down Expand Up @@ -1763,6 +1768,7 @@ dependencies = [
"jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"polonius-engine 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proc_macro 0.0.0",
"rustc_apfloat 0.0.0",
"rustc_data_structures 0.0.0",
Expand Down Expand Up @@ -2135,6 +2141,7 @@ dependencies = [
"graphviz 0.0.0",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"polonius-engine 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_apfloat 0.0.0",
"rustc_data_structures 0.0.0",
Expand Down Expand Up @@ -3134,6 +3141,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03"
"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum polonius-engine 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6201ffe79e3da53bd065fbec2a9b391e5a0dc21038b39bb300612ddc658eb7ee"
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6"
"checksum proc-macro2 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "49b6a521dc81b643e9a51e0d1cf05df46d5a2f3c0280ea72bcb68276ba64a118"
Expand Down
6 changes: 4 additions & 2 deletions src/liballoc/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@
//!
//! ## Fill/Alignment
//!
//! The fill character is provided normally in conjunction with the `width`
//! The fill character is provided normally in conjunction with the
//! [`width`](#width)
//! parameter. This indicates that if the value being formatted is smaller than
//! `width` some extra characters will be printed around it. The extra
//! characters are specified by `fill`, and the alignment can be one of the
Expand Down Expand Up @@ -388,7 +389,8 @@
//! padding specified by fill/alignment will be used to take up the required
//! space.
//!
//! The default fill/alignment for non-numerics is a space and left-aligned. The
//! The default [fill/alignment](#fillalignment) for non-numerics is a space and
//! left-aligned. The
//! defaults for numeric formatters is also a space but with right-alignment. If
//! the `0` flag is specified for numerics, then the implicit fill character is
//! `0`.
Expand Down
81 changes: 78 additions & 3 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,23 @@ impl<'a> Formatter<'a> {
/// is longer than this length
///
/// Notably this function ignores the `flag` parameters.
///
/// # Examples
///
/// ```
/// use std::fmt;
///
/// struct Foo;
///
/// impl fmt::Display for Foo {
/// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
/// formatter.pad("Foo")
/// }
/// }
///
/// assert_eq!(&format!("{:<4}", Foo), "Foo ");
/// assert_eq!(&format!("{:0>4}", Foo), "0Foo");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn pad(&mut self, s: &str) -> Result {
// Make sure there's a fast path up front
Expand Down Expand Up @@ -1368,7 +1385,7 @@ impl<'a> Formatter<'a> {
self.buf.write_str(data)
}

/// Writes some formatted information into this instance
/// Writes some formatted information into this instance.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn write_fmt(&mut self, fmt: Arguments) -> Result {
write(self.buf, fmt)
Expand All @@ -1381,11 +1398,69 @@ impl<'a> Formatter<'a> {
or `sign_aware_zero_pad` methods instead")]
pub fn flags(&self) -> u32 { self.flags }

/// Character used as 'fill' whenever there is alignment
/// Character used as 'fill' whenever there is alignment.
///
/// # Examples
///
/// ```
/// use std::fmt;
///
/// struct Foo;
///
/// impl fmt::Display for Foo {
/// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
/// let c = formatter.fill();
/// if let Some(width) = formatter.width() {
/// for _ in 0..width {
/// write!(formatter, "{}", c)?;
/// }
/// Ok(())
/// } else {
/// write!(formatter, "{}", c)
/// }
/// }
/// }
///
/// // We set alignment to the left with ">".
/// assert_eq!(&format!("{:G>3}", Foo), "GGG");
/// assert_eq!(&format!("{:t>6}", Foo), "tttttt");
/// ```
#[stable(feature = "fmt_flags", since = "1.5.0")]
pub fn fill(&self) -> char { self.fill }

/// Flag indicating what form of alignment was requested
/// Flag indicating what form of alignment was requested.
///
/// # Examples
///
/// ```
/// #![feature(fmt_flags_align)]
///
/// extern crate core;
///
/// use std::fmt;
/// use core::fmt::Alignment;
///
/// struct Foo;
///
/// impl fmt::Display for Foo {
/// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
/// let s = match formatter.align() {
/// Alignment::Left => "left",
/// Alignment::Right => "right",
/// Alignment::Center => "center",
/// Alignment::Unknown => "into the void",
/// };
/// write!(formatter, "{}", s)
/// }
/// }
///
/// fn main() {
/// assert_eq!(&format!("{:<}", Foo), "left");
/// assert_eq!(&format!("{:>}", Foo), "right");
/// assert_eq!(&format!("{:^}", Foo), "center");
/// assert_eq!(&format!("{}", Foo), "into the void");
/// }
/// ```
#[unstable(feature = "fmt_flags_align", reason = "method was just created",
issue = "27726")]
pub fn align(&self) -> Alignment {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ extern "rust-intrinsic" {
/// Reinterprets the bits of a value of one type as another type.
///
/// Both types must have the same size. Neither the original, nor the result,
/// may be an [invalid value](../../nomicon/meet-safe-and-unsafe.html).
/// may be an [invalid value](../../nomicon/what-unsafe-does.html).
///
/// `transmute` is semantically equivalent to a bitwise move of one type
/// into another. It copies the bits from the source value into the
Expand Down
2 changes: 1 addition & 1 deletion src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl !Sync for LexError {}
impl TokenStream {
/// Returns an empty `TokenStream` containing no token trees.
#[unstable(feature = "proc_macro", issue = "38356")]
pub fn empty() -> TokenStream {
pub fn new() -> TokenStream {
TokenStream(tokenstream::TokenStream::empty())
}

Expand Down
4 changes: 2 additions & 2 deletions src/libproc_macro/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ macro_rules! quote_tree {
}

macro_rules! quote {
() => { TokenStream::empty() };
() => { TokenStream::new() };
($($t:tt)*) => {
[$(quote_tree!($t),)*].iter()
.cloned()
Expand Down Expand Up @@ -104,7 +104,7 @@ impl<T: Quote> Quote for Option<T> {
impl Quote for TokenStream {
fn quote(self) -> TokenStream {
if self.is_empty() {
return quote!(::TokenStream::empty());
return quote!(::TokenStream::new());
}
let mut after_dollar = false;
let tokens = self.into_iter().filter_map(|tree| {
Expand Down
1 change: 1 addition & 0 deletions src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ graphviz = { path = "../libgraphviz" }
jobserver = "0.1"
lazy_static = "1.0.0"
log = { version = "0.4", features = ["release_max_level_info", "std"] }
polonius-engine = "0.1.1"
proc_macro = { path = "../libproc_macro" }
rustc_apfloat = { path = "../librustc_apfloat" }
rustc_target = { path = "../librustc_target" }
Expand Down
Loading