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 13 pull requests #73498

Merged
merged 47 commits into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift click to select a range
730f736
Fix asinh of negative values
Ralith May 23, 2020
f7d745f
tag/niche terminology cleanup
RalfJung May 23, 2020
7a6d03c
miri errors: rename InvalidDiscriminant -> InvalidTag
RalfJung May 30, 2020
20abc70
Don't intern memory in const prop.
oli-obk Jun 3, 2020
1e88f13
Stop allowing `Indirect(..)` values to be propagated
wesleywiser Jun 8, 2020
9ceb9bb
Move copying of self-contained objects to new function
mati865 Jun 2, 2020
638ebbc
Move copying of MinGW CRT to the better location
mati865 Jun 2, 2020
961974f
Use enum to distinguish dependency type
mati865 Jun 2, 2020
5d29883
Move some libs to self-contained directory
mati865 Jun 11, 2020
e9ac01a
Get self-contained directory path via dedicated function
mati865 Jun 8, 2020
43905cd
Move shipped MinGW linker to self-contained dir
mati865 Jun 8, 2020
d5ea0e9
Report error when casting an C-like enum implementing Drop
oddg May 15, 2020
e32db84
Add rust features to print target features
aszenz Jun 14, 2020
a40156e
UI test for deprecation warning of casting enum implementing Drop
oddg Jun 14, 2020
0906066
Test that bounds checks are elided when slice len is checked up-front
erikdesjardins Jun 15, 2020
d3ca6fd
Enable static-pie for the x86_64-unknown-linux-musl target
haraldh Jun 15, 2020
b5809b0
Update src/librustc_typeck/check/cast.rs
nikomatsakis Jun 15, 2020
10c8d2a
add FIXME to EnumTagInfo
RalfJung Jun 15, 2020
e0975b9
elaborate, add check for exact bounds
erikdesjardins Jun 15, 2020
f3dfe80
Adjust error message
oddg Jun 16, 2020
1990f97
Disallow loading crates with non-ascii identifier name.
crlf0710 Jun 13, 2020
4506a35
add header for rust specific feature
aszenz Jun 16, 2020
9f50f84
break long line for formatting
aszenz Jun 16, 2020
457acbd
trim whitespace
aszenz Jun 16, 2020
caffb28
add blank line bw sections
aszenz Jun 17, 2020
6351850
ignore-debug: debug assertions in slice indexing prevent the optimiza…
erikdesjardins Jun 17, 2020
a7c2cf8
Reduce pointer casts in Box::into_boxed_slice
cuviper Jun 17, 2020
d134870
Document format correction
qy3u Jun 18, 2020
abb5800
Ensure std benchmarks get tested.
ehuss Jun 8, 2020
8aecafe
Fix liballoc doc spelling
pickfire Jun 18, 2020
ec8ff1c
Liballoc clean up macro_rules style
pickfire Jun 18, 2020
111c2d2
Rearrange liballoc __impl_slice_eq1
pickfire Jun 18, 2020
5a9ff05
Disable core benches on wasm (benches not supported).
ehuss Jun 18, 2020
35a2915
Remove now-redundant branch
Ralith Jun 19, 2020
27d4737
Rollup merge of #70740 - haraldh:static-pie, r=petrochenkov
RalfJung Jun 19, 2020
9c54c65
Rollup merge of #72331 - oddg:forbid-cast-of-cenum-implementing-drop,…
RalfJung Jun 19, 2020
99be102
Rollup merge of #72486 - Ralith:asinh-fix, r=dtolnay
RalfJung Jun 19, 2020
5e7eec2
Rollup merge of #72497 - RalfJung:tag-term, r=oli-obk
RalfJung Jun 19, 2020
ea3c309
Rollup merge of #72999 - mati865:separate-self-contained-dir, r=Mark-…
RalfJung Jun 19, 2020
098949b
Rollup merge of #73130 - wesleywiser:remove_const_prop_for_indirects,…
RalfJung Jun 19, 2020
78f3e9c
Rollup merge of #73142 - ehuss:std-benches, r=dtolnay
RalfJung Jun 19, 2020
3b4bec2
Rollup merge of #73305 - crlf0710:disallow_loading_monsters, r=petroc…
RalfJung Jun 19, 2020
8d79ebd
Rollup merge of #73346 - aszenz:patch-1, r=cuviper
RalfJung Jun 19, 2020
7d3238f
Rollup merge of #73362 - erikdesjardins:bounds, r=nikomatsakis
RalfJung Jun 19, 2020
fc2ce7c
Rollup merge of #73459 - cuviper:into_boxed_slice-unicast, r=dtolnay
RalfJung Jun 19, 2020
f7d833e
Rollup merge of #73464 - qy3u:fs-document-format-correction, r=jonas-…
RalfJung Jun 19, 2020
028c908
Rollup merge of #73479 - pickfire:liballoc-spell, r=dtolnay
RalfJung Jun 19, 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
Prev Previous commit
Next Next commit
Use enum to distinguish dependency type
  • Loading branch information
