Skip to content

Commit

Permalink
Auto merge of #45100 - kennytm:rollup, r=kennytm
Browse files Browse the repository at this point in the history
Rollup of 10 pull requests

- Successful merges: #45018, #45042, #45052, #45053, #45058, #45060, #45081, #45083, #45090, #45094
- Failed merges:
  • Loading branch information
bors committed Oct 8, 2017
2 parents 928a295 + 7914e6f commit f338dba
Show file tree
Hide file tree
Showing 22 changed files with 90 additions and 68 deletions.
6 changes: 4 additions & 2 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
/// also destroyed.
///
/// Shared references in Rust disallow mutation by default, and `Arc` is no
/// exception. If you need to mutate through an `Arc`, use [`Mutex`][mutex],
/// [`RwLock`][rwlock], or one of the [`Atomic`][atomic] types.
/// exception: you cannot generally obtain a mutable reference to something
/// inside an `Arc`. If you need to mutate through an `Arc`, use
/// [`Mutex`][mutex], [`RwLock`][rwlock], or one of the [`Atomic`][atomic]
/// types.
///
/// ## Thread Safety
///
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
//! given value is destroyed, the pointed-to value is also destroyed.
//!
//! Shared references in Rust disallow mutation by default, and [`Rc`]
//! is no exception: you cannot obtain a mutable reference to
//! is no exception: you cannot generally obtain a mutable reference to
//! something inside an [`Rc`]. If you need mutability, put a [`Cell`]
//! or [`RefCell`] inside the [`Rc`]; see [an example of mutability
//! inside an Rc][mutability].
Expand Down
10 changes: 5 additions & 5 deletions src/libcore/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use fmt::{self, FlagV1};
use fmt;

struct PadAdapter<'a, 'b: 'a> {
fmt: &'a mut fmt::Formatter<'b>,
Expand Down Expand Up @@ -140,7 +140,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
}

fn is_pretty(&self) -> bool {
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
self.fmt.alternate()
}
}

Expand Down Expand Up @@ -233,7 +233,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
}

fn is_pretty(&self) -> bool {
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
self.fmt.alternate()
}
}

Expand Down Expand Up @@ -277,7 +277,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
}

fn is_pretty(&self) -> bool {
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
self.fmt.alternate()
}
}

Expand Down Expand Up @@ -519,6 +519,6 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
}

