Skip to content

Commit

Permalink
Auto merge of #52088 - kennytm:rollup, r=kennytm
Browse files Browse the repository at this point in the history
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:
  • Loading branch information
bors committed Jul 6, 2018
2 parents a8403e1 + e6ddbab commit 4d9fa23
Show file tree
Hide file tree
Showing 23 changed files with 138 additions and 73 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,16 @@ variety of channels on Mozilla's IRC network, irc.mozilla.org. The
most popular channel is [#rust], a venue for general discussion about
Rust. And a good place to ask for help would be [#rust-beginners].

Also, the [rustc guide] might be a good place to start if you want to
find out how various parts of the compiler work.
The [rustc guide] might be a good place to start if you want to find out how
various parts of the compiler work.

Also, you may find the [rustdocs for the compiler itself][rustdocs] useful.

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

## License
[license]: #license
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
#![deny(warnings)]
#![feature(core_intrinsics)]
#![feature(drain_filter)]

#[macro_use]
extern crate build_helper;
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ impl Step for Openssl {
"powerpc-unknown-netbsd" => "BSD-generic32",
"powerpc64-unknown-linux-gnu" => "linux-ppc64",
"powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
"powerpc64le-unknown-linux-musl" => "linux-ppc64le",
"s390x-unknown-linux-gnu" => "linux64-s390x",
"sparc-unknown-linux-gnu" => "linux-sparcv9",
"sparc64-unknown-linux-gnu" => "linux64-sparcv9",
Expand Down
28 changes: 22 additions & 6 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::env;
use std::iter;
use std::path::PathBuf;
use std::process::{Command, exit};
use std::collections::HashSet;

use Mode;
use Compiler;
Expand Down Expand Up @@ -122,8 +123,13 @@ impl Step for ToolBuild {
let mut duplicates = Vec::new();
let is_expected = compile::stream_cargo(builder, &mut cargo, &mut |msg| {
// Only care about big things like the RLS/Cargo for now
if tool != "rls" && tool != "cargo" && tool != "clippy-driver" {
return
match tool {
| "rls"
| "cargo"
| "clippy-driver"
=> {}

_ => return,
}
let (id, features, filenames) = match msg {
compile::CargoMessage::CompilerArtifact {
Expand Down Expand Up @@ -182,12 +188,22 @@ impl Step for ToolBuild {
typically means that something was recompiled because \
a transitive dependency has different features activated \
than in a previous build:\n");
println!("the following dependencies are duplicated although they \
have the same features enabled:");
for (id, cur, prev) in duplicates.drain_filter(|(_, cur, prev)| cur.2 == prev.2) {
println!(" {}", id);
// same features
println!(" `{}` ({:?})\n `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
}
println!("the following dependencies have different features:");
for (id, cur, prev) in duplicates {
println!(" {}", id);
println!(" `{}` enabled features {:?} at {:?}",
cur.0, cur.2, cur.1);
println!(" `{}` enabled features {:?} at {:?}",
prev.0, prev.2, prev.1);
let cur_features: HashSet<_> = cur.2.into_iter().collect();
let prev_features: HashSet<_> = prev.2.into_iter().collect();
println!(" `{}` additionally enabled features {:?} at {:?}",
cur.0, &cur_features - &prev_features, cur.1);
println!(" `{}` additionally enabled features {:?} at {:?}",
prev.0, &prev_features - &cur_features, prev.1);
}
println!("");
panic!("tools should not compile multiple copies of the same crate");
Expand Down
13 changes: 7 additions & 6 deletions src/liballoc/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,13 +886,14 @@ impl<T: ?Sized> Arc<T> {
// holder.
//
// The acquire label here ensures a happens-before relationship with any
// writes to `strong` prior to decrements of the `weak` count (via drop,
// which uses Release).
// writes to `strong` (in particular in `Weak::upgrade`) prior to decrements
// of the `weak` count (via `Weak::drop`, which uses release). If the upgraded
// weak ref was never dropped, the CAS here will fail so we do not care to synchronize.
if self.inner().weak.compare_exchange(1, usize::MAX, Acquire, Relaxed).is_ok() {
// Due to the previous acquire read, this will observe any writes to
// `strong` that were due to upgrading weak pointers; only strong
// clones remain, which require that the strong count is > 1 anyway.
let unique = self.inner().strong.load(Relaxed) == 1;
// This needs to be an `Acquire` to synchronize with the decrement of the `strong`
// counter in `drop` -- the only access that happens when any but the last reference
// is being dropped.
let unique = self.inner().strong.load(Acquire) == 1;

// The release write here synchronizes with a read in `downgrade`,
// effectively preventing the above read of `strong` from happening
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ impl Any+Send+Sync {
///
/// While `TypeId` implements `Hash`, `PartialOrd`, and `Ord`, it is worth
/// noting that the hashes and ordering will vary between Rust releases. Beware
/// of relying on them outside of your code!
/// of relying on them inside of your code!
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct TypeId {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/mir/interpret/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use hir::def_id::DefId;

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

/// Represents a constant value in Rust. ByVal and ScalarPair are optimizations which
/// Represents a constant value in Rust. Scalar and ScalarPair are optimizations which
/// matches Value's optimizations for easy conversions between these two types
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)]
pub enum ConstValue<'tcx> {
Expand Down Expand Up @@ -72,7 +72,7 @@ impl<'tcx> ConstValue<'tcx> {
/// A `Value` represents a single self-contained Rust value.
///
/// A `Value` can either refer to a block of memory inside an allocation (`ByRef`) or to a primitve
/// value held directly, outside of any allocation (`ByVal`). For `ByRef`-values, we remember
/// value held directly, outside of any allocation (`Scalar`). For `ByRef`-values, we remember
/// whether the pointer is supposed to be aligned or not (also see Place).
///
/// For optimization of a few very common cases, there is also a representation for a pair of
Expand Down
4 changes: 3 additions & 1 deletion src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ pub enum Lto {
#[derive(Clone, PartialEq, Hash)]
pub enum CrossLangLto {
LinkerPlugin(PathBuf),
LinkerPluginAuto,
NoLink,
Disabled
}
Expand All @@ -106,6 +107,7 @@ impl CrossLangLto {
pub fn embed_bitcode(&self) -> bool {
match *self {
CrossLangLto::LinkerPlugin(_) |
CrossLangLto::LinkerPluginAuto |
CrossLangLto::NoLink => true,
CrossLangLto::Disabled => false,
}
Expand Down Expand Up @@ -1020,7 +1022,7 @@ macro_rules! options {
let mut bool_arg = None;
if parse_opt_bool(&mut bool_arg, v) {
*slot = if bool_arg.unwrap() {
CrossLangLto::NoLink
CrossLangLto::LinkerPluginAuto
} else {
CrossLangLto::Disabled
};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,8 @@ fn link_natively(sess: &Session,
if sess.target.target.options.is_like_msvc && linker_not_found {
sess.note_without_error("the msvc targets depend on the msvc linker \
but `link.exe` was not found");
sess.note_without_error("please ensure that VS 2013 or VS 2015 was installed \
with the Visual C++ option");
sess.note_without_error("please ensure that VS 2013, VS 2015 or VS 2017 \
was installed with the Visual C++ option");
}
sess.abort_if_errors();
}
Expand Down
61 changes: 36 additions & 25 deletions src/librustc_codegen_llvm/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,38 @@ impl<'a> GccLinker<'a> {
self.hinted_static = false;
}
}

fn push_cross_lang_lto_args(&mut self, plugin_path: Option<&OsStr>) {
if let Some(plugin_path) = plugin_path {
let mut arg = OsString::from("-plugin=");
arg.push(plugin_path);
self.linker_arg(&arg);
}

let opt_level = match self.sess.opts.optimize {
config::OptLevel::No => "O0",
config::OptLevel::Less => "O1",
config::OptLevel::Default => "O2",
config::OptLevel::Aggressive => "O3",
config::OptLevel::Size => "Os",
config::OptLevel::SizeMin => "Oz",
};

self.linker_arg(&format!("-plugin-opt={}", opt_level));
self.linker_arg(&format!("-plugin-opt=mcpu={}", self.sess.target_cpu()));

match self.sess.opts.cg.lto {
config::Lto::Thin |
config::Lto::ThinLocal => {
self.linker_arg(&format!("-plugin-opt=thin"));
}
config::Lto::Fat |
config::Lto::Yes |
config::Lto::No => {
// default to regular LTO
}
}
}
}

impl<'a> Linker for GccLinker<'a> {
Expand Down Expand Up @@ -443,32 +475,11 @@ impl<'a> Linker for GccLinker<'a> {
CrossLangLto::NoLink => {
// Nothing to do
}
CrossLangLto::LinkerPluginAuto => {
self.push_cross_lang_lto_args(None);
}
CrossLangLto::LinkerPlugin(ref path) => {
self.linker_arg(&format!("-plugin={}", path.display()));

let opt_level = match self.sess.opts.optimize {
config::OptLevel::No => "O0",
config::OptLevel::Less => "O1",
config::OptLevel::Default => "O2",
config::OptLevel::Aggressive => "O3",
config::OptLevel::Size => "Os",
config::OptLevel::SizeMin => "Oz",
};

self.linker_arg(&format!("-plugin-opt={}", opt_level));
self.linker_arg(&format!("-plugin-opt=mcpu={}", self.sess.target_cpu()));

match self.sess.opts.cg.lto {
config::Lto::Thin |
config::Lto::ThinLocal => {
self.linker_arg(&format!("-plugin-opt=thin"));
}
config::Lto::Fat |
config::Lto::Yes |
config::Lto::No => {
// default to regular LTO
}
}
self.push_cross_lang_lto_args(Some(path.as_os_str()));
}
}
}
Expand Down
11 changes: 2 additions & 9 deletions src/librustc_mir/monomorphize/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,8 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
};
let param_env = ty::ParamEnv::reveal_all();

match tcx.const_eval(param_env.and(cid)) {
Ok(val) => collect_const(tcx, val, instance.substs, &mut neighbors),
Err(err) => {
let span = tcx.def_span(def_id);
err.report_as_error(
tcx.at(span),
"could not evaluate static initializer",
);
}
if let Ok(val) = tcx.const_eval(param_env.and(cid)) {
collect_const(tcx, val, instance.substs, &mut neighbors);
}
}
MonoItem::Fn(instance) => {
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ supported_targets! {
("powerpc-unknown-linux-gnuspe", powerpc_unknown_linux_gnuspe),
("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu),
("powerpc64le-unknown-linux-musl", powerpc64le_unknown_linux_musl),
("s390x-unknown-linux-gnu", s390x_unknown_linux_gnu),
("sparc-unknown-linux-gnu", sparc_unknown_linux_gnu),
("sparc64-unknown-linux-gnu", sparc64_unknown_linux_gnu),
Expand Down
35 changes: 35 additions & 0 deletions src/librustc_target/spec/powerpc64le_unknown_linux_musl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use spec::{LinkerFlavor, Target, TargetResult};

pub fn target() -> TargetResult {
let mut base = super::linux_musl_base::opts();
base.cpu = "ppc64le".to_string();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
base.max_atomic_width = Some(64);

// see #36994
base.exe_allocation_crate = None;

Ok(Target {
llvm_target: "powerpc64le-unknown-linux-musl".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "64".to_string(),
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-i64:64-n32:64".to_string(),
arch: "powerpc64".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base,
})
}
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pre {

.content .highlighted {
color: #eee !important;
background-color: #333;
background-color: #616161;
}
.content .highlighted a, .content .highlighted span { color: #eee !important; }
.content .highlighted.trait { background-color: #013191; }
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ declare_features! (
(active, wasm_custom_section, "1.26.0", Some(51088), None),

// The #![wasm_import_module] attribute
(active, wasm_import_module, "1.26.0", Some(51088), None),
(active, wasm_import_module, "1.26.0", Some(52090), None),

// Allows keywords to be escaped for use as identifiers
(active, raw_identifiers, "1.26.0", Some(48589), None),
Expand Down
2 changes: 1 addition & 1 deletion src/llvm
2 changes: 0 additions & 2 deletions src/test/compile-fail/issue-14227.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ extern {
static CRASH: () = symbol;
//~^ ERROR could not evaluate static initializer
//~| tried to read from foreign (extern) static
//~^^^ ERROR could not evaluate static initializer
//~| tried to read from foreign (extern) static

fn main() {}
2 changes: 0 additions & 2 deletions src/test/compile-fail/issue-28324.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@ extern {
pub static BAZ: u32 = *&error_message_count;
//~^ ERROR could not evaluate static initializer
//~| tried to read from foreign (extern) static
//~^^^ ERROR could not evaluate static initializer
//~| tried to read from foreign (extern) static

fn main() {}
13 changes: 13 additions & 0 deletions src/test/run-pass/weird-exprs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

// compile-flags: -Z borrowck=compare

#![recursion_limit = "128"]

use std::cell::Cell;
use std::mem::swap;

Expand Down Expand Up @@ -121,6 +123,16 @@ fn special_characters() {
assert!(!val);
}

fn punch_card() -> impl std::fmt::Debug {
..=..=.. .. .. .. .. .. .. .. .. .. .. ..=.. ..
..=.. ..=.. .. .. .. .. .. .. .. .. ..=..=..=..
..=.. ..=.. ..=.. ..=.. .. ..=..=.. .. ..=.. ..
..=..=.. .. ..=.. ..=.. ..=.. .. .. .. ..=.. ..
..=.. ..=.. ..=.. ..=.. .. ..=.. .. .. ..=.. ..
..=.. ..=.. ..=.. ..=.. .. .. ..=.. .. ..=.. ..
..=.. ..=.. .. ..=..=.. ..=..=.. .. .. ..=.. ..
}

pub fn main() {
strange();
funny();
Expand All @@ -135,4 +147,5 @@ pub fn main() {
fishy();
union();
special_characters();
punch_card();
}
1 change: 0 additions & 1 deletion src/test/ui/const-eval/index_out_of_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

static FOO: i32 = [][0];
//~^ ERROR E0080
//~| ERROR E0080

fn main() {
let array = [std::env::args().len()];
Expand Down
Loading

0 comments on commit 4d9fa23

Please sign in to comment.