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 12 pull requests #85711

Merged
merged 31 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c150772
rustdoc: avoid legacy Korean fonts in Windows
May 15, 2021
7e2e331
rustdoc: add the license of Noto Sans KR
May 15, 2021
b5e09dc
rustdoc: update static files
May 15, 2021
fe44fde
chore: format code
May 15, 2021
6b601d4
chore: update comment in rustdoc.css
May 15, 2021
8412d30
test: update unversioned-files.txt
May 18, 2021
8a2d663
test: fix the order in unversioned-files.txt
May 19, 2021
e587366
doc: clarify Mutex::try_lock, etc. errors
tlyu May 20, 2021
903e369
Fix boostrap using host exe suffix for cargo
jam1garner May 22, 2021
d7341f3
Don't reborrow self when computing the dest pointer in <[T]>::copy_wi…
SkiFire13 May 23, 2021
db8c6e0
Remove stray .stderr files
LeSeulArtichaut May 24, 2021
0e4f8cb
minor rewording after review
tlyu May 24, 2021
b63f7f9
Demote ControlFlow::{from|into}_try to pub(crate)
scottmcm May 24, 2021
ad30826
Revert "Move llvm submodule updates to rustbuild"
Mark-Simulacrum May 24, 2021
37588e9
Document shared_from_cow functions
fee1-dead May 25, 2021
79a5b12
Fix tasklist example in rustdoc book.
ehuss May 25, 2021
87cf2d4
Move stability attribute for methods under the `ip` feature from the …
CDirkx May 25, 2021
072b85c
Update books
ehuss May 25, 2021
8a7dc0d
Update cargo
ehuss May 25, 2021
0264f4f
Rollup merge of #84048 - konan8205:master, r=jsha
JohnTitor May 26, 2021
ae6a1a7
Rollup merge of #85529 - tlyu:trylock-errors, r=JohnTitor
JohnTitor May 26, 2021
d75521a
Rollup merge of #85590 - jam1garner:tool-bootstrap-su-fix, r=Mark-Sim…
JohnTitor May 26, 2021
b7b9ce3
Rollup merge of #85610 - SkiFire13:fix-copy-within-provenance, r=oli-obk
JohnTitor May 26, 2021
0bc3066
Rollup merge of #85623 - LeSeulArtichaut:stray-stderr, r=Mark-Simulacrum
JohnTitor May 26, 2021
587de8e
Rollup merge of #85645 - scottmcm:demote-from-into-try, r=yaahc
JohnTitor May 26, 2021
7508203
Rollup merge of #85647 - rust-lang:revert-81601-llvm-on-demand, r=jyn514
JohnTitor May 26, 2021
e87bc66
Rollup merge of #85666 - fee1-dead:document-shared-from-cow, r=dtolnay
JohnTitor May 26, 2021
1e51afa
Rollup merge of #85668 - ehuss:fix-rustdoc-tasklist, r=Mark-Simulacrum
JohnTitor May 26, 2021
7caf93f
Rollup merge of #85672 - CDirkx:ip, r=Mark-Simulacrum
JohnTitor May 26, 2021
bce257c
Rollup merge of #85699 - ehuss:update-books, r=ehuss
JohnTitor May 26, 2021
7c0677a
Rollup merge of #85701 - ehuss:update-cargo, r=ehuss
JohnTitor May 26, 2021
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
16 changes: 12 additions & 4 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,20 +991,28 @@ def update_submodules(self):
).decode(default_encoding).splitlines()]
filtered_submodules = []
submodules_names = []
llvm_checked_out = os.path.exists(os.path.join(self.rust_root, "src/llvm-project/.git"))
external_llvm_provided = self.get_toml('llvm-config') or self.downloading_llvm()
llvm_needed = not self.get_toml('codegen-backends', 'rust') \
or "llvm" in self.get_toml('codegen-backends', 'rust')
for module in submodules:
# This is handled by native::Llvm in rustbuild, not here
if module.endswith("llvm-project"):
continue
# Don't sync the llvm-project submodule if an external LLVM was
# provided, if we are downloading LLVM or if the LLVM backend is
# not being built. Also, if the submodule has been initialized
# already, sync it anyways so that it doesn't mess up contributor
# pull requests.
if external_llvm_provided or not llvm_needed:
if self.get_toml('lld') != 'true' and not llvm_checked_out:
continue
check = self.check_submodule(module, slow_submodules)
filtered_submodules.append((module, check))
submodules_names.append(module)
recorded = subprocess.Popen(["git", "ls-tree", "HEAD"] + submodules_names,
cwd=self.rust_root, stdout=subprocess.PIPE)
recorded = recorded.communicate()[0].decode(default_encoding).strip().splitlines()
# { filename: hash }
recorded_submodules = {}
for data in recorded:
# [mode, kind, hash, filename]
data = data.split()
recorded_submodules[data[3]] = data[2]
for module in filtered_submodules:
Expand Down
10 changes: 0 additions & 10 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,22 +472,12 @@ impl Build {
slice::from_ref(&self.build.triple)
}