fn is_pretty(&self) -> bool {
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
self.fmt.alternate()
}
}
19 changes: 9 additions & 10 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ impl<'a> ArgumentV1<'a> {

// flags available in the v1 format of format_args
#[derive(Copy, Clone)]
#[allow(dead_code)] // SignMinus isn't currently used
enum FlagV1 { SignPlus, SignMinus, Alternate, SignAwareZeroPad, }

impl<'a> Arguments<'a> {
Expand Down Expand Up @@ -427,7 +426,7 @@ impl<'a> Display for Arguments<'a> {
}
}

/// Format trait for the `?` character.
/// `?` formatting.
///
/// `Debug` should format the output in a programmer-facing, debugging context.
///
Expand Down Expand Up @@ -593,7 +592,7 @@ pub trait Display {
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `o` character.
/// `o` formatting.
///
/// The `Octal` trait should format its output as a number in base-8.
///
Expand Down Expand Up @@ -640,7 +639,7 @@ pub trait Octal {
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `b` character.
/// `b` formatting.
///
/// The `Binary` trait should format its output as a number in binary.
///
Expand Down Expand Up @@ -687,7 +686,7 @@ pub trait Binary {
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `x` character.
/// `x` formatting.
///
/// The `LowerHex` trait should format its output as a number in hexadecimal, with `a` through `f`
/// in lower case.
Expand Down Expand Up @@ -735,7 +734,7 @@ pub trait LowerHex {
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `X` character.
/// `X` formatting.
///
/// The `UpperHex` trait should format its output as a number in hexadecimal, with `A` through `F`
/// in upper case.
Expand Down Expand Up @@ -783,7 +782,7 @@ pub trait UpperHex {
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `p` character.
/// `p` formatting.
///
/// The `Pointer` trait should format its output as a memory location. This is commonly presented
/// as hexadecimal.
Expand Down Expand Up @@ -828,7 +827,7 @@ pub trait Pointer {
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `e` character.
/// `e` formatting.
///
/// The `LowerExp` trait should format its output in scientific notation with a lower-case `e`.
///
Expand Down Expand Up @@ -871,7 +870,7 @@ pub trait LowerExp {
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `E` character.
/// `E` formatting.
///
/// The `UpperExp` trait should format its output in scientific notation with an upper-case `E`.
///
Expand Down Expand Up @@ -1276,7 +1275,7 @@ impl<'a> Formatter<'a> {
write(self.buf, fmt)
}

/// Flags for formatting (packed version of rt::Flag)
/// Flags for formatting
#[stable(feature = "rust1", since = "1.0.0")]
pub fn flags(&self) -> u32 { self.flags }

Expand Down
17 changes: 12 additions & 5 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ pub fn hint_core_should_pause()

/// A boolean type which can be safely shared between threads.
///
/// This type has the same in-memory representation as a `bool`.
/// This type has the same in-memory representation as a [`bool`].
///
/// [`bool`]: ../../../std/primitive.bool.html
#[cfg(target_has_atomic = "8")]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct AtomicBool {
Expand Down Expand Up @@ -246,11 +248,13 @@ impl AtomicBool {
AtomicBool { v: UnsafeCell::new(v as u8) }
}

/// Returns a mutable reference to the underlying `bool`.
/// Returns a mutable reference to the underlying [`bool`].
///
/// This is safe because the mutable reference guarantees that no other threads are
/// concurrently accessing the atomic data.
///
/// [`bool`]: ../../../std/primitive.bool.html
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -369,7 +373,7 @@ impl AtomicBool {
unsafe { atomic_swap(self.v.get(), val as u8, order) != 0 }
}

/// Stores a value into the `bool` if the current value is the same as the `current` value.
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
///
/// The return value is always the previous value. If it is equal to `current`, then the value
/// was updated.
Expand All @@ -378,6 +382,7 @@ impl AtomicBool {
/// ordering of this operation.
///
/// [`Ordering`]: enum.Ordering.html
/// [`bool`]: ../../../std/primitive.bool.html
///
/// # Examples
///
Expand All @@ -401,7 +406,7 @@ impl AtomicBool {
}
}

/// Stores a value into the `bool` if the current value is the same as the `current` value.
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
///
/// The return value is a result indicating whether the new value was written and containing
/// the previous value. On success this value is guaranteed to be equal to `current`.
Expand All @@ -412,6 +417,7 @@ impl AtomicBool {
/// operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and must
/// be equivalent or weaker than the success ordering.
///
/// [`bool`]: ../../../std/primitive.bool.html
/// [`Ordering`]: enum.Ordering.html
/// [`Release`]: enum.Ordering.html#variant.Release
/// [`AcqRel`]: enum.Ordering.html#variant.Release
Expand Down Expand Up @@ -452,7 +458,7 @@ impl AtomicBool {
}
}

/// Stores a value into the `bool` if the current value is the same as the `current` value.
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
///
/// Unlike [`compare_exchange`], this function is allowed to spuriously fail even when the
/// comparison succeeds, which can result in more efficient code on some platforms. The
Expand All @@ -465,6 +471,7 @@ impl AtomicBool {
/// failure ordering can't be [`Release`] or [`AcqRel`] and must be equivalent or
/// weaker than the success ordering.
///
/// [`bool`]: ../../../std/primitive.bool.html
/// [`compare_exchange`]: #method.compare_exchange
/// [`Ordering`]: enum.Ordering.html
/// [`Release`]: enum.Ordering.html#variant.Release
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl fmt::Debug for DepNode {
::ty::tls::with_opt(|opt_tcx| {
if let Some(tcx) = opt_tcx {
if let Some(def_id) = self.extract_def_id(tcx) {
write!(f, "{}", tcx.def_path(def_id).to_string(tcx))?;
write!(f, "{}", tcx.def_path_debug_str(def_id))?;
} else if let Some(ref s) = tcx.dep_graph.dep_node_debug_str(*self) {
write!(f, "{}", s)?;
} else {
Expand Down Expand Up @@ -719,8 +719,8 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefId, De
let (def_id_0, def_id_1) = *self;

format!("({}, {})",
tcx.def_path(def_id_0).to_string(tcx),
tcx.def_path(def_id_1).to_string(tcx))
tcx.def_path_debug_str(def_id_0),
tcx.def_path_debug_str(def_id_1))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ impl DepGraph {
"DepGraph::try_mark_green() - Duplicate DepNodeColor \
insertion for {:?}", dep_node);

debug!("try_mark_green({:?}) - END - successfully marked as green", dep_node.kind);
debug!("try_mark_green({:?}) - END - successfully marked as green", dep_node);
Some(dep_node_index)
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/def_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ pub struct DefId {

impl fmt::Debug for DefId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "DefId {{ krate: {:?}, node: {:?}",
write!(f, "DefId {{ krate: {:?}, index: {:?}",
self.krate, self.index)?;

ty::tls::with_opt(|opt_tcx| {
if let Some(tcx) = opt_tcx {
write!(f, " => {}", tcx.def_path(*self).to_string(tcx))?;
write!(f, " => {}", tcx.def_path_debug_str(*self))?;
}
Ok(())
})?;
Expand Down
21 changes: 0 additions & 21 deletions src/librustc/hir/map/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use std::hash::Hash;
use syntax::ast;
use syntax::ext::hygiene::Mark;
use syntax::symbol::{Symbol, InternedString};
use ty::TyCtxt;
use util::nodemap::NodeMap;

/// The DefPathTable maps DefIndexes to DefKeys and vice versa.
Expand Down Expand Up @@ -296,26 +295,6 @@ impl DefPath {
DefPath { data: data, krate: krate }
}

pub fn to_string(&self, tcx: TyCtxt) -> String {
let mut s = String::with_capacity(self.data.len() * 16);

s.push_str(&tcx.original_crate_name(self.krate).as_str());
s.push_str("/");
// Don't print the whole crate disambiguator. That's just annoying in
// debug output.
s.push_str(&tcx.crate_disambiguator(self.krate).as_str()[..7]);

for component in &self.data {
write!(s,
"::{}[{}]",
component.data.as_interned_str(),
component.disambiguator)
.unwrap();
}

s
}

/// Returns a string representation of the DefPath without
/// the crate-prefix. This method is useful if you don't have
/// a TyCtxt available.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl<'a, 'tcx> Index<'tcx> {
// while maintaining the invariant that all sysroot crates are unstable
// by default and are unable to be used.
if tcx.sess.opts.debugging_opts.force_unstable_if_unmarked {
let reason = "this crate is being loaded from the sysroot, and \
let reason = "this crate is being loaded from the sysroot, an \
unstable location; did you mean to load this crate \
from crates.io via `Cargo.toml` instead?";
let stability = tcx.intern_stability(Stability {
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
build_codegen_options, "C", "codegen",
CG_OPTIONS, cg_type_desc, cgsetters,
ar: Option<String> = (None, parse_opt_string, [UNTRACKED],
"tool to assemble archives with"),
"tool to assemble archives with (has no effect currently, \
rustc doesn't use an external archiver)"),
linker: Option<String> = (None, parse_opt_string, [UNTRACKED],
"system linker to link outputs with"),
link_arg: Vec<String> = (vec![], parse_string_push, [UNTRACKED],
Expand Down
21 changes: 21 additions & 0 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,27 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
}
}

pub fn def_path_debug_str(self, def_id: DefId) -> String {
// We are explicitly not going through queries here in order to get
// crate name and disambiguator since this code is called from debug!()
// statements within the query system and we'd run into endless
// recursion otherwise.
let (crate_name, crate_disambiguator) = if def_id.is_local() {
(self.crate_name.clone(),
self.sess.local_crate_disambiguator())
} else {
(self.cstore.crate_name_untracked(def_id.krate),
self.cstore.crate_disambiguator_untracked(def_id.krate))
};

format!("{}[{}]{}",
crate_name,
// Don't print the whole crate disambiguator. That's just
// annoying in debug output.
&(crate_disambiguator.as_str())[..4],
self.def_path(def_id).to_string_no_crate())
}

pub fn metadata_encoding_version(self) -> Vec<u8> {
self.cstore.metadata_encoding_version().to_vec()
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/target/arm_linux_androideabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use target::{Target, TargetOptions, TargetResult};
pub fn target() -> TargetResult {
let mut base = super::android_base::opts();
// https://developer.android.com/ndk/guides/abis.html#armeabi
base.features = "+v5te".to_string();
base.features = "+strict-align,+v5te".to_string();
base.max_atomic_width = Some(64);

Ok(Target {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/target/arm_unknown_linux_gnueabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
linker_flavor: LinkerFlavor::Gcc,

options: TargetOptions {
features: "+v6".to_string(),
features: "+strict-align,+v6".to_string(),
abi_blacklist: super::arm_base::abi_blacklist(),
.. base
},
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/target/arm_unknown_linux_gnueabihf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
linker_flavor: LinkerFlavor::Gcc,

options: TargetOptions {
features: "+v6,+vfp2".to_string(),
features: "+strict-align,+v6,+vfp2".to_string(),
abi_blacklist: super::arm_base::abi_blacklist(),
.. base
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/target/arm_unknown_linux_musleabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn target() -> TargetResult {

// Most of these settings are copied from the arm_unknown_linux_gnueabi
// target.
base.features = "+v6".to_string();
base.features = "+strict-align,+v6".to_string();
base.max_atomic_width = Some(64);
Ok(Target {
// It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
Expand Down
Loading

0 comments on commit f338dba

Please sign in to comment.