Skip to content

Commit 6d3d61f

Browse files
committed
Evaluate constants in SIMD vec lengths before rejecting them
1 parent c04b52a commit 6d3d61f

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

compiler/rustc_hir_analysis/src/check/intrinsicck.rs

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
8383

8484
let (size, ty) = match elem_ty.kind() {
8585
ty::Array(ty, len) => {
86+
let len = self.tcx.normalize_erasing_regions(self.typing_env, *len);
8687
if let Some(len) = len.try_to_target_usize(self.tcx) {
8788
(len, *ty)
8889
} else {

tests/ui/asm/named_const_simd_vec_len.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! SIMD vector length constants instead of assuming they are literals.
33
44
//@ only-x86_64
5+
//@ check-pass
56

67
#![feature(repr_simd)]
78

@@ -15,7 +16,6 @@ pub unsafe fn foo(a: Foo) {
1516
std::arch::asm!(
1617
"movaps {src}, {src}",
1718
src = in(xmm_reg) a,
18-
//~^ ERROR: cannot use value of type `Foo` for inline assembly
1919
);
2020
}
2121

tests/ui/asm/named_const_simd_vec_len.stderr

-10
This file was deleted.

0 commit comments

Comments
 (0)