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 7 pull requests #65670

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a12788a
make is_power_of_two a const function
tspiteri Aug 22, 2019
0a08841
Remove uses of `allow(unions_with_drop_fields)` in the standard library
SimonSapin Jul 3, 2019
84ca0a1
Remove most uses of `allow(unions_with_drop_fields)` in tests
SimonSapin Jul 3, 2019
2f0c821
Change untagged_unions to not allow union fields with drop
bluss Dec 19, 2018
fe13bbd
Remove unions_with_drop_fields lint
SimonSapin Jul 3, 2019
e247a40
Fixes #41073, it is no longer an ICE
SimonSapin Jul 3, 2019
05a644e
Update src/librustc_typeck/check/mod.rs
SimonSapin Jul 4, 2019
8c5ae86
Update src/librustc_typeck/check/mod.rs
SimonSapin Jul 4, 2019
0301eaf
Update src/librustc_typeck/error_codes.rs
SimonSapin Jul 4, 2019
bf25a9c
Update src/test/run-pass/union/union-nodrop.rs
SimonSapin Jul 4, 2019
fc512d2
More descriptive variable name
SimonSapin Jul 4, 2019
616cf52
Extend union-nodrop.rs test
SimonSapin Jul 4, 2019
50ec10e
rpass tests are now part of `ui` tests
oli-obk Sep 20, 2019
9c1ad0f
Preserve originally intended test semantics
oli-obk Sep 20, 2019
2fc257c
Prefer `ManuallyDrop::{take,new}` over `ptr::{read,write}`
oli-obk Sep 20, 2019
fb23a5c
Clarify a vague comment
oli-obk Sep 20, 2019
7e1a65d
Ensure we do not treat all unions as not having any drop glue.
oli-obk Sep 20, 2019
f5669eb
Update ui stderr
oli-obk Sep 20, 2019
bb5a652
Rebase fallout
oli-obk Oct 17, 2019
5719f57
miri add write_bytes method to Memory doing bounds-checks and support…
RalfJung Oct 20, 2019
50ddcbb
also check the iterator is not too long
RalfJung Oct 20, 2019
77c50dc
Remove unnecessary trait bounds from `keys::Keys`.
nnethercote Oct 19, 2019
c3b3a86
Remove unnecessary `Hash` bounds from various types.
nnethercote Oct 19, 2019
0653694
Don't silently do nothing on mis_use of `check_union_fields`
oli-obk Oct 21, 2019
875bdd5
Report even duplilcate errors in case the feature gat is not active
oli-obk Oct 21, 2019
55b787e
keep the root dir clean from debugging
RalfJung Oct 21, 2019
d4b3654
points the user away from the Allocation type and towards the Memory …
RalfJung Oct 20, 2019
f6d70b4
remove write_repeat; it is subsumed by the new write_bytes
RalfJung Oct 21, 2019
ac6daed
Remove many unnecessary trait derivations.
nnethercote Oct 20, 2019
3de7698
Fix typo from #65214
Amanieu Oct 21, 2019
d689c70
improve readability of is_power_of_two
tspiteri Oct 21, 2019
c3e909f
Remove `src/llvm-emscripten` submodule
alexcrichton Oct 17, 2019
ebc9a1a
expand comment
RalfJung Oct 21, 2019
b1feb95
Rollup merge of #62330 - SimonSapin:no-drop-in-union-fields, r=RalfJung
Centril Oct 21, 2019
ece5e58
Rollup merge of #65092 - tspiteri:const-is-pow2, r=oli-obk
Centril Oct 21, 2019
1f28401
Rollup merge of #65501 - alexcrichton:remove-emscripten-backend, r=Ma…
Centril Oct 21, 2019
57205dd
Rollup merge of #65621 - RalfJung:write_bytes, r=oli-obk
Centril Oct 21, 2019
2cf747f
Rollup merge of #65647 - nnethercote:rm-unnecessary-traits, r=Centril
Centril Oct 21, 2019
811a573
Rollup merge of #65653 - RalfJung:gitignore, r=Mark-Simulacrum,Centril
Centril Oct 21, 2019
644228d
Rollup merge of #65663 - Amanieu:typo, r=varkor
Centril Oct 21, 2019
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
14 changes: 8 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# This file should only ignore things that are generated during a build,
# generated by common IDEs, and optional files controlled by the user
# that affect the build (such as config.toml).
# This file should only ignore things that are generated during a `x.py` build,
# generated by common IDEs, and optional files controlled by the user that
# affect the build (such as config.toml).
# In particular, things like `mir_dump` should not be listed here; they are only
# created during manual debugging and many people like to clean up instead of
# having git ignore such leftovers. You can use `.git/info/exclude` to
# configure your local ignore list.
# FIXME: This needs cleanup.
*~
.#*
Expand Down Expand Up @@ -52,6 +56,4 @@ config.stamp
Session.vim
.cargo
no_llvm_build
# Generated when dumping Graphviz output for debugging:
/mir_dump/
/*.dot
# Before adding new lines, see the comment at the top.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
[submodule "src/doc/rust-by-example"]
path = src/doc/rust-by-example
url = https://github.com/rust-lang/rust-by-example.git
[submodule "src/llvm-emscripten"]
path = src/llvm-emscripten
url = https://github.com/rust-lang/llvm.git
[submodule "src/stdarch"]
path = src/stdarch
url = https://github.com/rust-lang/stdarch.git
Expand Down
5 changes: 1 addition & 4 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,7 @@

# This is an array of the codegen backends that will be compiled for the rustc
# that's being compiled. The default is to only build the LLVM codegen backend,
# but you can also optionally enable the "emscripten" backend for asm.js or
# make this an empty array (but that probably won't get too far in the
# bootstrap)
# FIXME: remove the obsolete emscripten backend option.
# and currently the only standard option supported is `"llvm"`
#codegen-backends = ["llvm"]

# This is the name of the directory in which codegen backends will get installed
Expand Down
4 changes: 0 additions & 4 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,10 +734,6 @@ def update_submodules(self):
if module.endswith("llvm-project"):
if self.get_toml('llvm-config') and self.get_toml('lld') != 'true':
continue
if module.endswith("llvm-emscripten"):
backends = self.get_toml('codegen-backends')
if backends is None or not 'emscripten' in backends:
continue
check = self.check_submodule(module, slow_submodules)
filtered_submodules.append((module, check))
submodules_names.append(module)
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl Ord for Interned<String> {
}
}

struct TyIntern<T: Hash + Clone + Eq> {
struct TyIntern<T: Clone + Eq> {
items: Vec<T>,
set: HashMap<T, Interned<T>>,
}
Expand Down
27 changes: 7 additions & 20 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ pub fn std_cargo(builder: &Builder<'_>,
// config.toml equivalent) is used
let llvm_config = builder.ensure(native::Llvm {
target: builder.config.build,
emscripten: false,
});
cargo.env("LLVM_CONFIG", llvm_config);
cargo.env("RUSTC_BUILD_SANITIZERS", "1");
Expand Down Expand Up @@ -615,36 +614,27 @@ pub fn build_codegen_backend(builder: &Builder<'_>,
compiler: &Compiler,
target: Interned<String>,
backend: Interned<String>) -> String {
let mut features = String::new();

match &*backend {
"llvm" | "emscripten" => {
"llvm" => {
// Build LLVM for our target. This will implicitly build the
// host LLVM if necessary.
let llvm_config = builder.ensure(native::Llvm {
target,
emscripten: backend == "emscripten",
});

if backend == "emscripten" {
features.push_str(" emscripten");
}

builder.info(&format!("Building stage{} codegen artifacts ({} -> {}, {})",
compiler.stage, &compiler.host, target, backend));

// Pass down configuration from the LLVM build into the build of
// librustc_llvm and librustc_codegen_llvm.
if builder.is_rust_llvm(target) && backend != "emscripten" {
if builder.is_rust_llvm(target) {
cargo.env("LLVM_RUSTLLVM", "1");
}

cargo.env("LLVM_CONFIG", &llvm_config);
if backend != "emscripten" {
let target_config = builder.config.target_config.get(&target);
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
cargo.env("CFG_LLVM_ROOT", s);
}
let target_config = builder.config.target_config.get(&target);
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
cargo.env("CFG_LLVM_ROOT", s);
}
// Some LLVM linker flags (-L and -l) may be needed to link librustc_llvm.
if let Some(ref s) = builder.config.llvm_ldflags {
Expand All @@ -662,9 +652,7 @@ pub fn build_codegen_backend(builder: &Builder<'_>,
"libstdc++.a");
cargo.env("LLVM_STATIC_STDCPP", file);
}
if builder.config.llvm_link_shared ||
(builder.config.llvm_thin_lto && backend != "emscripten")
{
if builder.config.llvm_link_shared || builder.config.llvm_thin_lto {
cargo.env("LLVM_LINK_SHARED", "1");
}
if builder.config.llvm_use_libcxx {
Expand All @@ -676,8 +664,7 @@ pub fn build_codegen_backend(builder: &Builder<'_>,
}
_ => panic!("unknown backend: {}", backend),
}

features
String::new()
}

/// Creates the `codegen-backends` folder for a compiler that's about to be
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,6 @@ impl Config {

pub fn llvm_enabled(&self) -> bool {
self.rust_codegen_backends.contains(&INTERNER.intern_str("llvm"))
|| self.rust_codegen_backends.contains(&INTERNER.intern_str("emscripten"))
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def v(*args):
o("dist-src", "rust.dist-src", "when building tarballs enables building a source tarball")
o("cargo-native-static", "build.cargo-native-static", "static native libraries in cargo")
o("profiler", "build.profiler", "build the profiler runtime")
o("emscripten", None, "compile the emscripten backend as well as LLVM")
o("full-tools", None, "enable all tools")
o("lld", "rust.lld", "build lld")
o("lldb", "rust.lldb", "build lldb")
Expand Down Expand Up @@ -335,10 +334,8 @@ def set(key, value):
set('build.host', value.split(','))
elif option.name == 'target':
set('build.target', value.split(','))
elif option.name == 'emscripten':
set('rust.codegen-backends', ['llvm', 'emscripten'])
elif option.name == 'full-tools':
set('rust.codegen-backends', ['llvm', 'emscripten'])
set('rust.codegen-backends', ['llvm'])
set('rust.lld', True)
set('rust.llvm-tools', True)
set('build.extended', True)
Expand Down
4 changes: 0 additions & 4 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,17 +826,13 @@ fn copy_src_dirs(builder: &Builder<'_>, src_dirs: &[&str], exclude_dirs: &[&str]

const LLVM_TEST: &[&str] = &[
"llvm-project/llvm/test", "llvm-project\\llvm\\test",
"llvm-emscripten/test", "llvm-emscripten\\test",
];
if LLVM_TEST.iter().any(|path| spath.contains(path)) &&
(spath.ends_with(".ll") ||
spath.ends_with(".td") ||
spath.ends_with(".s")) {
return false
}
if spath.contains("test/emscripten") || spath.contains("test\\emscripten") {
return false
}

let full_path = Path::new(dir).join(path);
if exclude_dirs.iter().any(|excl| full_path == Path::new(excl)) {
Expand Down
7 changes: 0 additions & 7 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ pub struct Build {
miri_info: channel::GitInfo,
rustfmt_info: channel::GitInfo,
in_tree_llvm_info: channel::GitInfo,
emscripten_llvm_info: channel::GitInfo,
local_rebuild: bool,
fail_fast: bool,
doc_tests: DocTests,
Expand Down Expand Up @@ -351,7 +350,6 @@ impl Build {

// we always try to use git for LLVM builds
let in_tree_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-project"));
let emscripten_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-emscripten"));

let mut build = Build {
initial_rustc: config.initial_rustc.clone(),
Expand All @@ -376,7 +374,6 @@ impl Build {
miri_info,
rustfmt_info,
in_tree_llvm_info,
emscripten_llvm_info,
cc: HashMap::new(),
cxx: HashMap::new(),
ar: HashMap::new(),
Expand Down Expand Up @@ -553,10 +550,6 @@ impl Build {
self.out.join(&*target).join("llvm")
}

fn emscripten_llvm_out(&self, target: Interned<String>) -> PathBuf {
self.out.join(&*target).join("llvm-emscripten")
}

fn lld_out(&self, target: Interned<String>) -> PathBuf {
self.out.join(&*target).join("lld")
}
Expand Down
75 changes: 25 additions & 50 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use crate::GitRepo;
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Llvm {
pub target: Interned<String>,
pub emscripten: bool,
}

impl Step for Llvm {
Expand All @@ -40,46 +39,35 @@ impl Step for Llvm {
run.path("src/llvm-project")
.path("src/llvm-project/llvm")
.path("src/llvm")
.path("src/llvm-emscripten")
}

fn make_run(run: RunConfig<'_>) {
let emscripten = run.path.ends_with("llvm-emscripten");
run.builder.ensure(Llvm {
target: run.target,
emscripten,
});
}

/// Compile LLVM for `target`.
fn run(self, builder: &Builder<'_>) -> PathBuf {
let target = self.target;
let emscripten = self.emscripten;

// If we're using a custom LLVM bail out here, but we can only use a
// custom LLVM for the build triple.
if !self.emscripten {
if let Some(config) = builder.config.target_config.get(&target) {
if let Some(ref s) = config.llvm_config {
check_llvm_version(builder, s);
return s.to_path_buf()
}
if let Some(config) = builder.config.target_config.get(&target) {
if let Some(ref s) = config.llvm_config {
check_llvm_version(builder, s);
return s.to_path_buf()
}
}

let (llvm_info, root, out_dir, llvm_config_ret_dir) = if emscripten {
let info = &builder.emscripten_llvm_info;
let dir = builder.emscripten_llvm_out(target);
let config_dir = dir.join("bin");
(info, "src/llvm-emscripten", dir, config_dir)
} else {
let info = &builder.in_tree_llvm_info;
let mut dir = builder.llvm_out(builder.config.build);
if !builder.config.build.contains("msvc") || builder.config.ninja {
dir.push("build");
}
(info, "src/llvm-project/llvm", builder.llvm_out(target), dir.join("bin"))
};
let llvm_info = &builder.in_tree_llvm_info;
let root = "src/llvm-project/llvm";
let out_dir = builder.llvm_out(target);
let mut llvm_config_ret_dir = builder.llvm_out(builder.config.build);
if !builder.config.build.contains("msvc") || builder.config.ninja {
llvm_config_ret_dir.push("build");
}
llvm_config_ret_dir.push("bin");

let build_llvm_config = llvm_config_ret_dir
.join(exe("llvm-config", &*builder.config.build));
Expand Down Expand Up @@ -107,8 +95,7 @@ impl Step for Llvm {
}
}

let descriptor = if emscripten { "Emscripten " } else { "" };
builder.info(&format!("Building {}LLVM for {}", descriptor, target));
builder.info(&format!("Building LLVM for {}", target));
let _time = util::timeit(&builder);
t!(fs::create_dir_all(&out_dir));

Expand All @@ -123,23 +110,15 @@ impl Step for Llvm {

// NOTE: remember to also update `config.toml.example` when changing the
// defaults!
let llvm_targets = if self.emscripten {
"JSBackend"
} else {
match builder.config.llvm_targets {
Some(ref s) => s,
None => "AArch64;ARM;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;\
Sparc;SystemZ;WebAssembly;X86",
}
let llvm_targets = match &builder.config.llvm_targets {
Some(s) => s,
None => "AArch64;ARM;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;\
Sparc;SystemZ;WebAssembly;X86",
};

let llvm_exp_targets = if self.emscripten {
""
} else {
match builder.config.llvm_experimental_targets {
Some(ref s) => s,
None => "",
}
let llvm_exp_targets = match builder.config.llvm_experimental_targets {
Some(ref s) => s,
None => "",
};

let assertions = if builder.config.llvm_assertions {"ON"} else {"OFF"};
Expand All @@ -163,25 +142,23 @@ impl Step for Llvm {
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);

if builder.config.llvm_thin_lto && !emscripten {
if builder.config.llvm_thin_lto {
cfg.define("LLVM_ENABLE_LTO", "Thin");
if !target.contains("apple") {
cfg.define("LLVM_ENABLE_LLD", "ON");
}
}

let want_lldb = builder.config.lldb_enabled && !self.emscripten;

// This setting makes the LLVM tools link to the dynamic LLVM library,
// which saves both memory during parallel links and overall disk space
// for the tools. We don't do this on every platform as it doesn't work
// equally well everywhere.
if builder.llvm_link_tools_dynamically(target) && !emscripten {
if builder.llvm_link_tools_dynamically(target) {
cfg.define("LLVM_LINK_LLVM_DYLIB", "ON");
}

// For distribution we want the LLVM tools to be *statically* linked to libstdc++
if builder.config.llvm_tools_enabled || want_lldb {
if builder.config.llvm_tools_enabled || builder.config.lldb_enabled {
if !target.contains("windows") {
if target.contains("apple") {
cfg.define("CMAKE_EXE_LINKER_FLAGS", "-static-libstdc++");
Expand Down Expand Up @@ -209,7 +186,7 @@ impl Step for Llvm {
enabled_llvm_projects.push("compiler-rt");
}

if want_lldb {
if builder.config.lldb_enabled {
enabled_llvm_projects.push("clang");
enabled_llvm_projects.push("lldb");
// For the time being, disable code signing.
Expand All @@ -234,10 +211,9 @@ impl Step for Llvm {
}

// http://llvm.org/docs/HowToCrossCompileLLVM.html
if target != builder.config.build && !emscripten {
if target != builder.config.build {
builder.ensure(Llvm {
target: builder.config.build,
emscripten: false,
});
// FIXME: if the llvm root for the build triple is overridden then we
// should use llvm-tblgen from there, also should verify that it
Expand Down Expand Up @@ -481,7 +457,6 @@ impl Step for Lld {

let llvm_config = builder.ensure(Llvm {
target: self.target,
emscripten: false,
});

let out_dir = builder.lld_out(target);
Expand Down
3 changes: 1 addition & 2 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ impl Step for Compiletest {
}).to_string()
})
};
let lldb_exe = if builder.config.lldb_enabled && !target.contains("emscripten") {
let lldb_exe = if builder.config.lldb_enabled {
// Test against the lldb that was just built.
builder.llvm_out(target).join("bin").join("lldb")
} else {
Expand Down Expand Up @@ -1232,7 +1232,6 @@ impl Step for Compiletest {
if builder.config.llvm_enabled() {
let llvm_config = builder.ensure(native::Llvm {
target: builder.config.build,
emscripten: false,
});
if !builder.config.dry_run {
let llvm_version = output(Command::new(&llvm_config).arg("--version"));
Expand Down
Loading