Skip to content

Commit f338dba

Browse files
committed
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:
2 parents 928a295 + 7914e6f commit f338dba

22 files changed

+90
-68
lines changed

src/liballoc/arc.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
5252
/// also destroyed.
5353
///
5454
/// Shared references in Rust disallow mutation by default, and `Arc` is no
55-
/// exception. If you need to mutate through an `Arc`, use [`Mutex`][mutex],
56-
/// [`RwLock`][rwlock], or one of the [`Atomic`][atomic] types.
55+
/// exception: you cannot generally obtain a mutable reference to something
56+
/// inside an `Arc`. If you need to mutate through an `Arc`, use
57+
/// [`Mutex`][mutex], [`RwLock`][rwlock], or one of the [`Atomic`][atomic]
58+
/// types.
5759
///
5860
/// ## Thread Safety
5961
///

src/liballoc/rc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//! given value is destroyed, the pointed-to value is also destroyed.
2020
//!
2121
//! Shared references in Rust disallow mutation by default, and [`Rc`]
22-
//! is no exception: you cannot obtain a mutable reference to
22+
//! is no exception: you cannot generally obtain a mutable reference to
2323
//! something inside an [`Rc`]. If you need mutability, put a [`Cell`]
2424
//! or [`RefCell`] inside the [`Rc`]; see [an example of mutability
2525
//! inside an Rc][mutability].

src/libcore/fmt/builders.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use fmt::{self, FlagV1};
11+
use fmt;
1212

1313
struct PadAdapter<'a, 'b: 'a> {
1414
fmt: &'a mut fmt::Formatter<'b>,
@@ -140,7 +140,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
140140
}
141141

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

@@ -233,7 +233,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
233233
}
234234

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

@@ -277,7 +277,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
277277
}
278278

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

@@ -519,6 +519,6 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
519519
}
520520

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

