Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #74157

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fb9fa5b
adjust ub-enum test to be endianess-independent
RalfJung Jul 3, 2020
5702e02
Only allow `repr(i128/u128)` on enum
nbdd0121 Jul 6, 2020
97867bb
Add UI test for issue 74082
nbdd0121 Jul 6, 2020
56fb717
rustdoc: Rename invalid_codeblock_attribute lint to be plural
ollie27 Jul 7, 2020
b50c13c
Update books
ehuss Jul 7, 2020
32025fd
Update rust-installer to latest version
michaelforney May 25, 2020
dd07774
Fix broken link in rustdocdoc
JohnTitor Jul 7, 2020
7bc85e2
Liballoc use vec instead of vector
pickfire Jul 8, 2020
0965443
Remove unneeded ToString import in liballoc slice
pickfire Jul 8, 2020
59f979f
Fix cross-compilation of LLVM to aarch64 Windows targets
arlosi Jul 2, 2020
1e567c1
Avoid "blacklist"
tamird Jul 8, 2020
9a5714d
Avoid "whitelist"
tamird Jul 7, 2020
b4d9932
Rollup merge of #73989 - RalfJung:ub-enum-test, r=oli-obk
Manishearth Jul 8, 2020
022259f
Rollup merge of #74109 - nbdd0121:issue-74082, r=petrochenkov
Manishearth Jul 8, 2020
5cae5be
Rollup merge of #74116 - arlosi:aarch64build, r=pietroalbini
Manishearth Jul 8, 2020
82fa906
Rollup merge of #74127 - tamird:allowlist, r=oli-obk
Manishearth Jul 8, 2020
0f7a9cd
Rollup merge of #74131 - ollie27:rustdoc_invalid_codeblock_attributes…
Manishearth Jul 8, 2020
5c49b03
Rollup merge of #74135 - ehuss:update-books, r=ehuss
Manishearth Jul 8, 2020
f4c039f
Rollup merge of #74136 - JohnTitor:index-page-link, r=GuillaumeGomez
Manishearth Jul 8, 2020
9c82bbc
Rollup merge of #74142 - pickfire:patch-1, r=dtolnay
Manishearth Jul 8, 2020
802ed51
Rollup merge of #74143 - pickfire:patch-2, r=jonas-schievink
Manishearth Jul 8, 2020
38d5d44
Rollup merge of #74145 - michaelforney:rust-installer, r=Mark-Simulacrum
Manishearth Jul 8, 2020
3ae7596
Rollup merge of #74150 - tamird:blocklist, r=nikomatsakis
Manishearth Jul 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ version = "0.1.0"

