mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-16 22:16:53 +00:00
Auto merge of #135040 - matthiaskrgr:rollup-34vsa8n, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #135016 (Ping me for rustc-dev-guide subtree changes on this repo) - #135027 (Remove range-metadata amdgpu workaround) - #135029 (Update mailmap) - #135033 (try to dedup me in the mailmap) - #135035 (Fix formatting command) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
4363f9b6f6
5
.mailmap
5
.mailmap
@ -189,6 +189,9 @@ Eduardo Broto <ebroto@tutanota.com>
|
||||
Edward Shen <code@eddie.sh> <xes@meta.com>
|
||||
Jacob Finkelman <eh2406@wayne.edu>
|
||||
Jacob Finkelman <eh2406@wayne.edu> <YeomanYaacov@gmail.com>
|
||||
Jacob Finkelman <eh2406@wayne.edu> <jfinkelm@amazon.com>
|
||||
Jacob Finkelman <eh2406@wayne.edu> <finkelman@semcog.org>
|
||||
Jacob Finkelman <eh2406@wayne.edu> <Eh2406@users.noreply.github.com>
|
||||
Elliott Slaughter <elliottslaughter@gmail.com> <eslaughter@mozilla.com>
|
||||
Elly Fong-Jones <elly@leptoquark.net>
|
||||
Eric Holk <eric.holk@gmail.com> <eholk@cs.indiana.edu>
|
||||
@ -654,6 +657,8 @@ Vitali Haravy <HumaneProgrammer@gmail.com> Vitali Haravy <humaneprogrammer@gmail
|
||||
Vitaly Shukela <vi0oss@gmail.com>
|
||||
Waffle Lapkin <waffle.lapkin@gmail.com>
|
||||
Waffle Lapkin <waffle.lapkin@gmail.com> <waffle.lapkin@tasking.com>
|
||||
Weihang Lo <me@weihanglo.tw>
|
||||
Weihang Lo <me@weihanglo.tw> <weihanglo@users.noreply.github.com>
|
||||
Wesley Wiser <wwiser@gmail.com> <wesleywiser@microsoft.com>
|
||||
whitequark <whitequark@whitequark.org>
|
||||
William Ting <io@williamting.com> <william.h.ting@gmail.com>
|
||||
|
@ -610,14 +610,6 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
}
|
||||
|
||||
fn range_metadata(&mut self, load: &'ll Value, range: WrappingRange) {
|
||||
if self.sess().target.arch == "amdgpu" {
|
||||
// amdgpu/LLVM does something weird and thinks an i64 value is
|
||||
// split into a v2i32, halving the bitwidth LLVM expects,
|
||||
// tripping an assertion. So, for now, just disable this
|
||||
// optimization.
|
||||
return;
|
||||
}
|
||||
|
||||
if self.cx.sess().opts.optimize == OptLevel::No {
|
||||
// Don't emit metadata we're not going to use
|
||||
return;
|
||||
|
@ -14,7 +14,19 @@ use crate::core::builder::Builder;
|
||||
use crate::utils::exec::command;
|
||||
use crate::utils::helpers::{self, program_out_of_date, t};
|
||||
|
||||
fn rustfmt(src: &Path, rustfmt: &Path, paths: &[PathBuf], check: bool) -> impl FnMut(bool) -> bool {
|
||||
#[must_use]
|
||||
enum RustfmtStatus {
|
||||
InProgress,
|
||||
Ok,
|
||||
Failed,
|
||||
}
|
||||
|
||||
fn rustfmt(
|
||||
src: &Path,
|
||||
rustfmt: &Path,
|
||||
paths: &[PathBuf],
|
||||
check: bool,
|
||||
) -> impl FnMut(bool) -> RustfmtStatus {
|
||||
let mut cmd = Command::new(rustfmt);
|
||||
// Avoid the submodule config paths from coming into play. We only allow a single global config
|
||||
// for the workspace for now.
|
||||
@ -26,30 +38,20 @@ fn rustfmt(src: &Path, rustfmt: &Path, paths: &[PathBuf], check: bool) -> impl F
|
||||
cmd.arg("--check");
|
||||
}
|
||||
cmd.args(paths);
|
||||
let cmd_debug = format!("{cmd:?}");
|
||||
let mut cmd = cmd.spawn().expect("running rustfmt");
|
||||
// Poor man's async: return a closure that might wait for rustfmt's completion (depending on
|
||||
// the value of the `block` argument).
|
||||
move |block: bool| -> bool {
|
||||
move |block: bool| -> RustfmtStatus {
|
||||
let status = if !block {
|
||||
match cmd.try_wait() {
|
||||
Ok(Some(status)) => Ok(status),
|
||||
Ok(None) => return false,
|
||||
Ok(None) => return RustfmtStatus::InProgress,
|
||||
Err(err) => Err(err),
|
||||
}
|
||||
} else {
|
||||
cmd.wait()
|
||||
};
|
||||
if !status.unwrap().success() {
|
||||
eprintln!(
|
||||
"fmt error: Running `{}` failed.\nIf you're running `tidy`, \
|
||||
try again with `--bless`. Or, if you just want to format \
|
||||
code, run `./x.py fmt` instead.",
|
||||
cmd_debug,
|
||||
);
|
||||
crate::exit!(1);
|
||||
}
|
||||
true
|
||||
if status.unwrap().success() { RustfmtStatus::Ok } else { RustfmtStatus::Failed }
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,6 +242,8 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
|
||||
// Spawn child processes on a separate thread so we can batch entries we have received from
|
||||
// ignore.
|
||||
let thread = std::thread::spawn(move || {
|
||||
let mut result = Ok(());
|
||||
|
||||
let mut children = VecDeque::new();
|
||||
while let Ok(path) = rx.recv() {
|
||||
// Try getting more paths from the channel to amortize the overhead of spawning
|
||||
@ -251,22 +255,38 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
|
||||
|
||||
// Poll completion before waiting.
|
||||
for i in (0..children.len()).rev() {
|
||||
if children[i](false) {
|
||||
children.swap_remove_back(i);
|
||||
break;
|
||||
match children[i](false) {
|
||||
RustfmtStatus::InProgress => {}
|
||||
RustfmtStatus::Failed => {
|
||||
result = Err(());
|
||||
children.swap_remove_back(i);
|
||||
break;
|
||||
}
|
||||
RustfmtStatus::Ok => {
|
||||
children.swap_remove_back(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if children.len() >= max_processes {
|
||||
// Await oldest child.
|
||||
children.pop_front().unwrap()(true);
|
||||
match children.pop_front().unwrap()(true) {
|
||||
RustfmtStatus::InProgress | RustfmtStatus::Ok => {}
|
||||
RustfmtStatus::Failed => result = Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Await remaining children.
|
||||
for mut child in children {
|
||||
child(true);
|
||||
match child(true) {
|
||||
RustfmtStatus::InProgress | RustfmtStatus::Ok => {}
|
||||
RustfmtStatus::Failed => result = Err(()),
|
||||
}
|
||||
}
|
||||
|
||||
result
|
||||
});
|
||||
|
||||
let formatted_paths = Mutex::new(Vec::new());
|
||||
@ -299,7 +319,12 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
|
||||
|
||||
drop(tx);
|
||||
|
||||
thread.join().unwrap();
|
||||
let result = thread.join().unwrap();
|
||||
|
||||
if result.is_err() {
|
||||
crate::exit!(1);
|
||||
}
|
||||
|
||||
if !check {
|
||||
update_rustfmt_version(build);
|
||||
}
|
||||
|
@ -1208,7 +1208,7 @@ project-exploit-mitigations = [
|
||||
"/src/doc/nomicon" = ["@ehuss"]
|
||||
"/src/doc/reference" = ["@ehuss"]
|
||||
"/src/doc/rust-by-example" = ["@ehuss"]
|
||||
"/src/doc/rustc-dev-guide" = ["@kobzol"]
|
||||
"/src/doc/rustc-dev-guide" = ["@kobzol", "@jieyouxu"]
|
||||
"/src/doc/rustdoc" = ["rustdoc"]
|
||||
"/src/doc/style-guide" = ["style-team"]
|
||||
"/src/etc" = ["@Mark-Simulacrum"]
|
||||
|
Loading…
Reference in New Issue
Block a user