mati865 committed Jun 11, 2020
commit 961974fe0348f479255f9e95b5924419c2c15a77
52 changes: 32 additions & 20 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 23,7 @@ use crate::builder::Cargo;
use crate::dist;
use crate::native;
use crate::util::{exe, is_dylib, symlink_dir};
use crate::{Compiler, GitRepo, Mode};
use crate::{Compiler, DependencyType, GitRepo, Mode};

use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
use crate::cache::{Interned, INTERNER};
Expand Down Expand Up @@ -84,7 84,7 @@ impl Step for Std {
return;
}

target_deps.extend(copy_third_party_objects(builder, &compiler, target).into_iter());
target_deps.extend(copy_third_party_objects(builder, &compiler, target));
target_deps.extend(copy_self_contained_objects(builder, &compiler, target));

let mut cargo = builder.cargo(compiler, Mode::Std, target, "build");
Expand Down Expand Up @@ -116,7 116,8 @@ fn copy_and_stamp(
libdir: &Path,
sourcedir: &Path,
name: &str,
target_deps: &mut Vec<PathBuf>,
target_deps: &mut Vec<(PathBuf, DependencyType)>,
dependency_type: DependencyType,
) {
let target = libdir.join(name);
builder.copy(&sourcedir.join(name), &target);
Expand All @@ -129,7 130,7 @@ fn copy_third_party_objects(
builder: &Builder<'_>,
compiler: &Compiler,
target: Interned<String>,
) -> Vec<PathBuf> {
) -> Vec<(PathBuf, DependencyType)> {
let libdir = builder.sysroot_libdir(*compiler, target);
let mut target_deps = vec![];

Expand All @@ -148,13 149,18 @@ fn copy_third_party_objects(
Path::new(&src),
"libunwind.a",
&mut target_deps,
DependencyType::Target,
);
}

if builder.config.sanitizers && compiler.stage != 0 {
// The sanitizers are only copied in stage1 or above,
// to avoid creating dependency on LLVM.
target_deps.extend(copy_sanitizers(builder, &compiler, target));
target_deps.extend(
copy_sanitizers(builder, &compiler, target)
.into_iter()
.map(|d| (d, DependencyType::Target)),
);
}

target_deps
Expand All @@ -165,7 171,7 @@ fn copy_self_contained_objects(
builder: &Builder<'_>,
compiler: &Compiler,
target: Interned<String>,
) -> Vec<PathBuf> {
) -> Vec<(PathBuf, DependencyType)> {
let libdir = builder.sysroot_libdir(*compiler, target);
let mut target_deps = vec![];

Expand All @@ -185,6 191,7 @@ fn copy_self_contained_objects(
&srcdir,
obj,
&mut target_deps,
DependencyType::TargetSelfContained,
);
}
} else if target.ends_with("-wasi") {
Expand All @@ -195,13 202,14 @@ fn copy_self_contained_objects(
&srcdir,
"crt1.o",
&mut target_deps,
DependencyType::TargetSelfContained,
);
} else if target.contains("windows-gnu") {
for obj in ["crt2.o", "dllcrt2.o"].iter() {
let src = compiler_file(builder, builder.cc(target), target, obj);
let target = libdir.join(obj);
builder.copy(&src, &target);
target_deps.push(target);
target_deps.push((target, DependencyType::TargetSelfContained));
}
}

Expand Down Expand Up @@ -370,7 378,7 @@ pub struct StartupObjects {
}