[[package]]
name = "cc"
version = "1.0.54"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
checksum = "0fde55d2a2bfaa4c9668bbc63f531fbdeee3ffe188f4662511ce2c22b3eedebe"
dependencies = [
"jobserver",
]
Expand Down Expand Up @@ -1366,8 +1366,8 @@ checksum = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d"
name = "installer"
version = "0.0.0"
dependencies = [
"anyhow",
"clap",
"failure",
"flate2",
"lazy_static",
"num_cpus",
Expand Down
6 changes: 4 additions & 2 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,6 @@ impl Step for Std {
builder.cargo(compiler, Mode::Std, SourceType::InTree, target, "rustdoc");
compile::std_cargo(builder, target, compiler.stage, &mut cargo);

// Keep a whitelist so we do not build internal stdlib crates, these will be
// build by the rustc step later if enabled.
cargo.arg("-p").arg(package);
// Create all crate output directories first to make sure rustdoc uses
// relative links.
Expand All @@ -460,6 +458,10 @@ impl Step for Std {

builder.run(&mut cargo.into());
};
// Only build the following crates. While we could just iterate over the
// folder structure, that would also build internal crates that we do
// not want to show in documentation. These crates will later be
// visited by the rustc step, so internal documentation will show them.
let krates = ["alloc", "core", "std", "proc_macro", "test"];
for krate in &krates {
run_cargo_rustdoc_for(krate);
Expand Down
31 changes: 23 additions & 8 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//! ensure that they're always in place if needed.

use std::env;
use std::env::consts::EXE_EXTENSION;
use std::ffi::OsString;
use std::fs::{self, File};
use std::io;
Expand Down Expand Up @@ -252,8 +253,14 @@ impl Step for Llvm {
// FIXME: if the llvm root for the build triple is overridden then we
// should use llvm-tblgen from there, also should verify that it
// actually exists most of the time in normal installs of LLVM.
let host = builder.llvm_out(builder.config.build).join("bin/llvm-tblgen");
cfg.define("CMAKE_CROSSCOMPILING", "True").define("LLVM_TABLEGEN", &host);
let host_bin = builder.llvm_out(builder.config.build).join("bin");
cfg.define("CMAKE_CROSSCOMPILING", "True");
cfg.define("LLVM_TABLEGEN", host_bin.join("llvm-tblgen").with_extension(EXE_EXTENSION));
cfg.define("LLVM_NM", host_bin.join("llvm-nm").with_extension(EXE_EXTENSION));
cfg.define(
"LLVM_CONFIG_PATH",
host_bin.join("llvm-config").with_extension(EXE_EXTENSION),
);

if target.contains("netbsd") {
cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
Expand All @@ -262,8 +269,6 @@ impl Step for Llvm {
} else if target.contains("windows") {
cfg.define("CMAKE_SYSTEM_NAME", "Windows");
}

cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build"));
}

if let Some(ref suffix) = builder.config.llvm_version_suffix {
Expand Down Expand Up @@ -431,6 +436,9 @@ fn configure_cmake(
cflags.push_str(" -miphoneos-version-min=10.0");
}
}
if builder.config.llvm_clang_cl.is_some() {
cflags.push_str(&format!(" --target={}", target))
}
cfg.define("CMAKE_C_FLAGS", cflags);
let mut cxxflags = builder.cflags(target, GitRepo::Llvm).join(" ");
if builder.config.llvm_static_stdcpp && !target.contains("msvc") && !target.contains("netbsd") {
Expand All @@ -439,6 +447,9 @@ fn configure_cmake(
if let Some(ref s) = builder.config.llvm_cxxflags {
cxxflags.push_str(&format!(" {}", s));
}
if builder.config.llvm_clang_cl.is_some() {
cxxflags.push_str(&format!(" --target={}", target))
}
cfg.define("CMAKE_CXX_FLAGS", cxxflags);
if let Some(ar) = builder.ar(target) {
if ar.is_absolute() {
Expand Down Expand Up @@ -484,7 +495,7 @@ impl Step for Lld {
run.builder.ensure(Lld { target: run.target });
}

/// Compile LLVM for `target`.
/// Compile LLD for `target`.
fn run(self, builder: &Builder<'_>) -> PathBuf {
if builder.config.dry_run {
return PathBuf::from("lld-out-dir-test-gen");
Expand Down Expand Up @@ -521,6 +532,7 @@ impl Step for Lld {
// can't build on a system where your paths require `\` on Windows, but
// there's probably a lot of reasons you can't do that other than this.
let llvm_config_shim = env::current_exe().unwrap().with_file_name("llvm-config-wrapper");

cfg.out_dir(&out_dir)
.profile("Release")
.env("LLVM_CONFIG_REAL", &llvm_config)
Expand All @@ -543,7 +555,10 @@ impl Step for Lld {
if target != builder.config.build {
cfg.env("LLVM_CONFIG_SHIM_REPLACE", &builder.config.build)
.env("LLVM_CONFIG_SHIM_REPLACE_WITH", &target)
.define("LLVM_TABLEGEN_EXE", llvm_config.with_file_name("llvm-tblgen"));
.define(
"LLVM_TABLEGEN_EXE",
llvm_config.with_file_name("llvm-tblgen").with_extension(EXE_EXTENSION),
);
}

// Explicitly set C++ standard, because upstream doesn't do so
Expand Down Expand Up @@ -595,8 +610,8 @@ impl Step for TestHelpers {
}

// We may have found various cross-compilers a little differently due to our
// extra configuration, so inform gcc of these compilers. Note, though, that
// on MSVC we still need gcc's detection of env vars (ugh).
// extra configuration, so inform cc of these compilers. Note, though, that
// on MSVC we still need cc's detection of env vars (ugh).
if !target.contains("msvc") {
if let Some(ar) = builder.ar(target) {
cfg.archiver(ar);
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book
2 changes: 1 addition & 1 deletion src/doc/embedded-book
2 changes: 1 addition & 1 deletion src/doc/reference
2 changes: 1 addition & 1 deletion src/doc/rust-by-example
2 changes: 1 addition & 1 deletion src/doc/rustdoc/src/unstable-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ library, as an equivalent command-line argument is provided to `rustc` when buil
### `--index-page`: provide a top-level landing page for docs

This feature allows you to generate an index-page with a given markdown file. A good example of it
is the [rust documentation index](https://doc.rust-lang.org/index.html).
is the [rust documentation index](https://doc.rust-lang.org/nightly/index.html).

With this, you'll have a page which you can custom as much as you want at the top of your crates.

Expand Down
8 changes: 3 additions & 5 deletions src/etc/test-float-parse/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ def main():
global MAILBOX
tests = [os.path.splitext(f)[0] for f in glob('*.rs')
if not f.startswith('_')]
whitelist = sys.argv[1:]
if whitelist:
tests = [test for test in tests if test in whitelist]
listed = sys.argv[1:]
if listed:
tests = [test for test in tests if test in listed]
if not tests:
print("Error: No tests to run")
sys.exit(1)
Expand All @@ -210,8 +210,6 @@ def main():
mailman.daemon = True
mailman.start()
for test in tests:
if whitelist and test not in whitelist:
continue
run(test)
MAILBOX.put(None)
mailman.join()
Expand Down
8 changes: 3 additions & 5 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ pub use hack::to_vec;
// `test_permutations` test
mod hack {
use crate::boxed::Box;
#[cfg(test)]
use crate::string::ToString;
use crate::vec::Vec;

// We shouldn't add inline attribute to this since this is used in
Expand All @@ -156,9 +154,9 @@ mod hack {
where
T: Clone,
{
let mut vector = Vec::with_capacity(s.len());
vector.extend_from_slice(s);
vector
let mut vec = Vec::with_capacity(s.len());
vec.extend_from_slice(s);
vec
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl<'a, 'f: 'a> DerefMut for VaList<'a, 'f> {
// within a private module. Once RFC 2145 has been implemented look into
// improving this.
mod sealed_trait {
/// Trait which whitelists the allowed types to be used with [VaList::arg]
/// Trait which permits the allowed types to be used with [VaList::arg].
///
/// [VaList::arg]: ../struct.VaList.html#method.arg
#[unstable(
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_codegen_llvm/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
// Windows we end up still needing the `uwtable` attribute even if the `-C
// panic=abort` flag is passed.
//
// You can also find more info on why Windows is whitelisted here in:
// You can also find more info on why Windows always requires uwtables here:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
if cx.sess().must_emit_unwind_tables() {
attributes::emit_uwtable(llfn, true);
Expand Down Expand Up @@ -343,14 +343,14 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
}

pub fn provide(providers: &mut Providers<'_>) {
providers.target_features_whitelist = |tcx, cnum| {
providers.supported_target_features = |tcx, cnum| {
assert_eq!(cnum, LOCAL_CRATE);
if tcx.sess.opts.actually_rustdoc {
// rustdoc needs to be able to document functions that use all the features, so
// whitelist them all
// provide them all.
llvm_util::all_known_features().map(|(a, b)| (a.to_string(), b)).collect()
} else {
llvm_util::target_feature_whitelist(tcx.sess)
llvm_util::supported_target_features(tcx.sess)
.iter()
.map(|&(a, b)| (a.to_string(), b))
.collect()
Expand Down
57 changes: 37 additions & 20 deletions src/librustc_codegen_llvm/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ fn prepare_lto(
}
};
let exported_symbols = cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO");
let mut symbol_white_list = {
let _timer = cgcx.prof.generic_activity("LLVM_lto_generate_symbol_white_list");
let mut symbols_below_threshold = {
let _timer = cgcx.prof.generic_activity("LLVM_lto_generate_symbols_below_threshold");
exported_symbols[&LOCAL_CRATE].iter().filter_map(symbol_filter).collect::<Vec<CString>>()
};
info!("{} symbols to preserve in this crate", symbol_white_list.len());
info!("{} symbols to preserve in this crate", symbols_below_threshold.len());

// If we're performing LTO for the entire crate graph, then for each of our
// upstream dependencies, find the corresponding rlib and load the bitcode
Expand Down Expand Up @@ -102,8 +102,10 @@ fn prepare_lto(
let exported_symbols =
cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO");
{
let _timer = cgcx.prof.generic_activity("LLVM_lto_generate_symbol_white_list");
symbol_white_list.extend(exported_symbols[&cnum].iter().filter_map(symbol_filter));
let _timer =
cgcx.prof.generic_activity("LLVM_lto_generate_symbols_below_threshold");
symbols_below_threshold
.extend(exported_symbols[&cnum].iter().filter_map(symbol_filter));
}

let archive = ArchiveRO::open(&path).expect("wanted an rlib");
Expand All @@ -124,7 +126,7 @@ fn prepare_lto(
}
}

Ok((symbol_white_list, upstream_modules))
Ok((symbols_below_threshold, upstream_modules))
}

fn get_bitcode_slice_from_object_data(obj: &[u8]) -> Result<&[u8], String> {
Expand Down Expand Up @@ -155,9 +157,17 @@ pub(crate) fn run_fat(
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
) -> Result<LtoModuleCodegen<LlvmCodegenBackend>, FatalError> {
let diag_handler = cgcx.create_diag_handler();
let (symbol_white_list, upstream_modules) = prepare_lto(cgcx, &diag_handler)?;
let symbol_white_list = symbol_white_list.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();
fat_lto(cgcx, &diag_handler, modules, cached_modules, upstream_modules, &symbol_white_list)
let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, &diag_handler)?;
let symbols_below_threshold =
symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();
fat_lto(
cgcx,
&diag_handler,
modules,
cached_modules,
upstream_modules,
&symbols_below_threshold,
)
}

/// Performs thin LTO by performing necessary global analysis and returning two
Expand All @@ -169,15 +179,23 @@ pub(crate) fn run_thin(
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
) -> Result<(Vec<LtoModuleCodegen<LlvmCodegenBackend>>, Vec<WorkProduct>), FatalError> {
let diag_handler = cgcx.create_diag_handler();
let (symbol_white_list, upstream_modules) = prepare_lto(cgcx, &diag_handler)?;
let symbol_white_list = symbol_white_list.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();
let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, &diag_handler)?;
let symbols_below_threshold =
symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();
if cgcx.opts.cg.linker_plugin_lto.enabled() {
unreachable!(
"We should never reach this case if the LTO step \
is deferred to the linker"
);
}
thin_lto(cgcx, &diag_handler, modules, upstream_modules, cached_modules, &symbol_white_list)
thin_lto(
cgcx,
&diag_handler,
modules,
upstream_modules,
cached_modules,
&symbols_below_threshold,
)
}

pub(crate) fn prepare_thin(module: ModuleCodegen<ModuleLlvm>) -> (String, ThinBuffer) {
Expand All @@ -192,7 +210,7 @@ fn fat_lto(
modules: Vec<FatLTOInput<LlvmCodegenBackend>>,
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
mut serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>,
symbol_white_list: &[*const libc::c_char],
symbols_below_threshold: &[*const libc::c_char],
) -> Result<LtoModuleCodegen<LlvmCodegenBackend>, FatalError> {
let _timer = cgcx.prof.generic_activity("LLVM_fat_lto_build_monolithic_module");
info!("going for a fat lto");
Expand Down Expand Up @@ -306,14 +324,13 @@ fn fat_lto(
drop(linker);
save_temp_bitcode(&cgcx, &module, "lto.input");

// Internalize everything that *isn't* in our whitelist to help strip out
// more modules and such
// Internalize everything below threshold to help strip out more modules and such.
unsafe {
let ptr = symbol_white_list.as_ptr();
let ptr = symbols_below_threshold.as_ptr();
llvm::LLVMRustRunRestrictionPass(
llmod,
ptr as *const *const libc::c_char,
symbol_white_list.len() as libc::size_t,
symbols_below_threshold.len() as libc::size_t,
);
save_temp_bitcode(&cgcx, &module, "lto.after-restriction");
}
Expand Down Expand Up @@ -395,7 +412,7 @@ fn thin_lto(
modules: Vec<(String, ThinBuffer)>,
serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>,
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
symbol_white_list: &[*const libc::c_char],
symbols_below_threshold: &[*const libc::c_char],
) -> Result<(Vec<LtoModuleCodegen<LlvmCodegenBackend>>, Vec<WorkProduct>), FatalError> {
let _timer = cgcx.prof.generic_activity("LLVM_thin_lto_global_analysis");
unsafe {
Expand Down Expand Up @@ -463,8 +480,8 @@ fn thin_lto(
let data = llvm::LLVMRustCreateThinLTOData(
thin_modules.as_ptr(),
thin_modules.len() as u32,
symbol_white_list.as_ptr(),
symbol_white_list.len() as u32,
symbols_below_threshold.as_ptr(),
symbols_below_threshold.len() as u32,
)
.ok_or_else(|| write::llvm_err(&diag_handler, "failed to prepare thin LTO context"))?;

Expand Down
Loading