Skip to content

Commit 4d9fa23

Browse files
committed
Auto merge of rust-lang#52088 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests Successful merges: - rust-lang#51619 (rust: add initial changes to support powerpc64le musl) - rust-lang#51793 (Fix variant background color on hover in search results) - rust-lang#52005 (Update LLVM to bring in a wasm codegen fix) - rust-lang#52016 (Deduplicate error reports for statics) - rust-lang#52019 ([cross-lang-lto] Allow the linker to choose the LTO-plugin (which is useful when using LLD)) - rust-lang#52030 (Any docs preposition change) - rust-lang#52031 (Strenghten synchronization in `Arc::is_unique`) - rust-lang#52033 ([Gardening] Update outdated comments: ByVal -> Scalar) - rust-lang#52055 (Include VS 2017 in error message.) - rust-lang#52063 (Add a link to the rustc docs) - rust-lang#52073 (Add a punch card to weird expressions test) - rust-lang#52080 (Improve dependency deduplication diagnostics) - rust-lang#52093 (rustc: Update tracking issue for wasm_import_module) - rust-lang#52096 (Fix typo in cell.rs) Failed merges:
2 parents a8403e1 + e6ddbab commit 4d9fa23

File tree

23 files changed

+138
-73
lines changed

23 files changed

+138
-73
lines changed

README.md

Lines changed: 5 additions & 2 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 22 additions & 6 deletions
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/sync.rs

Lines changed: 7 additions & 6 deletions
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/libcore/any.rs

Lines changed: 1 addition & 1 deletion
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/librustc/mir/interpret/value.rs

Lines changed: 2 additions & 2 deletions
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

Lines changed: 3 additions & 1 deletion
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
};

src/librustc_codegen_llvm/back/link.rs

Lines changed: 2 additions & 2 deletions
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
}

src/librustc_codegen_llvm/back/linker.rs

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,38 @@ impl<'a> GccLinker<'a> {
182182
self.hinted_static = false;
183183
}
184184
}
185+
186+
fn push_cross_lang_lto_args(&mut self, plugin_path: Option<&OsStr>) {
187+
if let Some(plugin_path) = plugin_path {
188+
let mut arg = OsString::from("-plugin=");
189+
arg.push(plugin_path);
190+
self.linker_arg(&arg);
191+
}
192+
193+
let opt_level = match self.sess.opts.optimize {
194+
config::OptLevel::No => "O0",
195+
config::OptLevel::Less => "O1",
196+
config::OptLevel::Default => "O2",
197+
config::OptLevel::Aggressive => "O3",
198+
config::OptLevel::Size => "Os",
199+
config::OptLevel::SizeMin => "Oz",
200+
};
201+
202+
self.linker_arg(&format!("-plugin-opt={}", opt_level));
203+
self.linker_arg(&format!("-plugin-opt=mcpu={}", self.sess.target_cpu()));
204+
205+
match self.sess.opts.cg.lto {
206+
config::Lto::Thin |
207+
config::Lto::ThinLocal => {
208+
self.linker_arg(&format!("-plugin-opt=thin"));
209+
}
210+
config::Lto::Fat |
211+
config::Lto::Yes |
212+
config::Lto::No => {
213+
// default to regular LTO
214+
}
215+
}
216+
}
185217
}
186218

187219
impl<'a> Linker for GccLinker<'a> {
@@ -443,32 +475,11 @@ impl<'a> Linker for GccLinker<'a> {
443475
CrossLangLto::NoLink => {
444476
// Nothing to do
445477
}
478+
CrossLangLto::LinkerPluginAuto => {
479+
self.push_cross_lang_lto_args(None);
480+
}
446481
CrossLangLto::LinkerPlugin(ref path) => {
447-
self.linker_arg(&format!("-plugin={}", path.display()));
448-
449-
let opt_level = match self.sess.opts.optimize {
450-
config::OptLevel::No => "O0",
451-
config::OptLevel::Less => "O1",
452-
config::OptLevel::Default => "O2",
453-
config::OptLevel::Aggressive => "O3",
454-
config::OptLevel::Size => "Os",
455-
config::OptLevel::SizeMin => "Oz",
456-
};
457-
458-
self.linker_arg(&format!("-plugin-opt={}", opt_level));
459-
self.linker_arg(&format!("-plugin-opt=mcpu={}", self.sess.target_cpu()));
460-
461-
match self.sess.opts.cg.lto {
462-
config::Lto::Thin |
463-
config::Lto::ThinLocal => {
464-
self.linker_arg(&format!("-plugin-opt=thin"));
465-
}
466-
config::Lto::Fat |
467-
config::Lto::Yes |
468-
config::Lto::No => {
469-
// default to regular LTO
470-
}
471-
}
482+
self.push_cross_lang_lto_args(Some(path.as_os_str()));
472483
}
473484
}
474485
}

0 commit comments

Comments
 (0)