Skip to content

Commit 20ccc80

Browse files
authored
Unrolled build for rust-lang#127652
Rollup merge of rust-lang#127652 - GuillaumeGomez:cg-gcc-fmt, r=Urgau Unignore cg_gcc fmt `rustc_codegen_gcc` uses `rustfmt` now so it can be unignored. r? ``@Urgau``
2 parents e35364a + 213782d commit 20ccc80

File tree

10 files changed

+24
-55
lines changed

10 files changed

+24
-55
lines changed
+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
version = "Two"
12
use_small_heuristics = "Max"
3+
merge_derives = false

compiler/rustc_codegen_gcc/build_system/src/clone_gcc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl Args {
3434
"--out-path" => match args.next() {
3535
Some(path) if !path.is_empty() => out_path = Some(path),
3636
_ => {
37-
return Err("Expected an argument after `--out-path`, found nothing".into())
37+
return Err("Expected an argument after `--out-path`, found nothing".into());
3838
}
3939
},
4040
"--help" => {

compiler/rustc_codegen_gcc/build_system/src/config.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl ConfigFile {
5454
config.gcc_path = Some(value.as_str().to_string())
5555
}
5656
("gcc-path", _) => {
57-
return failed_config_parsing(config_file, "Expected a string for `gcc-path`")
57+
return failed_config_parsing(config_file, "Expected a string for `gcc-path`");
5858
}
5959
("download-gccjit", TomlValue::Boolean(value)) => {
6060
config.download_gccjit = Some(*value)
@@ -63,7 +63,7 @@ impl ConfigFile {
6363
return failed_config_parsing(
6464
config_file,
6565
"Expected a boolean for `download-gccjit`",
66-
)
66+
);
6767
}
6868
_ => return failed_config_parsing(config_file, &format!("Unknown key `{}`", key)),
6969
}
@@ -73,7 +73,7 @@ impl ConfigFile {
7373
return failed_config_parsing(
7474
config_file,
7575
"At least one of `gcc-path` or `download-gccjit` value must be set",
76-
)
76+
);
7777
}
7878
(Some(_), Some(true)) => {
7979
println!(
@@ -144,7 +144,7 @@ impl ConfigInfo {
144144
_ => {
145145
return Err(
146146
"Expected a value after `--target-triple`, found nothing".to_string()
147-
)
147+
);
148148
}
149149
},
150150
"--out-dir" => match args.next() {
@@ -158,7 +158,7 @@ impl ConfigInfo {
158158
self.config_file = Some(arg.to_string());
159159
}
160160
_ => {
161-
return Err("Expected a value after `--config-file`, found nothing".to_string())
161+
return Err("Expected a value after `--config-file`, found nothing".to_string());
162162
}
163163
},
164164
"--release-sysroot" => self.sysroot_release_channel = true,
@@ -169,7 +169,7 @@ impl ConfigInfo {
169169
self.cg_gcc_path = Some(arg.into());
170170
}
171171
_ => {
172-
return Err("Expected a value after `--cg_gcc-path`, found nothing".to_string())
172+
return Err("Expected a value after `--cg_gcc-path`, found nothing".to_string());
173173
}
174174
},
175175
"--use-backend" => match args.next() {
@@ -277,7 +277,7 @@ impl ConfigInfo {
277277
self.gcc_path = match gcc_path {
278278
Some(path) => path,
279279
None => {
280-
return Err(format!("missing `gcc-path` value from `{}`", config_file.display(),))
280+
return Err(format!("missing `gcc-path` value from `{}`", config_file.display(),));
281281
}
282282
};
283283
Ok(())

compiler/rustc_codegen_gcc/build_system/src/test.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl TestArg {
109109
test_arg.flags.extend_from_slice(&["--features".into(), feature]);
110110
}
111111
_ => {
112-
return Err("Expected an argument after `--features`, found nothing".into())
112+
return Err("Expected an argument after `--features`, found nothing".into());
113113
}
114114
},
115115
"--use-system-gcc" => {
@@ -458,11 +458,7 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
458458
.map_err(|error| format!("Failed to retrieve cargo path: {:?}", error))
459459
.and_then(|cargo| {
460460
let cargo = cargo.trim().to_owned();
461-
if cargo.is_empty() {
462-
Err(format!("`cargo` path is empty"))
463-
} else {
464-
Ok(cargo)
465-
}
461+
if cargo.is_empty() { Err(format!("`cargo` path is empty")) } else { Ok(cargo) }
466462
})?;
467463
let rustc = String::from_utf8(
468464
run_command_with_env(&[&"rustup", &toolchain, &"which", &"rustc"], rust_dir, Some(env))?
@@ -471,11 +467,7 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
471467
.map_err(|error| format!("Failed to retrieve rustc path: {:?}", error))
472468
.and_then(|rustc| {
473469
let rustc = rustc.trim().to_owned();
474-
if rustc.is_empty() {
475-
Err(format!("`rustc` path is empty"))
476-
} else {
477-
Ok(rustc)
478-
}
470+
if rustc.is_empty() { Err(format!("`rustc` path is empty")) } else { Ok(rustc) }
479471
})?;
480472
let llvm_filecheck = match run_command_with_env(
481473
&[

compiler/rustc_codegen_gcc/build_system/src/utils.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,7 @@ pub fn cargo_install(to_install: &str) -> Result<(), String> {
175175
pub fn get_os_name() -> Result<String, String> {
176176
let output = run_command(&[&"uname"], None)?;
177177
let name = std::str::from_utf8(&output.stdout).unwrap_or("").trim().to_string();
178-
if !name.is_empty() {
179-
Ok(name)
180-
} else {
181-
Err("Failed to retrieve the OS name".to_string())
182-
}
178+
if !name.is_empty() { Ok(name) } else { Err("Failed to retrieve the OS name".to_string()) }
183179
}
184180

185181
#[derive(Default, PartialEq)]

compiler/rustc_codegen_gcc/src/abi.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ impl<'a, 'gcc, 'tcx> AbiBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
2626
} else {
2727
false
2828
};
29-
if on_stack {
30-
param.to_lvalue().get_address(None)
31-
} else {
32-
param.to_rvalue()
33-
}
29+
if on_stack { param.to_lvalue().get_address(None) } else { param.to_rvalue() }
3430
}
3531
}
3632

compiler/rustc_codegen_gcc/src/asm.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -858,11 +858,7 @@ fn modifier_to_gcc(
858858
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg) => modifier,
859859
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg)
860860
| InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16) => {
861-
if modifier == Some('v') {
862-
None
863-
} else {
864-
modifier
865-
}
861+
if modifier == Some('v') { None } else { modifier }
866862
}
867863
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg) => {
868864
unreachable!("clobber-only")

compiler/rustc_codegen_gcc/src/builder.rs

+3-15
Original file line numberDiff line numberDiff line change
@@ -1043,11 +1043,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
10431043
let llty = place.layout.scalar_pair_element_gcc_type(self, i);
10441044
let load = self.load(llty, llptr, align);
10451045
scalar_load_metadata(self, load, scalar);
1046-
if scalar.is_bool() {
1047-
self.trunc(load, self.type_i1())
1048-
} else {
1049-
load
1050-
}
1046+
if scalar.is_bool() { self.trunc(load, self.type_i1()) } else { load }
10511047
};
10521048

