Skip to content

Commit bff0090

Browse files
committed
Auto merge of #52088 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests Successful merges: - #51619 (rust: add initial changes to support powerpc64le musl) - #51793 (Fix variant background color on hover in search results) - #52005 (Update LLVM to bring in a wasm codegen fix) - #52016 (Deduplicate error reports for statics) - #52019 ([cross-lang-lto] Allow the linker to choose the LTO-plugin (which is useful when using LLD)) - #52030 (Any docs preposition change) - #52031 (Strenghten synchronization in `Arc::is_unique`) - #52033 ([Gardening] Update outdated comments: ByVal -> Scalar) - #52052 (Make verbose --version show if parallel queries are supported.) - #52055 (Include VS 2017 in error message.) - #52063 (Add a link to the rustc docs) - #52073 (Add a punch card to weird expressions test) - #52080 (Improve dependency deduplication diagnostics) - #51953 (enable Atomic*.{load,store} for ARMv6-M / MSP430) Failed merges:
2 parents a8403e1 + 5da9fdc commit bff0090

File tree

29 files changed

+196
-84
lines changed

29 files changed

+196
-84
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,16 @@ variety of channels on Mozilla's IRC network, irc.mozilla.org. The
225225
most popular channel is [#rust], a venue for general discussion about
226226
Rust. And a good place to ask for help would be [#rust-beginners].
227227

228-
Also, the [rustc guide] might be a good place to start if you want to
229-
find out how various parts of the compiler work.
228+
The [rustc guide] might be a good place to start if you want to find out how
229+
various parts of the compiler work.
230+
231+
Also, you may find the [rustdocs for the compiler itself][rustdocs] useful.
230232

231233
[IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat
232234
[#rust]: irc://irc.mozilla.org/rust
233235
[#rust-beginners]: irc://irc.mozilla.org/rust-beginners
234236
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/about-this-guide.html
237+
[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/
235238

236239
## License
237240
[license]: #license

src/bootstrap/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
116116
#![deny(warnings)]
117117
#![feature(core_intrinsics)]
118+
#![feature(drain_filter)]
118119

119120
#[macro_use]
120121
extern crate build_helper;

src/bootstrap/native.rs

+1
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ impl Step for Openssl {
631631
"powerpc-unknown-netbsd" => "BSD-generic32",
632632
"powerpc64-unknown-linux-gnu" => "linux-ppc64",
633633
"powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
634+
"powerpc64le-unknown-linux-musl" => "linux-ppc64le",
634635
"s390x-unknown-linux-gnu" => "linux64-s390x",
635636
"sparc-unknown-linux-gnu" => "linux-sparcv9",
636637
"sparc64-unknown-linux-gnu" => "linux64-sparcv9",

src/bootstrap/tool.rs

+22-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::env;
1313
use std::iter;
1414
use std::path::PathBuf;
1515
use std::process::{Command, exit};
16+
use std::collections::HashSet;
1617

1718
use Mode;
1819
use Compiler;
@@ -122,8 +123,13 @@ impl Step for ToolBuild {
122123
let mut duplicates = Vec::new();
123124
let is_expected = compile::stream_cargo(builder, &mut cargo, &mut |msg| {
124125
// Only care about big things like the RLS/Cargo for now
125-
if tool != "rls" && tool != "cargo" && tool != "clippy-driver" {
126-
return
126+
match tool {
127+
| "rls"
128+
| "cargo"
129+
| "clippy-driver"
130+
=> {}
131+
132+
_ => return,
127133
}
128134
let (id, features, filenames) = match msg {
129135
compile::CargoMessage::CompilerArtifact {
@@ -182,12 +188,22 @@ impl Step for ToolBuild {
182188
typically means that something was recompiled because \
183189
a transitive dependency has different features activated \
184190
than in a previous build:\n");
191+
println!("the following dependencies are duplicated although they \
192+
have the same features enabled:");
193+
for (id, cur, prev) in duplicates.drain_filter(|(_, cur, prev)| cur.2 == prev.2) {
194+
println!(" {}", id);
195+
// same features
196+
println!(" `{}` ({:?})\n `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
197+
}
198+
println!("the following dependencies have different features:");
185199
for (id, cur, prev) in duplicates {
186200
println!(" {}", id);
187-
println!(" `{}` enabled features {:?} at {:?}",
188-
cur.0, cur.2, cur.1);
189-
println!(" `{}` enabled features {:?} at {:?}",
190-
prev.0, prev.2, prev.1);
201+
let cur_features: HashSet<_> = cur.2.into_iter().collect();
202+
let prev_features: HashSet<_> = prev.2.into_iter().collect();
203+
println!(" `{}` additionally enabled features {:?} at {:?}",
204+
cur.0, &cur_features - &prev_features, cur.1);
205+
println!(" `{}` additionally enabled features {:?} at {:?}",
206+
prev.0, &prev_features - &cur_features, prev.1);
191207
}
192208
println!("");
193209
panic!("tools should not compile multiple copies of the same crate");

src/liballoc/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ mod boxed {
162162
#[cfg(test)]
163163
mod boxed_test;
164164
pub mod collections;
165-
#[cfg(target_has_atomic = "ptr")]
165+
#[cfg(any(
166+
all(stage0, target_has_atomic = "ptr"),
167+
all(not(stage0), target_has_atomic = "ptr", target_has_atomic = "cas")
168+
))]
166169
pub mod sync;
167170
pub mod rc;
168171
pub mod raw_vec;

src/liballoc/sync.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -886,13 +886,14 @@ impl<T: ?Sized> Arc<T> {
886886
// holder.
887887
//
888888
// The acquire label here ensures a happens-before relationship with any
889-
// writes to `strong` prior to decrements of the `weak` count (via drop,
890-
// which uses Release).
889+
// writes to `strong` (in particular in `Weak::upgrade`) prior to decrements
890+
// of the `weak` count (via `Weak::drop`, which uses release). If the upgraded
891+
// weak ref was never dropped, the CAS here will fail so we do not care to synchronize.
891892
if self.inner().weak.compare_exchange(1, usize::MAX, Acquire, Relaxed).is_ok() {
892-
// Due to the previous acquire read, this will observe any writes to
893-
// `strong` that were due to upgrading weak pointers; only strong
894-
// clones remain, which require that the strong count is > 1 anyway.
895-
let unique = self.inner().strong.load(Relaxed) == 1;
893+
// This needs to be an `Acquire` to synchronize with the decrement of the `strong`
894+
// counter in `drop` -- the only access that happens when any but the last reference
895+
// is being dropped.
896+
let unique = self.inner().strong.load(Acquire) == 1;
896897

897898
// The release write here synchronizes with a read in `downgrade`,
898899
// effectively preventing the above read of `strong` from happening

src/liballoc/task.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@
1212
1313
pub use core::task::*;
1414

15-
#[cfg(target_has_atomic = "ptr")]
15+
#[cfg(any(
16+
all(stage0, target_has_atomic = "ptr"),
17+
all(not(stage0), target_has_atomic = "ptr", target_has_atomic = "cas")
18+
))]
1619
pub use self::if_arc::*;
1720

18-
#[cfg(target_has_atomic = "ptr")]
21+
#[cfg(any(
22+
all(stage0, target_has_atomic = "ptr"),
23+
all(not(stage0), target_has_atomic = "ptr", target_has_atomic = "cas")
24+
))]
1925
mod if_arc {
2026
use super::*;
2127
use core::marker::PhantomData;
@@ -47,7 +53,10 @@ mod if_arc {
4753
}
4854
}
4955

50-
#[cfg(target_has_atomic = "ptr")]
56+
#[cfg(any(
57+
all(stage0, target_has_atomic = "ptr"),
58+
all(not(stage0), target_has_atomic = "ptr", target_has_atomic = "cas")
59+
))]
5160
struct ArcWrapped<T>(PhantomData<T>);
5261

5362
unsafe impl<T: Wake + 'static> UnsafeWake for ArcWrapped<T> {

src/libcore/any.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ impl Any+Send+Sync {
431431
///
432432
/// While `TypeId` implements `Hash`, `PartialOrd`, and `Ord`, it is worth
433433
/// noting that the hashes and ordering will vary between Rust releases. Beware
434-
/// of relying on them outside of your code!
434+
/// of relying on them inside of your code!
435435
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
436436
#[stable(feature = "rust1", since = "1.0.0")]
437437
pub struct TypeId {

src/libcore/sync/atomic.rs

+16
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ impl AtomicBool {
371371
/// ```
372372
#[inline]
373373
#[stable(feature = "rust1", since = "1.0.0")]
374+
#[cfg(any(stage0, target_has_atomic = "cas"))]
374375
pub fn swap(&self, val: bool, order: Ordering) -> bool {
375376
unsafe { atomic_swap(self.v.get(), val as u8, order) != 0 }
376377
}
@@ -401,6 +402,7 @@ impl AtomicBool {
401402
/// ```
402403
#[inline]
403404
#[stable(feature = "rust1", since = "1.0.0")]
405+
#[cfg(any(stage0, target_has_atomic = "cas"))]
404406
pub fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> bool {
405407
match self.compare_exchange(current, new, order, strongest_failure_ordering(order)) {
406408
Ok(x) => x,
@@ -446,6 +448,7 @@ impl AtomicBool {
446448
/// ```
447449
#[inline]
448450
#[stable(feature = "extended_compare_and_swap", since = "1.10.0")]
451+
#[cfg(any(stage0, target_has_atomic = "cas"))]
449452
pub fn compare_exchange(&self,
450453
current: bool,
451454
new: bool,
@@ -537,6 +540,7 @@ impl AtomicBool {
537540
/// ```
538541
#[inline]
539542
#[stable(feature = "rust1", since = "1.0.0")]
543+
#[cfg(any(stage0, target_has_atomic = "cas"))]
540544
pub fn fetch_and(&self, val: bool, order: Ordering) -> bool {
541545
unsafe { atomic_and(self.v.get(), val as u8, order) != 0 }
542546
}
@@ -568,6 +572,7 @@ impl AtomicBool {
568572
/// ```
569573
#[inline]
570574
#[stable(feature = "rust1", since = "1.0.0")]
575+
#[cfg(any(stage0, target_has_atomic = "cas"))]
571576
pub fn fetch_nand(&self, val: bool, order: Ordering) -> bool {
572577
// We can't use atomic_nand here because it can result in a bool with
573578
// an invalid value. This happens because the atomic operation is done
@@ -610,6 +615,7 @@ impl AtomicBool {
610615
/// ```
611616
#[inline]
612617
#[stable(feature = "rust1", since = "1.0.0")]
618+
#[cfg(any(stage0, target_has_atomic = "cas"))]
613619
pub fn fetch_or(&self, val: bool, order: Ordering) -> bool {
614620
unsafe { atomic_or(self.v.get(), val as u8, order) != 0 }
615621
}
@@ -640,6 +646,7 @@ impl AtomicBool {
640646
/// ```
641647
#[inline]
642648
#[stable(feature = "rust1", since = "1.0.0")]
649+
#[cfg(any(stage0, target_has_atomic = "cas"))]
643650
pub fn fetch_xor(&self, val: bool, order: Ordering) -> bool {
644651
unsafe { atomic_xor(self.v.get(), val as u8, order) != 0 }
645652
}
@@ -786,6 +793,7 @@ impl<T> AtomicPtr<T> {
786793
/// ```
787794
#[inline]
788795
#[stable(feature = "rust1", since = "1.0.0")]
796+
#[cfg(any(stage0, target_has_atomic = "cas"))]
789797
pub fn swap(&self, ptr: *mut T, order: Ordering) -> *mut T {
790798
unsafe { atomic_swap(self.p.get() as *mut usize, ptr as usize, order) as *mut T }
791799
}
@@ -815,6 +823,7 @@ impl<T> AtomicPtr<T> {
815823
/// ```
816824
#[inline]
817825
#[stable(feature = "rust1", since = "1.0.0")]
826+
#[cfg(any(stage0, target_has_atomic = "cas"))]
818827
pub fn compare_and_swap(&self, current: *mut T, new: *mut T, order: Ordering) -> *mut T {
819828
match self.compare_exchange(current, new, order, strongest_failure_ordering(order)) {
820829
Ok(x) => x,
@@ -853,6 +862,7 @@ impl<T> AtomicPtr<T> {
853862
/// ```
854863
#[inline]
855864
#[stable(feature = "extended_compare_and_swap", since = "1.10.0")]
865+
#[cfg(any(stage0, target_has_atomic = "cas"))]
856866
pub fn compare_exchange(&self,
857867
current: *mut T,
858868
new: *mut T,
@@ -1138,6 +1148,7 @@ assert_eq!(some_var.swap(10, Ordering::Relaxed), 5);
11381148
```"),
11391149
#[inline]
11401150
#[$stable]
1151+
#[cfg(any(stage0, target_has_atomic = "cas"))]
11411152
pub fn swap(&self, val: $int_type, order: Ordering) -> $int_type {
11421153
unsafe { atomic_swap(self.v.get(), val, order) }
11431154
}
@@ -1170,6 +1181,7 @@ assert_eq!(some_var.load(Ordering::Relaxed), 10);
11701181
```"),
11711182
#[inline]
11721183
#[$stable]
1184+
#[cfg(any(stage0, target_has_atomic = "cas"))]
11731185
pub fn compare_and_swap(&self,
11741186
current: $int_type,
11751187
new: $int_type,
@@ -1223,6 +1235,7 @@ assert_eq!(some_var.load(Ordering::Relaxed), 10);
12231235
```"),
12241236
#[inline]
12251237
#[$stable_cxchg]
1238+
#[cfg(any(stage0, target_has_atomic = "cas"))]
12261239
pub fn compare_exchange(&self,
12271240
current: $int_type,
12281241
new: $int_type,
@@ -1677,6 +1690,7 @@ atomic_int!{
16771690
}
16781691

16791692
#[inline]
1693+
#[cfg(any(stage0, target_has_atomic = "cas"))]
16801694
fn strongest_failure_ordering(order: Ordering) -> Ordering {
16811695
match order {
16821696
Release => Relaxed,
@@ -1713,6 +1727,7 @@ unsafe fn atomic_load<T>(dst: *const T, order: Ordering) -> T {
17131727
}
17141728

17151729
#[inline]
1730+
#[cfg(any(stage0, target_has_atomic = "cas"))]
17161731
unsafe fn atomic_swap<T>(dst: *mut T, val: T, order: Ordering) -> T {
17171732
match order {
17181733
Acquire => intrinsics::atomic_xchg_acq(dst, val),
@@ -1751,6 +1766,7 @@ unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T {
17511766
}
17521767

17531768
#[inline]
1769+
#[cfg(any(stage0, target_has_atomic = "cas"))]
17541770
unsafe fn atomic_compare_exchange<T>(dst: *mut T,
17551771
old: T,
17561772
new: T,

src/librustc/mir/interpret/value.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use hir::def_id::DefId;
77

88
use super::{EvalResult, Pointer, PointerArithmetic, Allocation};
99

10-
/// Represents a constant value in Rust. ByVal and ScalarPair are optimizations which
10+
/// Represents a constant value in Rust. Scalar and ScalarPair are optimizations which
1111
/// matches Value's optimizations for easy conversions between these two types
1212
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)]
1313
pub enum ConstValue<'tcx> {
@@ -72,7 +72,7 @@ impl<'tcx> ConstValue<'tcx> {
7272
/// A `Value` represents a single self-contained Rust value.
7373
///
7474
/// A `Value` can either refer to a block of memory inside an allocation (`ByRef`) or to a primitve
75-
/// value held directly, outside of any allocation (`ByVal`). For `ByRef`-values, we remember
75+
/// value held directly, outside of any allocation (`Scalar`). For `ByRef`-values, we remember
7676
/// whether the pointer is supposed to be aligned or not (also see Place).
7777
///
7878
/// For optimization of a few very common cases, there is also a representation for a pair of

src/librustc/session/config.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ pub enum Lto {
9898
#[derive(Clone, PartialEq, Hash)]
9999
pub enum CrossLangLto {
100100
LinkerPlugin(PathBuf),
101+
LinkerPluginAuto,
101102
NoLink,
102103
Disabled
103104
}
@@ -106,6 +107,7 @@ impl CrossLangLto {
106107
pub fn embed_bitcode(&self) -> bool {
107108
match *self {
108109
CrossLangLto::LinkerPlugin(_) |
110+
CrossLangLto::LinkerPluginAuto |
109111
CrossLangLto::NoLink => true,
110112
CrossLangLto::Disabled => false,
111113
}
@@ -1020,7 +1022,7 @@ macro_rules! options {
10201022
let mut bool_arg = None;
10211023
if parse_opt_bool(&mut bool_arg, v) {
10221024
*slot = if bool_arg.unwrap() {
1023-
CrossLangLto::NoLink
1025+
CrossLangLto::LinkerPluginAuto
10241026
} else {
10251027
CrossLangLto::Disabled
10261028
};
@@ -1367,6 +1369,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
13671369
let vendor = &sess.target.target.target_vendor;
13681370
let min_atomic_width = sess.target.target.min_atomic_width();
13691371
let max_atomic_width = sess.target.target.max_atomic_width();
1372+
let atomic_cas = sess.target.target.options.atomic_cas;
13701373

13711374
let mut ret = HashSet::new();
13721375
// Target bindings.
@@ -1406,6 +1409,9 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
14061409
}
14071410
}
14081411
}
1412+
if atomic_cas {
1413+
ret.insert((Symbol::intern("target_has_atomic"), Some(Symbol::intern("cas"))));
1414+
}
14091415
if sess.opts.debug_assertions {
14101416
ret.insert((Symbol::intern("debug_assertions"), None));
14111417
}

src/librustc_codegen_llvm/back/link.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,8 @@ fn link_natively(sess: &Session,
816816
if sess.target.target.options.is_like_msvc && linker_not_found {
817817
sess.note_without_error("the msvc targets depend on the msvc linker \
818818
but `link.exe` was not found");
819-
sess.note_without_error("please ensure that VS 2013 or VS 2015 was installed \
820-
with the Visual C++ option");
819+
sess.note_without_error("please ensure that VS 2013, VS 2015 or VS 2017 \
820+
was installed with the Visual C++ option");
821821
}
822822
sess.abort_if_errors();
823823
}

0 commit comments

Comments
 (0)