impl Step for StartupObjects {
type Output = Vec<PathBuf>;
type Output = Vec<(PathBuf, DependencyType)>;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/rtstartup")
Expand All @@ -389,7 397,7 @@ impl Step for StartupObjects {
/// They don't require any library support as they're just plain old object
/// files, so we just use the nightly snapshot compiler to always build them (as
/// no other compilers are guaranteed to be available).
fn run(self, builder: &Builder<'_>) -> Vec<PathBuf> {
fn run(self, builder: &Builder<'_>) -> Vec<(PathBuf, DependencyType)> {
let for_compiler = self.compiler;
let target = self.target;
if !target.contains("windows-gnu") {
Expand Down Expand Up @@ -423,7 431,7 @@ impl Step for StartupObjects {

let target = sysroot_dir.join((*file).to_string() ".o");
builder.copy(dst_file, &target);
target_deps.push(target);
target_deps.push((target, DependencyType::Target));
}

target_deps
Expand Down Expand Up @@ -838,8 846,8 @@ pub fn add_to_sysroot(
) {
t!(fs::create_dir_all(&sysroot_dst));
t!(fs::create_dir_all(&sysroot_host_dst));
for (path, host) in builder.read_stamp_file(stamp) {
if host {
for (path, dependency_type) in builder.read_stamp_file(stamp) {
if dependency_type == DependencyType::Host {
builder.copy(&path, &sysroot_host_dst.join(path.file_name().unwrap()));
} else {
builder.copy(&path, &sysroot_dst.join(path.file_name().unwrap()));
Expand All @@ -852,7 860,7 @@ pub fn run_cargo(
cargo: Cargo,
tail_args: Vec<String>,
stamp: &Path,
additional_target_deps: Vec<PathBuf>,
additional_target_deps: Vec<(PathBuf, DependencyType)>,
is_check: bool,
) -> Vec<PathBuf> {
if builder.config.dry_run {
Expand Down Expand Up @@ -903,15 911,15 @@ pub fn run_cargo(
if filename.starts_with(&host_root_dir) {
// Unless it's a proc macro used in the compiler
if crate_types.iter().any(|t| t == "proc-macro") {
deps.push((filename.to_path_buf(), true));
deps.push((filename.to_path_buf(), DependencyType::Host));
}
continue;
}

// If this was output in the `deps` dir then this is a precise file
// name (hash included) so we start tracking it.
if filename.starts_with(&target_deps_dir) {
deps.push((filename.to_path_buf(), false));
deps.push((filename.to_path_buf(), DependencyType::Target));
continue;
}

Expand Down Expand Up @@ -963,17 971,21 @@ pub fn run_cargo(
let candidate = format!("{}.lib", path_to_add);
let candidate = PathBuf::from(candidate);
if candidate.exists() {
deps.push((candidate, false));
deps.push((candidate, DependencyType::Target));
}
}
deps.push((path_to_add.into(), false));
deps.push((path_to_add.into(), DependencyType::Target));
}

deps.extend(additional_target_deps.into_iter().map(|d| (d, false)));
deps.extend(additional_target_deps);
deps.sort();
let mut new_contents = Vec::new();
for (dep, proc_macro) in deps.iter() {
new_contents.extend(if *proc_macro { b"h" } else { b"t" });
for (dep, dependency_type) in deps.iter() {
new_contents.extend(match *dependency_type {
DependencyType::Host => b"h",
DependencyType::Target => b"t",
DependencyType::TargetSelfContained => b"s",
});
new_contents.extend(dep.to_str().unwrap().as_bytes());
new_contents.extend(b"\0");
}
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 22,7 @@ use crate::channel;
use crate::compile;
use crate::tool::{self, Tool};
use crate::util::{exe, is_dylib, timeit};
use crate::{Compiler, Mode, LLVM_TOOLS};
use crate::{Compiler, DependencyType, Mode, LLVM_TOOLS};
use time::{self, Timespec};

pub fn pkgname(builder: &Builder<'_>, component: &str) -> String {
Expand Down Expand Up @@ -651,8 651,8 @@ fn skip_host_target_lib(builder: &Builder<'_>, compiler: Compiler) -> bool {
fn copy_target_libs(builder: &Builder<'_>, target: &str, image: &Path, stamp: &Path) {
let dst = image.join("lib/rustlib").join(target).join("lib");
t!(fs::create_dir_all(&dst));
for (path, host) in builder.read_stamp_file(stamp) {
if !host || builder.config.build == target {
for (path, dependency_type) in builder.read_stamp_file(stamp) {
if dependency_type != DependencyType::Host || builder.config.build == target {
builder.copy(&path, &dst.join(path.file_name().unwrap()));
}
}
Expand Down
22 changes: 19 additions & 3 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 280,17 @@ impl Crate {
}
}

/// When building Rust various objects are handled differently.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum DependencyType {
/// Libraries originating from proc-macros.
Host,
/// Typical Rust libraries.
Target,
/// Non Rust libraries and objects shipped to ease usage of certain targets.
TargetSelfContained,
}

/// The various "modes" of invoking Cargo.
///
/// These entries currently correspond to the various output directories of the
Expand Down Expand Up @@ -1097,7 1108,7 @@ impl Build {
ret
}

fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, bool)> {
fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, DependencyType)> {
if self.config.dry_run {
return Vec::new();
}
Expand All @@ -1110,9 1121,14 @@ impl Build {
if part.is_empty() {
continue;
}
let host = part[0] as char == 'h';
let dependency_type = match part[0] as char {
'h' => DependencyType::Host,
's' => DependencyType::TargetSelfContained,
't' => DependencyType::Target,
_ => unreachable!(),
};
let path = PathBuf::from(t!(str::from_utf8(&part[1..])));
paths.push((path, host));
paths.push((path, dependency_type));
}
paths
}
Expand Down