10531049
OperandValue::Pair(
@@ -1795,18 +1791,10 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
17951791
// This already happens today with u128::MAX = 2^128 - 1 > f32::MAX.
17961792
let int_max = |signed: bool, int_width: u64| -> u128 {
17971793
let shift_amount = 128 - int_width;
1798-
if signed {
1799-
i128::MAX as u128 >> shift_amount
1800-
} else {
1801-
u128::MAX >> shift_amount
1802-
}
1794+
if signed { i128::MAX as u128 >> shift_amount } else { u128::MAX >> shift_amount }
18031795
};
18041796
let int_min = |signed: bool, int_width: u64| -> i128 {
1805-
if signed {
1806-
i128::MIN >> (128 - int_width)
1807-
} else {
1808-
0
1809-
}
1797+
if signed { i128::MIN >> (128 - int_width) } else { 0 }
18101798
};
18111799

18121800
let compute_clamp_bounds_single = |signed: bool, int_width: u64| -> (u128, u128) {

compiler/rustc_codegen_gcc/src/common.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ pub fn type_is_pointer(typ: Type<'_>) -> bool {
5858

5959
impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
6060
fn const_null(&self, typ: Type<'gcc>) -> RValue<'gcc> {
61-
if type_is_pointer(typ) {
62-
self.context.new_null(typ)
63-
} else {
64-
self.const_int(typ, 0)
65-
}
61+
if type_is_pointer(typ) { self.context.new_null(typ) } else { self.const_int(typ, 0) }
6662
}
6763

6864
fn const_undef(&self, typ: Type<'gcc>) -> RValue<'gcc> {

rustfmt.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ ignore = [
3131
"library/backtrace",
3232
"library/portable-simd",
3333
"library/stdarch",
34-
"compiler/rustc_codegen_gcc",
3534
"src/doc/book",
3635
"src/doc/edition-guide",
3736
"src/doc/embedded-book",
@@ -50,4 +49,8 @@ ignore = [
5049
# These are ignored by a standard cargo fmt run.
5150
"compiler/rustc_codegen_cranelift/scripts",
5251
"compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs", # uses edition 2024
52+
"compiler/rustc_codegen_gcc/tests",
53+
# Code automatically generated and included.
54+
"compiler/rustc_codegen_gcc/src/intrinsic/archs.rs",
55+
"compiler/rustc_codegen_gcc/example",
5356
]

0 commit comments

Comments
 (0)