Skip to content

Commit a9b03ff

Browse files
committed
Auto merge of rust-lang#117564 - TaKO8Ki:rollup-lkqhpqc, r=TaKO8Ki
Rollup of 3 pull requests Successful merges: - rust-lang#117343 (Cleanup `rustc_mir_build/../check_match.rs`) - rust-lang#117550 (Use `filter_map` in `try_par_for_each_in`) - rust-lang#117554 (consts: remove dead code around `i1` constant values) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3aaa0f5 + c55bf0e commit a9b03ff

31 files changed

+756
-644
lines changed

compiler/rustc_codegen_llvm/src/consts.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -374,15 +374,7 @@ impl<'ll> StaticMethods for CodegenCx<'ll, '_> {
374374

375375
let g = self.get_static(def_id);
376376

377-
// boolean SSA values are i1, but they have to be stored in i8 slots,
378-
// otherwise some LLVM optimization passes don't work as expected
379-
let mut val_llty = self.val_ty(v);
380-
let v = if val_llty == self.type_i1() {
381-
val_llty = self.type_i8();
382-
llvm::LLVMConstZExt(v, val_llty)
383-
} else {
384-
v
385-
};
377+
let val_llty = self.val_ty(v);
386378

387379
let instance = Instance::mono(self.tcx, def_id);
388380
let ty = instance.ty(self.tcx, ty::ParamEnv::reveal_all());

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,6 @@ extern "C" {
969969
ConstantIndices: *const &'a Value,
970970
NumIndices: c_uint,
971971
) -> &'a Value;
972-
pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
973972
pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
974973
pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
975974
pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;

compiler/rustc_data_structures/src/sync/parallel.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ mod disabled {
7777
})
7878
}
7979

80-
pub fn try_par_for_each_in<T: IntoIterator, E: Copy>(
80+
pub fn try_par_for_each_in<T: IntoIterator, E>(
8181
t: T,
8282
mut for_each: impl FnMut(T::Item) -> Result<(), E>,
8383
) -> Result<(), E> {
8484
parallel_guard(|guard| {
85-
t.into_iter().fold(Ok(()), |ret, i| guard.run(|| for_each(i)).unwrap_or(ret).and(ret))
85+
t.into_iter().filter_map(|i| guard.run(|| for_each(i))).fold(Ok(()), Result::and)
8686
})
8787
}
8888

@@ -178,7 +178,7 @@ mod enabled {
178178

179179
pub fn try_par_for_each_in<
180180
T: IntoIterator + IntoParallelIterator<Item = <T as IntoIterator>::Item>,
181-
E: Copy + Send,
181+
E: Send,
182182
>(
183183
t: T,
184184
for_each: impl Fn(<T as IntoIterator>::Item) -> Result<(), E> + DynSync + DynSend,
@@ -187,11 +187,10 @@ mod enabled {
187187
if mode::is_dyn_thread_safe() {
188188
let for_each = FromDyn::from(for_each);
189189
t.into_par_iter()
190-
.fold_with(Ok(()), |ret, i| guard.run(|| for_each(i)).unwrap_or(ret).and(ret))
191-
.reduce(|| Ok(()), |a, b| a.and(b))
190+
.filter_map(|i| guard.run(|| for_each(i)))
191+
.reduce(|| Ok(()), Result::and)
192192
} else {
193-
t.into_iter()
194-
.fold(Ok(()), |ret, i| guard.run(|| for_each(i)).unwrap_or(ret).and(ret))
193+
t.into_iter().filter_map(|i| guard.run(|| for_each(i))).fold(Ok(()), Result::and)
195194
}
196195
})
197196
}

0 commit comments

Comments
 (0)