Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 18a029c

Browse files
committedApr 11, 2025·
Auto merge of #139657 - Zalathar:rollup-6oh6f9q, r=Zalathar
Rollup of 12 pull requests Successful merges: - #137447 (add `core::intrinsics::simd::{simd_extract_dyn, simd_insert_dyn}`) - #138182 (rustc_target: update x86_win64 to match the documented calling convention for f128) - #138682 (Allow drivers to supply a list of extra symbols to intern) - #138904 (Test linking and running `no_std` binaries) - #138998 (Don't suggest the use of `impl Trait` in closure parameter) - #139447 (doc changes: debug assertions -> overflow checks) - #139469 (Introduce a `//@ needs-crate-type` compiletest directive) - #139564 (Deeply normalize obligations in `BestObligation` folder) - #139574 (bootstrap: improve `channel` handling) - #139600 (Update `compiler-builtins` to 0.1.153) - #139641 (Allow parenthesis around inferred array lengths) - #139654 (Improve `AssocItem::descr`.) r? `@ghost` `@rustbot` modify labels: rollup
2 parents e62d47d + 96d282c commit 18a029c

File tree

91 files changed

+899
-313
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+899
-313
lines changed
 

‎compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2034,7 +2034,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20342034
}
20352035

20362036
fn lower_array_length_to_const_arg(&mut self, c: &AnonConst) -> &'hir hir::ConstArg<'hir> {
2037-
match c.value.kind {
2037+
// We cannot just match on `ExprKind::Underscore` as `(_)` is represented as
2038+
// `ExprKind::Paren(ExprKind::Underscore)` and should also be lowered to `GenericArg::Infer`
2039+
match c.value.peel_parens().kind {
20382040
ExprKind::Underscore => {
20392041
if !self.tcx.features().generic_arg_infer() {
20402042
feature_err(

‎compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
14211421
return Ok(bx.shuffle_vector(args[0].immediate(), args[1].immediate(), indices));
14221422
}
14231423

1424-
if name == sym::simd_insert {
1424+
if name == sym::simd_insert || name == sym::simd_insert_dyn {
14251425
require!(
14261426
in_elem == arg_tys[2],
14271427
InvalidMonomorphization::InsertedType {
@@ -1432,40 +1432,49 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
14321432
out_ty: arg_tys[2]
14331433
}
14341434
);
1435-
let idx = bx
1436-
.const_to_opt_u128(args[1].immediate(), false)
1437-
.expect("typeck should have ensure that this is a const");
1438-
if idx >= in_len.into() {
1439-
return_error!(InvalidMonomorphization::SimdIndexOutOfBounds {
1440-
span,
1441-
name,
1442-
arg_idx: 1,
1443-
total_len: in_len.into(),
1444-
});
1445-
}
1446-
return Ok(bx.insert_element(
1447-
args[0].immediate(),
1448-
args[2].immediate(),
1449-
bx.const_i32(idx as i32),
1450-
));
1435+
1436+
let index_imm = if name == sym::simd_insert {
1437+
let idx = bx
1438+
.const_to_opt_u128(args[1].immediate(), false)
1439+
.expect("typeck should have ensure that this is a const");
1440+
if idx >= in_len.into() {
1441+
return_error!(InvalidMonomorphization::SimdIndexOutOfBounds {
1442+
span,
1443+
name,
1444+
arg_idx: 1,
1445+
total_len: in_len.into(),
1446+
});
1447+
}
1448+
bx.const_i32(idx as i32)
1449+
} else {
1450+
args[1].immediate()
1451+
};
1452+
1453+
return Ok(bx.insert_element(args[0].immediate(), args[2].immediate(), index_imm));
14511454
}
1452-
if name == sym::simd_extract {
1455+
if name == sym::simd_extract || name == sym::simd_extract_dyn {
14531456
require!(
14541457
ret_ty == in_elem,
14551458
InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty }
14561459
);
1457-
let idx = bx
1458-
.const_to_opt_u128(args[1].immediate(), false)
1459-
.expect("typeck should have ensure that this is a const");
1460-
if idx >= in_len.into() {
1461-
return_error!(InvalidMonomorphization::SimdIndexOutOfBounds {
1462-
span,
1463-
name,
1464-
arg_idx: 1,
1465-
total_len: in_len.into(),
1466-
});
1467-
}
1468-
return Ok(bx.extract_element(args[0].immediate(), bx.const_i32(idx as i32)));
1460+
let index_imm = if name == sym::simd_extract {
1461+
let idx = bx
1462+
.const_to_opt_u128(args[1].immediate(), false)
1463+
.expect("typeck should have ensure that this is a const");
1464+
if idx >= in_len.into() {
1465+
return_error!(InvalidMonomorphization::SimdIndexOutOfBounds {
1466+
span,
1467+
name,
1468+
arg_idx: 1,
1469+
total_len: in_len.into(),
1470+
});
1471+
}
1472+
bx.const_i32(idx as i32)
1473+
} else {
1474+
args[1].immediate()
1475+
};
1476+
1477+
return Ok(bx.extract_element(args[0].immediate(), index_imm));
14691478
}
14701479

14711480
if name == sym::simd_select {

0 commit comments

Comments
 (0)
Please sign in to comment.