Skip to content

Commit 4d9fa23

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) - #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) - #52093 (rustc: Update tracking issue for wasm_import_module) - #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

+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/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/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/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

+3-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
};

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
}

src/librustc_codegen_llvm/back/linker.rs

+36-25
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
}

src/librustc_mir/monomorphize/collector.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -395,15 +395,8 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
395395
};
396396
let param_env = ty::ParamEnv::reveal_all();
397397

398-
match tcx.const_eval(param_env.and(cid)) {
399-
Ok(val) => collect_const(tcx, val, instance.substs, &mut neighbors),
400-
Err(err) => {
401-
let span = tcx.def_span(def_id);
402-
err.report_as_error(
403-
tcx.at(span),
404-
"could not evaluate static initializer",
405-
);
406-
}
398+
if let Ok(val) = tcx.const_eval(param_env.and(cid)) {
399+
collect_const(tcx, val, instance.substs, &mut neighbors);
407400
}
408401
}
409402
MonoItem::Fn(instance) => {

src/librustc_target/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ supported_targets! {
274274
("powerpc-unknown-linux-gnuspe", powerpc_unknown_linux_gnuspe),
275275
("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
276276
("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu),
277+
("powerpc64le-unknown-linux-musl", powerpc64le_unknown_linux_musl),
277278
("s390x-unknown-linux-gnu", s390x_unknown_linux_gnu),
278279
("sparc-unknown-linux-gnu", sparc_unknown_linux_gnu),
279280
("sparc64-unknown-linux-gnu", sparc64_unknown_linux_gnu),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use spec::{LinkerFlavor, Target, TargetResult};
12+
13+
pub fn target() -> TargetResult {
14+
let mut base = super::linux_musl_base::opts();
15+
base.cpu = "ppc64le".to_string();
16+
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
17+
base.max_atomic_width = Some(64);
18+
19+
// see #36994
20+
base.exe_allocation_crate = None;
21+
22+
Ok(Target {
23+
llvm_target: "powerpc64le-unknown-linux-musl".to_string(),
24+
target_endian: "little".to_string(),
25+
target_pointer_width: "64".to_string(),
26+
target_c_int_width: "32".to_string(),
27+
data_layout: "e-m:e-i64:64-n32:64".to_string(),
28+
arch: "powerpc64".to_string(),
29+
target_os: "linux".to_string(),
30+
target_env: "musl".to_string(),
31+
target_vendor: "unknown".to_string(),
32+
linker_flavor: LinkerFlavor::Gcc,
33+
options: base,
34+
})
35+
}

src/librustdoc/html/static/themes/dark.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pre {
108108

109109
.content .highlighted {
110110
color: #eee !important;
111-
background-color: #333;
111+
background-color: #616161;
112112
}
113113
.content .highlighted a, .content .highlighted span { color: #eee !important; }
114114
.content .highlighted.trait { background-color: #013191; }

src/libsyntax/feature_gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ declare_features! (
421421
(active, wasm_custom_section, "1.26.0", Some(51088), None),
422422

423423
// The #![wasm_import_module] attribute
424-
(active, wasm_import_module, "1.26.0", Some(51088), None),
424+
(active, wasm_import_module, "1.26.0", Some(52090), None),
425425

426426
// Allows keywords to be escaped for use as identifiers
427427
(active, raw_identifiers, "1.26.0", Some(48589), None),

src/test/compile-fail/issue-14227.rs

-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,5 @@ extern {
1616
static CRASH: () = symbol;
1717
//~^ ERROR could not evaluate static initializer
1818
//~| tried to read from foreign (extern) static
19-
//~^^^ ERROR could not evaluate static initializer
20-
//~| tried to read from foreign (extern) static
2119

2220
fn main() {}

src/test/compile-fail/issue-28324.rs

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@ extern {
1717
pub static BAZ: u32 = *&error_message_count;
1818
//~^ ERROR could not evaluate static initializer
1919
//~| tried to read from foreign (extern) static
20-
//~^^^ ERROR could not evaluate static initializer
21-
//~| tried to read from foreign (extern) static
2220

2321
fn main() {}

src/test/run-pass/weird-exprs.rs

+13
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// compile-flags: -Z borrowck=compare
1212

13+
#![recursion_limit = "128"]
14+
1315
use std::cell::Cell;
1416
use std::mem::swap;
1517

@@ -121,6 +123,16 @@ fn special_characters() {
121123
assert!(!val);
122124
}
123125

126+
fn punch_card() -> impl std::fmt::Debug {
127+
..=..=.. .. .. .. .. .. .. .. .. .. .. ..=.. ..
128+
..=.. ..=.. .. .. .. .. .. .. .. .. ..=..=..=..
129+
..=.. ..=.. ..=.. ..=.. .. ..=..=.. .. ..=.. ..
130+
..=..=.. .. ..=.. ..=.. ..=.. .. .. .. ..=.. ..
131+
..=.. ..=.. ..=.. ..=.. .. ..=.. .. .. ..=.. ..
132+
..=.. ..=.. ..=.. ..=.. .. .. ..=.. .. ..=.. ..
133+
..=.. ..=.. .. ..=..=.. ..=..=.. .. .. ..=.. ..
134+
}
135+
124136
pub fn main() {
125137
strange();
126138
funny();
@@ -135,4 +147,5 @@ pub fn main() {
135147
fishy();
136148
union();
137149
special_characters();
150+
punch_card();
138151
}

src/test/ui/const-eval/index_out_of_bounds.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
static FOO: i32 = [][0];
1212
//~^ ERROR E0080
13-
//~| ERROR E0080
1413

1514
fn main() {
1615
let array = [std::env::args().len()];

0 commit comments

Comments
 (0)