src/libcore/fmt/mod.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ impl<'a> ArgumentV1<'a> {
322322

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

328327
impl<'a> Arguments<'a> {
@@ -427,7 +426,7 @@ impl<'a> Display for Arguments<'a> {
427426
}
428427
}
429428

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

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

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

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

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

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

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

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

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

src/libcore/sync/atomic.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ pub fn hint_core_should_pause()
119119

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

249-
/// Returns a mutable reference to the underlying `bool`.
251+
/// Returns a mutable reference to the underlying [`bool`].
250252
///
251253
/// This is safe because the mutable reference guarantees that no other threads are
252254
/// concurrently accessing the atomic data.
253255
///
256+
/// [`bool`]: ../../../std/primitive.bool.html
257+
///
254258
/// # Examples
255259
///
256260
/// ```
@@ -369,7 +373,7 @@ impl AtomicBool {
369373
unsafe { atomic_swap(self.v.get(), val as u8, order) != 0 }
370374
}
371375

372-
/// Stores a value into the `bool` if the current value is the same as the `current` value.
376+
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
373377
///
374378
/// The return value is always the previous value. If it is equal to `current`, then the value
375379
/// was updated.
@@ -378,6 +382,7 @@ impl AtomicBool {
378382
/// ordering of this operation.
379383
///
380384
/// [`Ordering`]: enum.Ordering.html
385+
/// [`bool`]: ../../../std/primitive.bool.html
381386
///
382387
/// # Examples
383388
///
@@ -401,7 +406,7 @@ impl AtomicBool {
401406
}
402407
}
403408

404-
/// Stores a value into the `bool` if the current value is the same as the `current` value.
409+
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
405410
///
406411
/// The return value is a result indicating whether the new value was written and containing
407412
/// the previous value. On success this value is guaranteed to be equal to `current`.
@@ -412,6 +417,7 @@ impl AtomicBool {
412417
/// operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and must
413418
/// be equivalent or weaker than the success ordering.
414419
///
420+
/// [`bool`]: ../../../std/primitive.bool.html
415421
/// [`Ordering`]: enum.Ordering.html
416422
/// [`Release`]: enum.Ordering.html#variant.Release
417423
/// [`AcqRel`]: enum.Ordering.html#variant.Release
@@ -452,7 +458,7 @@ impl AtomicBool {
452458
}
453459
}
454460

455-
/// Stores a value into the `bool` if the current value is the same as the `current` value.
461+
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
456462
///
457463
/// Unlike [`compare_exchange`], this function is allowed to spuriously fail even when the
458464
/// comparison succeeds, which can result in more efficient code on some platforms. The
@@ -465,6 +471,7 @@ impl AtomicBool {
465471
/// failure ordering can't be [`Release`] or [`AcqRel`] and must be equivalent or
466472
/// weaker than the success ordering.
467473
///
474+
/// [`bool`]: ../../../std/primitive.bool.html
468475
/// [`compare_exchange`]: #method.compare_exchange
469476
/// [`Ordering`]: enum.Ordering.html
470477
/// [`Release`]: enum.Ordering.html#variant.Release

src/librustc/dep_graph/dep_node.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ impl fmt::Debug for DepNode {
375375
::ty::tls::with_opt(|opt_tcx| {
376376
if let Some(tcx) = opt_tcx {
377377
if let Some(def_id) = self.extract_def_id(tcx) {
378-
write!(f, "{}", tcx.def_path(def_id).to_string(tcx))?;
378+
write!(f, "{}", tcx.def_path_debug_str(def_id))?;
379379
} else if let Some(ref s) = tcx.dep_graph.dep_node_debug_str(*self) {
380380
write!(f, "{}", s)?;
381381
} else {
@@ -719,8 +719,8 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefId, De
719719
let (def_id_0, def_id_1) = *self;
720720

721721
format!("({}, {})",
722-
tcx.def_path(def_id_0).to_string(tcx),
723-
tcx.def_path(def_id_1).to_string(tcx))
722+
tcx.def_path_debug_str(def_id_0),
723+
tcx.def_path_debug_str(def_id_1))
724724
}
725725
}
726726

src/librustc/dep_graph/graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ impl DepGraph {
577577
"DepGraph::try_mark_green() - Duplicate DepNodeColor \
578578
insertion for {:?}", dep_node);
579579

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

src/librustc/hir/def_id.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,12 @@ pub struct DefId {
197197

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

203203
ty::tls::with_opt(|opt_tcx| {
204204
if let Some(tcx) = opt_tcx {
205-
write!(f, " => {}", tcx.def_path(*self).to_string(tcx))?;
205+
write!(f, " => {}", tcx.def_path_debug_str(*self))?;
206206
}
207207
Ok(())
208208
})?;

src/librustc/hir/map/definitions.rs

-21
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use std::hash::Hash;
2727
use syntax::ast;
2828
use syntax::ext::hygiene::Mark;
2929
use syntax::symbol::{Symbol, InternedString};
30-
use ty::TyCtxt;
3130
use util::nodemap::NodeMap;
3231

3332
/// The DefPathTable maps DefIndexes to DefKeys and vice versa.
@@ -296,26 +295,6 @@ impl DefPath {
296295
DefPath { data: data, krate: krate }
297296
}
298297

299-
pub fn to_string(&self, tcx: TyCtxt) -> String {
300-
let mut s = String::with_capacity(self.data.len() * 16);
301-
302-
s.push_str(&tcx.original_crate_name(self.krate).as_str());
303-
s.push_str("/");
304-
// Don't print the whole crate disambiguator. That's just annoying in
305-
// debug output.
306-
s.push_str(&tcx.crate_disambiguator(self.krate).as_str()[..7]);
307-
308-
for component in &self.data {
309-
write!(s,
310-
"::{}[{}]",
311-
component.data.as_interned_str(),
312-
component.disambiguator)
313-
.unwrap();
314-
}
315-
316-
s
317-
}
318-
319298
/// Returns a string representation of the DefPath without
320299
/// the crate-prefix. This method is useful if you don't have
321300
/// a TyCtxt available.

src/librustc/middle/stability.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl<'a, 'tcx> Index<'tcx> {
429429
// while maintaining the invariant that all sysroot crates are unstable
430430
// by default and are unable to be used.
431431
if tcx.sess.opts.debugging_opts.force_unstable_if_unmarked {
432-
let reason = "this crate is being loaded from the sysroot, and \
432+
let reason = "this crate is being loaded from the sysroot, an \
433433
unstable location; did you mean to load this crate \
434434
from crates.io via `Cargo.toml` instead?";
435435
let stability = tcx.intern_stability(Stability {

src/librustc/session/config.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
864864
build_codegen_options, "C", "codegen",
865865
CG_OPTIONS, cg_type_desc, cgsetters,
866866
ar: Option<String> = (None, parse_opt_string, [UNTRACKED],
867-
"tool to assemble archives with"),
867+
"tool to assemble archives with (has no effect currently, \
868+
rustc doesn't use an external archiver)"),
868869
linker: Option<String> = (None, parse_opt_string, [UNTRACKED],
869870
"system linker to link outputs with"),
870871
link_arg: Vec<String> = (vec![], parse_string_push, [UNTRACKED],

src/librustc/ty/context.rs

+21
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,27 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
12521252
}
12531253
}
12541254

1255+
pub fn def_path_debug_str(self, def_id: DefId) -> String {
1256+
// We are explicitly not going through queries here in order to get
1257+
// crate name and disambiguator since this code is called from debug!()
1258+
// statements within the query system and we'd run into endless
1259+
// recursion otherwise.
1260+
let (crate_name, crate_disambiguator) = if def_id.is_local() {
1261+
(self.crate_name.clone(),
1262+
self.sess.local_crate_disambiguator())
1263+
} else {
1264+
(self.cstore.crate_name_untracked(def_id.krate),
1265+
self.cstore.crate_disambiguator_untracked(def_id.krate))
1266+
};
1267+
1268+
format!("{}[{}]{}",
1269+
crate_name,
1270+
// Don't print the whole crate disambiguator. That's just
1271+
// annoying in debug output.
1272+
&(crate_disambiguator.as_str())[..4],
1273+
self.def_path(def_id).to_string_no_crate())
1274+
}
1275+
12551276
pub fn metadata_encoding_version(self) -> Vec<u8> {
12561277
self.cstore.metadata_encoding_version().to_vec()
12571278
}

src/librustc_back/target/arm_linux_androideabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use target::{Target, TargetOptions, TargetResult};
1414
pub fn target() -> TargetResult {
1515
let mut base = super::android_base::opts();
1616
// https://developer.android.com/ndk/guides/abis.html#armeabi
17-
base.features = "+v5te".to_string();
17+
base.features = "+strict-align,+v5te".to_string();
1818
base.max_atomic_width = Some(64);
1919

2020
Ok(Target {

src/librustc_back/target/arm_unknown_linux_gnueabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
2727
linker_flavor: LinkerFlavor::Gcc,
2828

2929
options: TargetOptions {
30-
features: "+v6".to_string(),
30+
features: "+strict-align,+v6".to_string(),
3131
abi_blacklist: super::arm_base::abi_blacklist(),
3232
.. base
3333
},

src/librustc_back/target/arm_unknown_linux_gnueabihf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
2727
linker_flavor: LinkerFlavor::Gcc,
2828

2929
options: TargetOptions {
30-
features: "+v6,+vfp2".to_string(),
30+
features: "+strict-align,+v6,+vfp2".to_string(),
3131
abi_blacklist: super::arm_base::abi_blacklist(),
3232
.. base
3333
}

src/librustc_back/target/arm_unknown_linux_musleabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
1616

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

0 commit comments

Comments
 (0)