/// If the LLVM submodule has been initialized already, sync it unconditionally. This avoids
/// contributors checking in a submodule change by accident.
pub fn maybe_update_llvm_submodule(&self) {
if self.in_tree_llvm_info.is_git() {
native::update_llvm_submodule(self);
}
}

/// Executes the entire build, as configured by the flags and configuration.
pub fn build(&mut self) {
unsafe {
job::setup(self);
}

self.maybe_update_llvm_submodule();

if let Subcommand::Format { check, paths } = &self.config.cmd {
return format::format(self, *check, &paths);
}
Expand Down
84 changes: 1 addition & 83 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use build_helper::{output, t};
use crate::builder::{Builder, RunConfig, ShouldRun, Step};
use crate::config::TargetSelection;
use crate::util::{self, exe};
use crate::{Build, GitRepo};
use crate::GitRepo;
use build_helper::up_to_date;

pub struct Meta {
Expand Down Expand Up @@ -91,85 +91,6 @@ pub fn prebuilt_llvm_config(
Err(Meta { stamp, build_llvm_config, out_dir, root: root.into() })
}

// modified from `check_submodule` and `update_submodule` in bootstrap.py
pub(crate) fn update_llvm_submodule(build: &Build) {
let llvm_project = &Path::new("src").join("llvm-project");

fn dir_is_empty(dir: &Path) -> bool {
t!(std::fs::read_dir(dir)).next().is_none()
}

// NOTE: The check for the empty directory is here because when running x.py
// the first time, the llvm submodule won't be checked out. Check it out
// now so we can build it.
if !build.in_tree_llvm_info.is_git() && !dir_is_empty(&build.config.src.join(llvm_project)) {
return;
}

// check_submodule
let checked_out = if build.config.fast_submodules {
Some(output(
Command::new("git")
.args(&["rev-parse", "HEAD"])
.current_dir(build.config.src.join(llvm_project)),
))
} else {
None
};

// update_submodules
let recorded = output(
Command::new("git")
.args(&["ls-tree", "HEAD"])
.arg(llvm_project)
.current_dir(&build.config.src),
);
let hash =
recorded.split(' ').nth(2).unwrap_or_else(|| panic!("unexpected output `{}`", recorded));

// update_submodule
if let Some(llvm_hash) = checked_out {
if hash == llvm_hash {
// already checked out
return;
}
}

println!("Updating submodule {}", llvm_project.display());
build.run(
Command::new("git")
.args(&["submodule", "-q", "sync"])
.arg(llvm_project)
.current_dir(&build.config.src),
);

// Try passing `--progress` to start, then run git again without if that fails.
let update = |progress: bool| {
let mut git = Command::new("git");
git.args(&["submodule", "update", "--init", "--recursive"]);
if progress {
git.arg("--progress");
}
git.arg(llvm_project).current_dir(&build.config.src);
git
};
// NOTE: doesn't use `try_run` because this shouldn't print an error if it fails.
if !update(true).status().map_or(false, |status| status.success()) {
build.run(&mut update(false));
}

build.run(
Command::new("git")
.args(&["reset", "-q", "--hard"])
.current_dir(build.config.src.join(llvm_project)),
);
build.run(
Command::new("git")
.args(&["clean", "-qdfx"])
.current_dir(build.config.src.join(llvm_project)),
);
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Llvm {
pub target: TargetSelection,
Expand Down Expand Up @@ -207,9 +128,6 @@ impl Step for Llvm {
Err(m) => m,
};

if !builder.config.dry_run {
update_llvm_submodule(builder);
}
if builder.config.llvm_link_shared
&& (target.contains("windows") || target.contains("apple-darwin"))
{
Expand Down
1 change: 0 additions & 1 deletion src/build_helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ pub fn make(host: &str) -> PathBuf {
}
}

#[track_caller]
pub fn output(cmd: &mut Command) -> String {
let output = match cmd.stderr(Stdio::inherit()).output() {
Ok(status) => status,
Expand Down