提交 f338dba2 编写于 作者: B bors

Auto merge of #45100 - kennytm:rollup, r=kennytm

Rollup of 10 pull requests

- Successful merges: #45018, #45042, #45052, #45053, #45058, #45060, #45081, #45083, #45090, #45094
- Failed merges:
...@@ -52,8 +52,10 @@ ...@@ -52,8 +52,10 @@
/// also destroyed. /// also destroyed.
/// ///
/// Shared references in Rust disallow mutation by default, and `Arc` is no /// Shared references in Rust disallow mutation by default, and `Arc` is no
/// exception. If you need to mutate through an `Arc`, use [`Mutex`][mutex], /// exception: you cannot generally obtain a mutable reference to something
/// [`RwLock`][rwlock], or one of the [`Atomic`][atomic] types. /// 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 /// ## Thread Safety
/// ///
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
//! given value is destroyed, the pointed-to value is also destroyed. //! given value is destroyed, the pointed-to value is also destroyed.
//! //!
//! Shared references in Rust disallow mutation by default, and [`Rc`] //! 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`] //! something inside an [`Rc`]. If you need mutability, put a [`Cell`]
//! or [`RefCell`] inside the [`Rc`]; see [an example of mutability //! or [`RefCell`] inside the [`Rc`]; see [an example of mutability
//! inside an Rc][mutability]. //! inside an Rc][mutability].
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use fmt::{self, FlagV1}; use fmt;
struct PadAdapter<'a, 'b: 'a> { struct PadAdapter<'a, 'b: 'a> {
fmt: &'a mut fmt::Formatter<'b>, fmt: &'a mut fmt::Formatter<'b>,
...@@ -140,7 +140,7 @@ pub fn finish(&mut self) -> fmt::Result { ...@@ -140,7 +140,7 @@ pub fn finish(&mut self) -> fmt::Result {
} }
fn is_pretty(&self) -> bool { fn is_pretty(&self) -> bool {
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0 self.fmt.alternate()
} }
} }
...@@ -233,7 +233,7 @@ pub fn finish(&mut self) -> fmt::Result { ...@@ -233,7 +233,7 @@ pub fn finish(&mut self) -> fmt::Result {
} }
fn is_pretty(&self) -> bool { fn is_pretty(&self) -> bool {
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0 self.fmt.alternate()
} }
} }
...@@ -277,7 +277,7 @@ pub fn finish(&mut self) { ...@@ -277,7 +277,7 @@ pub fn finish(&mut self) {
} }
fn is_pretty(&self) -> bool { fn is_pretty(&self) -> bool {
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0 self.fmt.alternate()
} }
} }
...@@ -519,6 +519,6 @@ pub fn finish(&mut self) -> fmt::Result { ...@@ -519,6 +519,6 @@ pub fn finish(&mut self) -> fmt::Result {
} }
fn is_pretty(&self) -> bool { fn is_pretty(&self) -> bool {
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0 self.fmt.alternate()
} }
} }
...@@ -322,7 +322,6 @@ fn as_usize(&self) -> Option<usize> { ...@@ -322,7 +322,6 @@ fn as_usize(&self) -> Option<usize> {
// flags available in the v1 format of format_args // flags available in the v1 format of format_args
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[allow(dead_code)] // SignMinus isn't currently used
enum FlagV1 { SignPlus, SignMinus, Alternate, SignAwareZeroPad, } enum FlagV1 { SignPlus, SignMinus, Alternate, SignAwareZeroPad, }
impl<'a> Arguments<'a> { impl<'a> Arguments<'a> {
...@@ -427,7 +426,7 @@ fn fmt(&self, fmt: &mut Formatter) -> Result { ...@@ -427,7 +426,7 @@ fn fmt(&self, fmt: &mut Formatter) -> Result {
} }
} }
/// Format trait for the `?` character. /// `?` formatting.
/// ///
/// `Debug` should format the output in a programmer-facing, debugging context. /// `Debug` should format the output in a programmer-facing, debugging context.
/// ///
...@@ -593,7 +592,7 @@ pub trait Display { ...@@ -593,7 +592,7 @@ pub trait Display {
fn fmt(&self, f: &mut Formatter) -> Result; 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. /// The `Octal` trait should format its output as a number in base-8.
/// ///
...@@ -640,7 +639,7 @@ pub trait Octal { ...@@ -640,7 +639,7 @@ pub trait Octal {
fn fmt(&self, f: &mut Formatter) -> Result; 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. /// The `Binary` trait should format its output as a number in binary.
/// ///
...@@ -687,7 +686,7 @@ pub trait Binary { ...@@ -687,7 +686,7 @@ pub trait Binary {
fn fmt(&self, f: &mut Formatter) -> Result; 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` /// The `LowerHex` trait should format its output as a number in hexadecimal, with `a` through `f`
/// in lower case. /// in lower case.
...@@ -735,7 +734,7 @@ pub trait LowerHex { ...@@ -735,7 +734,7 @@ pub trait LowerHex {
fn fmt(&self, f: &mut Formatter) -> Result; 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` /// The `UpperHex` trait should format its output as a number in hexadecimal, with `A` through `F`
/// in upper case. /// in upper case.
...@@ -783,7 +782,7 @@ pub trait UpperHex { ...@@ -783,7 +782,7 @@ pub trait UpperHex {
fn fmt(&self, f: &mut Formatter) -> Result; 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 /// The `Pointer` trait should format its output as a memory location. This is commonly presented
/// as hexadecimal. /// as hexadecimal.
...@@ -828,7 +827,7 @@ pub trait Pointer { ...@@ -828,7 +827,7 @@ pub trait Pointer {
fn fmt(&self, f: &mut Formatter) -> Result; 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`. /// The `LowerExp` trait should format its output in scientific notation with a lower-case `e`.
/// ///
...@@ -871,7 +870,7 @@ pub trait LowerExp { ...@@ -871,7 +870,7 @@ pub trait LowerExp {
fn fmt(&self, f: &mut Formatter) -> Result; 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`. /// The `UpperExp` trait should format its output in scientific notation with an upper-case `E`.
/// ///
...@@ -1276,7 +1275,7 @@ pub fn write_fmt(&mut self, fmt: Arguments) -> Result { ...@@ -1276,7 +1275,7 @@ pub fn write_fmt(&mut self, fmt: Arguments) -> Result {
write(self.buf, fmt) write(self.buf, fmt)
} }
/// Flags for formatting (packed version of rt::Flag) /// Flags for formatting
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn flags(&self) -> u32 { self.flags } pub fn flags(&self) -> u32 { self.flags }
......
...@@ -119,7 +119,9 @@ pub fn hint_core_should_pause() ...@@ -119,7 +119,9 @@ pub fn hint_core_should_pause()
/// A boolean type which can be safely shared between threads. /// 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")] #[cfg(target_has_atomic = "8")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct AtomicBool { pub struct AtomicBool {
...@@ -246,11 +248,13 @@ pub const fn new(v: bool) -> AtomicBool { ...@@ -246,11 +248,13 @@ pub const fn new(v: bool) -> AtomicBool {
AtomicBool { v: UnsafeCell::new(v as u8) } 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 /// This is safe because the mutable reference guarantees that no other threads are
/// concurrently accessing the atomic data. /// concurrently accessing the atomic data.
/// ///
/// [`bool`]: ../../../std/primitive.bool.html
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
...@@ -369,7 +373,7 @@ pub fn swap(&self, val: bool, order: Ordering) -> bool { ...@@ -369,7 +373,7 @@ pub fn swap(&self, val: bool, order: Ordering) -> bool {
unsafe { atomic_swap(self.v.get(), val as u8, order) != 0 } 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 /// The return value is always the previous value. If it is equal to `current`, then the value
/// was updated. /// was updated.
...@@ -378,6 +382,7 @@ pub fn swap(&self, val: bool, order: Ordering) -> bool { ...@@ -378,6 +382,7 @@ pub fn swap(&self, val: bool, order: Ordering) -> bool {
/// ordering of this operation. /// ordering of this operation.
/// ///
/// [`Ordering`]: enum.Ordering.html /// [`Ordering`]: enum.Ordering.html
/// [`bool`]: ../../../std/primitive.bool.html
/// ///
/// # Examples /// # Examples
/// ///
...@@ -401,7 +406,7 @@ pub fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> boo ...@@ -401,7 +406,7 @@ pub fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> boo
} }
} }
/// 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 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`. /// the previous value. On success this value is guaranteed to be equal to `current`.
...@@ -412,6 +417,7 @@ pub fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> boo ...@@ -412,6 +417,7 @@ pub fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> boo
/// operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and must /// operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and must
/// be equivalent or weaker than the success ordering. /// be equivalent or weaker than the success ordering.
/// ///
/// [`bool`]: ../../../std/primitive.bool.html
/// [`Ordering`]: enum.Ordering.html /// [`Ordering`]: enum.Ordering.html
/// [`Release`]: enum.Ordering.html#variant.Release /// [`Release`]: enum.Ordering.html#variant.Release
/// [`AcqRel`]: enum.Ordering.html#variant.Release /// [`AcqRel`]: enum.Ordering.html#variant.Release
...@@ -452,7 +458,7 @@ pub fn compare_exchange(&self, ...@@ -452,7 +458,7 @@ pub fn compare_exchange(&self,
} }
} }
/// 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 /// 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 /// comparison succeeds, which can result in more efficient code on some platforms. The
...@@ -465,6 +471,7 @@ pub fn compare_exchange(&self, ...@@ -465,6 +471,7 @@ pub fn compare_exchange(&self,
/// failure ordering can't be [`Release`] or [`AcqRel`] and must be equivalent or /// failure ordering can't be [`Release`] or [`AcqRel`] and must be equivalent or
/// weaker than the success ordering. /// weaker than the success ordering.
/// ///
/// [`bool`]: ../../../std/primitive.bool.html
/// [`compare_exchange`]: #method.compare_exchange /// [`compare_exchange`]: #method.compare_exchange
/// [`Ordering`]: enum.Ordering.html /// [`Ordering`]: enum.Ordering.html
/// [`Release`]: enum.Ordering.html#variant.Release /// [`Release`]: enum.Ordering.html#variant.Release
......
...@@ -375,7 +375,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { ...@@ -375,7 +375,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
::ty::tls::with_opt(|opt_tcx| { ::ty::tls::with_opt(|opt_tcx| {
if let Some(tcx) = opt_tcx { if let Some(tcx) = opt_tcx {
if let Some(def_id) = self.extract_def_id(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) { } else if let Some(ref s) = tcx.dep_graph.dep_node_debug_str(*self) {
write!(f, "{}", s)?; write!(f, "{}", s)?;
} else { } else {
...@@ -719,8 +719,8 @@ fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String { ...@@ -719,8 +719,8 @@ fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String {
let (def_id_0, def_id_1) = *self; let (def_id_0, def_id_1) = *self;
format!("({}, {})", format!("({}, {})",
tcx.def_path(def_id_0).to_string(tcx), tcx.def_path_debug_str(def_id_0),
tcx.def_path(def_id_1).to_string(tcx)) tcx.def_path_debug_str(def_id_1))
} }
} }
......
...@@ -577,7 +577,7 @@ pub fn try_mark_green(&self, ...@@ -577,7 +577,7 @@ pub fn try_mark_green(&self,
"DepGraph::try_mark_green() - Duplicate DepNodeColor \ "DepGraph::try_mark_green() - Duplicate DepNodeColor \
insertion for {:?}", dep_node); 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) Some(dep_node_index)
} }
......
...@@ -197,12 +197,12 @@ pub struct DefId { ...@@ -197,12 +197,12 @@ pub struct DefId {
impl fmt::Debug for DefId { impl fmt::Debug for DefId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "DefId {{ krate: {:?}, node: {:?}", write!(f, "DefId {{ krate: {:?}, index: {:?}",
self.krate, self.index)?; self.krate, self.index)?;
ty::tls::with_opt(|opt_tcx| { ty::tls::with_opt(|opt_tcx| {
if let Some(tcx) = 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(()) Ok(())
})?; })?;
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
use syntax::ast; use syntax::ast;
use syntax::ext::hygiene::Mark; use syntax::ext::hygiene::Mark;
use syntax::symbol::{Symbol, InternedString}; use syntax::symbol::{Symbol, InternedString};
use ty::TyCtxt;
use util::nodemap::NodeMap; use util::nodemap::NodeMap;
/// The DefPathTable maps DefIndexes to DefKeys and vice versa. /// The DefPathTable maps DefIndexes to DefKeys and vice versa.
...@@ -296,26 +295,6 @@ pub fn make<FN>(krate: CrateNum, ...@@ -296,26 +295,6 @@ pub fn make<FN>(krate: CrateNum,
DefPath { data: data, krate: krate } 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 /// Returns a string representation of the DefPath without
/// the crate-prefix. This method is useful if you don't have /// the crate-prefix. This method is useful if you don't have
/// a TyCtxt available. /// a TyCtxt available.
......
...@@ -429,7 +429,7 @@ pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Index<'tcx> { ...@@ -429,7 +429,7 @@ pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Index<'tcx> {
// while maintaining the invariant that all sysroot crates are unstable // while maintaining the invariant that all sysroot crates are unstable
// by default and are unable to be used. // by default and are unable to be used.
if tcx.sess.opts.debugging_opts.force_unstable_if_unmarked { 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 \ unstable location; did you mean to load this crate \
from crates.io via `Cargo.toml` instead?"; from crates.io via `Cargo.toml` instead?";
let stability = tcx.intern_stability(Stability { let stability = tcx.intern_stability(Stability {
......
...@@ -864,7 +864,8 @@ fn parse_optimization_fuel(slot: &mut Option<(String, u64)>, v: Option<&str>) -> ...@@ -864,7 +864,8 @@ fn parse_optimization_fuel(slot: &mut Option<(String, u64)>, v: Option<&str>) ->
build_codegen_options, "C", "codegen", build_codegen_options, "C", "codegen",
CG_OPTIONS, cg_type_desc, cgsetters, CG_OPTIONS, cg_type_desc, cgsetters,
ar: Option<String> = (None, parse_opt_string, [UNTRACKED], 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], linker: Option<String> = (None, parse_opt_string, [UNTRACKED],
"system linker to link outputs with"), "system linker to link outputs with"),
link_arg: Vec<String> = (vec![], parse_string_push, [UNTRACKED], link_arg: Vec<String> = (vec![], parse_string_push, [UNTRACKED],
......
...@@ -1252,6 +1252,27 @@ pub fn def_path_hash(self, def_id: DefId) -> hir_map::DefPathHash { ...@@ -1252,6 +1252,27 @@ pub fn def_path_hash(self, def_id: DefId) -> hir_map::DefPathHash {
} }
} }
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> { pub fn metadata_encoding_version(self) -> Vec<u8> {
self.cstore.metadata_encoding_version().to_vec() self.cstore.metadata_encoding_version().to_vec()
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
pub fn target() -> TargetResult { pub fn target() -> TargetResult {
let mut base = super::android_base::opts(); let mut base = super::android_base::opts();
// https://developer.android.com/ndk/guides/abis.html#armeabi // 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); base.max_atomic_width = Some(64);
Ok(Target { Ok(Target {
......
...@@ -27,7 +27,7 @@ pub fn target() -> TargetResult { ...@@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
features: "+v6".to_string(), features: "+strict-align,+v6".to_string(),
abi_blacklist: super::arm_base::abi_blacklist(), abi_blacklist: super::arm_base::abi_blacklist(),
.. base .. base
}, },
......
...@@ -27,7 +27,7 @@ pub fn target() -> TargetResult { ...@@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
linker_flavor: LinkerFlavor::Gcc, linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { options: TargetOptions {
features: "+v6,+vfp2".to_string(), features: "+strict-align,+v6,+vfp2".to_string(),
abi_blacklist: super::arm_base::abi_blacklist(), abi_blacklist: super::arm_base::abi_blacklist(),
.. base .. base
} }
......
...@@ -16,7 +16,7 @@ pub fn target() -> TargetResult { ...@@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
// Most of these settings are copied from the arm_unknown_linux_gnueabi // Most of these settings are copied from the arm_unknown_linux_gnueabi
// target. // target.
base.features = "+v6".to_string(); base.features = "+strict-align,+v6".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Ok(Target { Ok(Target {
// It's important we use "gnueabi" and not "musleabi" here. LLVM uses it // It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
......
...@@ -16,7 +16,7 @@ pub fn target() -> TargetResult { ...@@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
// Most of these settings are copied from the arm_unknown_linux_gnueabihf // Most of these settings are copied from the arm_unknown_linux_gnueabihf
// target. // target.
base.features = "+v6,+vfp2".to_string(); base.features = "+strict-align,+v6,+vfp2".to_string();
base.max_atomic_width = Some(64); base.max_atomic_width = Some(64);
Ok(Target { Ok(Target {
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM // It's important we use "gnueabihf" and not "musleabihf" here. LLVM
......
...@@ -206,6 +206,14 @@ fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { ...@@ -206,6 +206,14 @@ fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
*self = b; *self = b;
Ok(()) Ok(())
} }
#[inline]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
buf.extend_from_slice(*self);
let len = self.len();
*self = &self[len..];
Ok(len)
}
} }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
......
...@@ -3671,12 +3671,17 @@ fn parse_local(&mut self, attrs: ThinVec<Attribute>) -> PResult<'a, P<Local>> { ...@@ -3671,12 +3671,17 @@ fn parse_local(&mut self, attrs: ThinVec<Attribute>) -> PResult<'a, P<Local>> {
None None
}; };
let init = self.parse_initializer()?; let init = self.parse_initializer()?;
let hi = if self.token == token::Semi {
self.span
} else {
self.prev_span
};
Ok(P(ast::Local { Ok(P(ast::Local {
ty, ty,
pat, pat,
init, init,
id: ast::DUMMY_NODE_ID, id: ast::DUMMY_NODE_ID,
span: lo.to(self.prev_span), span: lo.to(hi),
attrs, attrs,
})) }))
} }
......
...@@ -30,7 +30,7 @@ fn main() { ...@@ -30,7 +30,7 @@ fn main() {
// END RUST SOURCE // END RUST SOURCE
// START rustc.node12.EraseRegions.after.mir // START rustc.node12.EraseRegions.after.mir
// bb0: { // bb0: {
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(0:5) => validate_1/8cd878b::{{impl}}[0]::foo[0] }, BrAnon(0)) Test, _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(0:5) => validate_1/8cd878b::{{impl}}[0]::foo[0] }, BrAnon(1)) mut i32]); // Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:5) => validate_1[8cd8]::{{impl}}[0]::foo[0] }, BrAnon(0)) Test, _2: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:5) => validate_1[8cd8]::{{impl}}[0]::foo[0] }, BrAnon(1)) mut i32]);
// return; // return;
// } // }
// END rustc.node12.EraseRegions.after.mir // END rustc.node12.EraseRegions.after.mir
...@@ -57,7 +57,7 @@ fn main() { ...@@ -57,7 +57,7 @@ fn main() {
// START rustc.node50.EraseRegions.after.mir // START rustc.node50.EraseRegions.after.mir
// fn main::{{closure}}(_1: &ReErased [closure@NodeId(50)], _2: &ReErased mut i32) -> i32 { // fn main::{{closure}}(_1: &ReErased [closure@NodeId(50)], _2: &ReErased mut i32) -> i32 {
// bb0: { // bb0: {
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(1:11) => validate_1/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(50)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(1:11) => validate_1/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]); // Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:11) => validate_1[8cd8]::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(50)], _2: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:11) => validate_1[8cd8]::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]);
// StorageLive(_3); // StorageLive(_3);
// _3 = _2; // _3 = _2;
// StorageLive(_4); // StorageLive(_4);
......
...@@ -48,8 +48,8 @@ fn main() { ...@@ -48,8 +48,8 @@ fn main() {
// START rustc.node22.EraseRegions.after.mir // START rustc.node22.EraseRegions.after.mir
// fn write_42::{{closure}}(_1: &ReErased [closure@NodeId(22)], _2: *mut i32) -> () { // fn write_42::{{closure}}(_1: &ReErased [closure@NodeId(22)], _2: *mut i32) -> () {
// bb0: { // bb0: {
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(1:9) => validate_4/8cd878b::write_42[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(22)], _2: *mut i32]); // Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:9) => validate_4[8cd8]::write_42[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(22)], _2: *mut i32]);
// Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(1:9) => validate_4/8cd878b::write_42[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(22)], _2: *mut i32]); // Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:9) => validate_4[8cd8]::write_42[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(22)], _2: *mut i32]);
// StorageLive(_3); // StorageLive(_3);
// _3 = _2; // _3 = _2;
// (*_3) = const 23i32; // (*_3) = const 23i32;
...@@ -61,8 +61,8 @@ fn main() { ...@@ -61,8 +61,8 @@ fn main() {
// START rustc.node31.EraseRegions.after.mir // START rustc.node31.EraseRegions.after.mir
// fn test(_1: &ReErased mut i32) -> () { // fn test(_1: &ReErased mut i32) -> () {
// bb0: { // bb0: {
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(0:4) => validate_4/8cd878b::test[0] }, BrAnon(0)) mut i32]); // Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:4) => validate_4[8cd8]::test[0] }, BrAnon(0)) mut i32]);
// Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(0:4) => validate_4/8cd878b::test[0] }, BrAnon(0)) mut i32]); // Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:4) => validate_4[8cd8]::test[0] }, BrAnon(0)) mut i32]);
// _3 = const write_42(_4) -> bb1; // _3 = const write_42(_4) -> bb1;
// } // }
// bb1: { // bb1: {
...@@ -74,8 +74,8 @@ fn main() { ...@@ -74,8 +74,8 @@ fn main() {
// START rustc.node60.EraseRegions.after.mir // START rustc.node60.EraseRegions.after.mir
// fn main::{{closure}}(_1: &ReErased [closure@NodeId(60)], _2: &ReErased mut i32) -> bool { // fn main::{{closure}}(_1: &ReErased [closure@NodeId(60)], _2: &ReErased mut i32) -> bool {
// bb0: { // bb0: {
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(1:10) => validate_4/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(60)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(1:10) => validate_4/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]); // Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:10) => validate_4[8cd8]::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(60)], _2: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:10) => validate_4[8cd8]::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]);
// Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(1:10) => validate_4/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(60)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(1:10) => validate_4/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]); // Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:10) => validate_4[8cd8]::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(60)], _2: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:10) => validate_4[8cd8]::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]);
// StorageLive(_3); // StorageLive(_3);
// _0 = const write_42(_4) -> bb1; // _0 = const write_42(_4) -> bb1;
// } // }
......
...@@ -36,7 +36,7 @@ fn main() { ...@@ -36,7 +36,7 @@ fn main() {
// START rustc.node17.EraseRegions.after.mir // START rustc.node17.EraseRegions.after.mir
// fn test(_1: &ReErased mut i32) -> () { // fn test(_1: &ReErased mut i32) -> () {
// bb0: { // bb0: {
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(0:4) => validate_5/8cd878b::test[0] }, BrAnon(0)) mut i32]); // Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(0:4) => validate_5[8cd8]::test[0] }, BrAnon(0)) mut i32]);
// Validate(Release, [_3: bool, _4: *mut i32]); // Validate(Release, [_3: bool, _4: *mut i32]);
// _3 = const write_42(_4) -> bb1; // _3 = const write_42(_4) -> bb1;
// } // }
...@@ -45,7 +45,7 @@ fn main() { ...@@ -45,7 +45,7 @@ fn main() {
// START rustc.node46.EraseRegions.after.mir // START rustc.node46.EraseRegions.after.mir
// fn main::{{closure}}(_1: &ReErased [closure@NodeId(46)], _2: &ReErased mut i32) -> bool { // fn main::{{closure}}(_1: &ReErased [closure@NodeId(46)], _2: &ReErased mut i32) -> bool {
// bb0: { // bb0: {
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(1:9) => validate_5/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(46)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(1:9) => validate_5/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]); // Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:9) => validate_5[8cd8]::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(46)], _2: &ReFree(DefId { krate: CrateNum(0), index: DefIndex(1:9) => validate_5[8cd8]::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]);
// StorageLive(_3); // StorageLive(_3);
// _3 = _2; // _3 = _2;
// StorageLive(_4); // StorageLive(_4);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册