diff options
Diffstat (limited to 'tests')
32 files changed, 299 insertions, 391 deletions
diff --git a/tests/assembly/small_data_threshold.rs b/tests/assembly/small_data_threshold.rs index b0c0a63ca49..d3ba144600e 100644 --- a/tests/assembly/small_data_threshold.rs +++ b/tests/assembly/small_data_threshold.rs @@ -58,7 +58,7 @@ static mut Z: u64 = 0; // Currently, only MIPS and RISCV successfully put any objects in the small data // sections so the U/V/W/X tests are skipped on Hexagon and M68K -//@ RISCV: .section .sdata, +//@ RISCV: .section .sdata //@ RISCV-NOT: .section //@ RISCV: U: //@ RISCV: .section .sbss @@ -71,7 +71,7 @@ static mut Z: u64 = 0; //@ RISCV-NOT: .section //@ RISCV: X: -//@ MIPS: .section .sdata, +//@ MIPS: .section .sdata //@ MIPS-NOT: .section //@ MIPS: U: //@ MIPS: .section .sbss diff --git a/tests/coverage/async.cov-map b/tests/coverage/async.cov-map index 1ba165f1e49..43b497a1d3f 100644 --- a/tests/coverage/async.cov-map +++ b/tests/coverage/async.cov-map @@ -1,103 +1,103 @@ Function name: async::c -Raw bytes (9): 0x[01, 01, 00, 01, 01, 09, 01, 00, 19] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 01, 00, 19] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 9, 1) to (start + 0, 25) +- Code(Counter(0)) at (prev + 12, 1) to (start + 0, 25) Function name: async::c::{closure#0} -Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 09, 19, 01, 0e, 05, 02, 09, 00, 0a, 02, 02, 09, 00, 0a, 01, 02, 01, 00, 02] +Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 0c, 19, 01, 0e, 05, 02, 09, 00, 0a, 02, 02, 09, 00, 0a, 01, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 1 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 9, 25) to (start + 1, 14) +- Code(Counter(0)) at (prev + 12, 25) to (start + 1, 14) - Code(Counter(1)) at (prev + 2, 9) to (start + 0, 10) - Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 10) = (c0 - c1) - Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2) Function name: async::d -Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 00, 14] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 14, 01, 00, 14] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 17, 1) to (start + 0, 20) +- Code(Counter(0)) at (prev + 20, 1) to (start + 0, 20) Function name: async::d::{closure#0} -Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 14, 00, 19] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 14, 14, 00, 19] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 17, 20) to (start + 0, 25) +- Code(Counter(0)) at (prev + 20, 20) to (start + 0, 25) Function name: async::e (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 13, 01, 00, 14] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 16, 01, 00, 14] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 19, 1) to (start + 0, 20) +- Code(Zero) at (prev + 22, 1) to (start + 0, 20) Function name: async::e::{closure#0} (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 13, 14, 00, 19] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 16, 14, 00, 19] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 19, 20) to (start + 0, 25) +- Code(Zero) at (prev + 22, 20) to (start + 0, 25) Function name: async::f -Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 01, 00, 14] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 18, 01, 00, 14] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 21, 1) to (start + 0, 20) +- Code(Counter(0)) at (prev + 24, 1) to (start + 0, 20) Function name: async::f::{closure#0} -Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 14, 00, 19] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 18, 14, 00, 19] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 21, 20) to (start + 0, 25) +- Code(Counter(0)) at (prev + 24, 20) to (start + 0, 25) Function name: async::foo (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 17, 01, 00, 1e] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 1a, 01, 00, 1e] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 23, 1) to (start + 0, 30) +- Code(Zero) at (prev + 26, 1) to (start + 0, 30) Function name: async::foo::{closure#0} (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 17, 1e, 00, 2d] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 1a, 1e, 00, 2d] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 23, 30) to (start + 0, 45) +- Code(Zero) at (prev + 26, 30) to (start + 0, 45) Function name: async::g -Raw bytes (9): 0x[01, 01, 00, 01, 01, 19, 01, 00, 17] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 1c, 01, 00, 17] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 25, 1) to (start + 0, 23) +- Code(Counter(0)) at (prev + 28, 1) to (start + 0, 23) Function name: async::g::{closure#0} (unused) -Raw bytes (59): 0x[01, 01, 00, 0b, 00, 19, 17, 01, 0c, 00, 02, 09, 00, 0a, 00, 00, 0e, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 09, 00, 0a, 00, 00, 0e, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02] +Raw bytes (59): 0x[01, 01, 00, 0b, 00, 1c, 17, 01, 0c, 00, 02, 09, 00, 0a, 00, 00, 0e, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 09, 00, 0a, 00, 00, 0e, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 11 -- Code(Zero) at (prev + 25, 23) to (start + 1, 12) +- Code(Zero) at (prev + 28, 23) to (start + 1, 12) - Code(Zero) at (prev + 2, 9) to (start + 0, 10) - Code(Zero) at (prev + 0, 14) to (start + 0, 23) - Code(Zero) at (prev + 0, 27) to (start + 0, 28) @@ -110,20 +110,20 @@ Number of file 0 mappings: 11 - Code(Zero) at (prev + 2, 1) to (start + 0, 2) Function name: async::h -Raw bytes (9): 0x[01, 01, 00, 01, 01, 21, 01, 00, 16] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 24, 01, 00, 16] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 33, 1) to (start + 0, 22) +- Code(Counter(0)) at (prev + 36, 1) to (start + 0, 22) Function name: async::h::{closure#0} (unused) -Raw bytes (39): 0x[01, 01, 00, 07, 00, 21, 16, 03, 0c, 00, 04, 09, 00, 0a, 00, 00, 0e, 00, 19, 00, 00, 1a, 00, 1b, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02] +Raw bytes (39): 0x[01, 01, 00, 07, 00, 24, 16, 03, 0c, 00, 04, 09, 00, 0a, 00, 00, 0e, 00, 19, 00, 00, 1a, 00, 1b, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 7 -- Code(Zero) at (prev + 33, 22) to (start + 3, 12) +- Code(Zero) at (prev + 36, 22) to (start + 3, 12) - Code(Zero) at (prev + 4, 9) to (start + 0, 10) - Code(Zero) at (prev + 0, 14) to (start + 0, 25) - Code(Zero) at (prev + 0, 26) to (start + 0, 27) @@ -132,22 +132,22 @@ Number of file 0 mappings: 7 - Code(Zero) at (prev + 2, 1) to (start + 0, 2) Function name: async::i -Raw bytes (9): 0x[01, 01, 00, 01, 01, 2a, 01, 00, 13] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 2d, 01, 00, 13] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 42, 1) to (start + 0, 19) +- Code(Counter(0)) at (prev + 45, 1) to (start + 0, 19) Function name: async::i::{closure#0} -Raw bytes (63): 0x[01, 01, 02, 07, 19, 11, 15, 0b, 01, 2a, 13, 04, 0c, 09, 05, 09, 00, 0a, 01, 00, 0e, 00, 18, 05, 00, 1c, 00, 21, 09, 00, 27, 00, 30, 15, 01, 09, 00, 0a, 0d, 00, 0e, 00, 17, 1d, 00, 1b, 00, 20, 15, 00, 24, 00, 26, 19, 01, 0e, 00, 10, 03, 02, 01, 00, 02] +Raw bytes (63): 0x[01, 01, 02, 07, 19, 11, 15, 0b, 01, 2d, 13, 04, 0c, 09, 05, 09, 00, 0a, 01, 00, 0e, 00, 18, 05, 00, 1c, 00, 21, 09, 00, 27, 00, 30, 15, 01, 09, 00, 0a, 0d, 00, 0e, 00, 17, 1d, 00, 1b, 00, 20, 15, 00, 24, 00, 26, 19, 01, 0e, 00, 10, 03, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 2 - expression 0 operands: lhs = Expression(1, Add), rhs = Counter(6) - expression 1 operands: lhs = Counter(4), rhs = Counter(5) Number of file 0 mappings: 11 -- Code(Counter(0)) at (prev + 42, 19) to (start + 4, 12) +- Code(Counter(0)) at (prev + 45, 19) to (start + 4, 12) - Code(Counter(2)) at (prev + 5, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 14) to (start + 0, 24) - Code(Counter(1)) at (prev + 0, 28) to (start + 0, 33) @@ -161,14 +161,14 @@ Number of file 0 mappings: 11 = ((c4 + c5) + c6) Function name: async::j -Raw bytes (58): 0x[01, 01, 02, 07, 0d, 05, 09, 0a, 01, 35, 01, 00, 0d, 01, 0b, 0b, 00, 0c, 05, 01, 09, 00, 0a, 01, 00, 0e, 00, 1b, 05, 00, 1f, 00, 27, 09, 01, 09, 00, 0a, 11, 00, 0e, 00, 1a, 09, 00, 1e, 00, 20, 0d, 01, 0e, 00, 10, 03, 02, 01, 00, 02] +Raw bytes (58): 0x[01, 01, 02, 07, 0d, 05, 09, 0a, 01, 38, 01, 00, 0d, 01, 0b, 0b, 00, 0c, 05, 01, 09, 00, 0a, 01, 00, 0e, 00, 1b, 05, 00, 1f, 00, 27, 09, 01, 09, 00, 0a, 11, 00, 0e, 00, 1a, 09, 00, 1e, 00, 20, 0d, 01, 0e, 00, 10, 03, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 2 - expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3) - expression 1 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 10 -- Code(Counter(0)) at (prev + 53, 1) to (start + 0, 13) +- Code(Counter(0)) at (prev + 56, 1) to (start + 0, 13) - Code(Counter(0)) at (prev + 11, 11) to (start + 0, 12) - Code(Counter(1)) at (prev + 1, 9) to (start + 0, 10) - Code(Counter(0)) at (prev + 0, 14) to (start + 0, 27) @@ -181,48 +181,48 @@ Number of file 0 mappings: 10 = ((c1 + c2) + c3) Function name: async::j::c -Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 37, 05, 01, 12, 05, 02, 0d, 00, 0e, 02, 02, 0d, 00, 0e, 01, 02, 05, 00, 06] +Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 3a, 05, 01, 12, 05, 02, 0d, 00, 0e, 02, 02, 0d, 00, 0e, 01, 02, 05, 00, 06] Number of files: 1 - file 0 => global file 1 Number of expressions: 1 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 55, 5) to (start + 1, 18) +- Code(Counter(0)) at (prev + 58, 5) to (start + 1, 18) - Code(Counter(1)) at (prev + 2, 13) to (start + 0, 14) - Code(Expression(0, Sub)) at (prev + 2, 13) to (start + 0, 14) = (c0 - c1) - Code(Counter(0)) at (prev + 2, 5) to (start + 0, 6) Function name: async::j::d -Raw bytes (9): 0x[01, 01, 00, 01, 01, 3e, 05, 00, 17] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 41, 05, 00, 17] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 62, 5) to (start + 0, 23) +- Code(Counter(0)) at (prev + 65, 5) to (start + 0, 23) Function name: async::j::f -Raw bytes (9): 0x[01, 01, 00, 01, 01, 3f, 05, 00, 17] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 42, 05, 00, 17] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 63, 5) to (start + 0, 23) +- Code(Counter(0)) at (prev + 66, 5) to (start + 0, 23) Function name: async::k (unused) -Raw bytes (29): 0x[01, 01, 00, 05, 00, 47, 01, 01, 0c, 00, 02, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02] +Raw bytes (29): 0x[01, 01, 00, 05, 00, 4a, 01, 01, 0c, 00, 02, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 5 -- Code(Zero) at (prev + 71, 1) to (start + 1, 12) +- Code(Zero) at (prev + 74, 1) to (start + 1, 12) - Code(Zero) at (prev + 2, 14) to (start + 0, 16) - Code(Zero) at (prev + 1, 14) to (start + 0, 16) - Code(Zero) at (prev + 1, 14) to (start + 0, 16) - Code(Zero) at (prev + 2, 1) to (start + 0, 2) Function name: async::l -Raw bytes (37): 0x[01, 01, 04, 01, 07, 05, 09, 0f, 02, 09, 05, 05, 01, 4f, 01, 01, 0c, 02, 02, 0e, 00, 10, 05, 01, 0e, 00, 10, 09, 01, 0e, 00, 10, 0b, 02, 01, 00, 02] +Raw bytes (37): 0x[01, 01, 04, 01, 07, 05, 09, 0f, 02, 09, 05, 05, 01, 52, 01, 01, 0c, 02, 02, 0e, 00, 10, 05, 01, 0e, 00, 10, 09, 01, 0e, 00, 10, 0b, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 4 @@ -231,7 +231,7 @@ Number of expressions: 4 - expression 2 operands: lhs = Expression(3, Add), rhs = Expression(0, Sub) - expression 3 operands: lhs = Counter(2), rhs = Counter(1) Number of file 0 mappings: 5 -- Code(Counter(0)) at (prev + 79, 1) to (start + 1, 12) +- Code(Counter(0)) at (prev + 82, 1) to (start + 1, 12) - Code(Expression(0, Sub)) at (prev + 2, 14) to (start + 0, 16) = (c0 - (c1 + c2)) - Code(Counter(1)) at (prev + 1, 14) to (start + 0, 16) @@ -240,26 +240,26 @@ Number of file 0 mappings: 5 = ((c2 + c1) + (c0 - (c1 + c2))) Function name: async::m -Raw bytes (9): 0x[01, 01, 00, 01, 01, 57, 01, 00, 19] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 5a, 01, 00, 19] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 87, 1) to (start + 0, 25) +- Code(Counter(0)) at (prev + 90, 1) to (start + 0, 25) Function name: async::m::{closure#0} (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 57, 19, 00, 22] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 5a, 19, 00, 22] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 87, 25) to (start + 0, 34) +- Code(Zero) at (prev + 90, 25) to (start + 0, 34) Function name: async::main -Raw bytes (9): 0x[01, 01, 00, 01, 01, 59, 01, 08, 02] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 5c, 01, 08, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 89, 1) to (start + 8, 2) +- Code(Counter(0)) at (prev + 92, 1) to (start + 8, 2) diff --git a/tests/coverage/async.coverage b/tests/coverage/async.coverage index 995674257c4..429fb112f33 100644 --- a/tests/coverage/async.coverage +++ b/tests/coverage/async.coverage @@ -6,6 +6,9 @@ LL| |//@ edition: 2018 LL| |//@ compile-flags: -Copt-level=1 LL| | + LL| |//@ aux-build: executor.rs + LL| |extern crate executor; + LL| | LL| 1|async fn c(x: u8) -> u8 { LL| 1| if x == 8 { LL| 1| 1 @@ -100,22 +103,4 @@ LL| 1| let _ = m(5); LL| 1| executor::block_on(future.as_mut()); LL| 1|} - LL| | - LL| |mod executor { - LL| | use core::future::Future; - LL| | use core::pin::pin; - LL| | use core::task::{Context, Poll, Waker}; - LL| | - LL| | #[coverage(off)] - LL| | pub fn block_on<F: Future>(mut future: F) -> F::Output { - LL| | let mut future = pin!(future); - LL| | let mut context = Context::from_waker(Waker::noop()); - LL| | - LL| | loop { - LL| | if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - LL| | break val; - LL| | } - LL| | } - LL| | } - LL| |} diff --git a/tests/coverage/async.rs b/tests/coverage/async.rs index 7e6ad761ecd..a7f3c7cec41 100644 --- a/tests/coverage/async.rs +++ b/tests/coverage/async.rs @@ -6,6 +6,9 @@ //@ edition: 2018 //@ compile-flags: -Copt-level=1 +//@ aux-build: executor.rs +extern crate executor; + async fn c(x: u8) -> u8 { if x == 8 { 1 @@ -95,21 +98,3 @@ fn main() { let _ = m(5); executor::block_on(future.as_mut()); } - -mod executor { - use core::future::Future; - use core::pin::pin; - use core::task::{Context, Poll, Waker}; - - #[coverage(off)] - pub fn block_on<F: Future>(mut future: F) -> F::Output { - let mut future = pin!(future); - let mut context = Context::from_waker(Waker::noop()); - - loop { - if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - break val; - } - } - } -} diff --git a/tests/coverage/async2.cov-map b/tests/coverage/async2.cov-map index e39a1d7dd2f..3816401ac63 100644 --- a/tests/coverage/async2.cov-map +++ b/tests/coverage/async2.cov-map @@ -1,53 +1,53 @@ Function name: async2::async_func -Raw bytes (9): 0x[01, 01, 00, 01, 01, 0d, 01, 00, 17] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 10, 01, 00, 17] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 13, 1) to (start + 0, 23) +- Code(Counter(0)) at (prev + 16, 1) to (start + 0, 23) Function name: async2::async_func::{closure#0} -Raw bytes (24): 0x[01, 01, 00, 04, 01, 0d, 17, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 06, 00, 07, 01, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 10, 17, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 06, 00, 07, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 13, 23) to (start + 3, 9) +- Code(Counter(0)) at (prev + 16, 23) to (start + 3, 9) - Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6) - Code(Zero) at (prev + 2, 6) to (start + 0, 7) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) Function name: async2::async_func_just_println -Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 01, 00, 24] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 18, 01, 00, 24] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 21, 1) to (start + 0, 36) +- Code(Counter(0)) at (prev + 24, 1) to (start + 0, 36) Function name: async2::async_func_just_println::{closure#0} -Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 24, 02, 02] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 18, 24, 02, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 21, 36) to (start + 2, 2) +- Code(Counter(0)) at (prev + 24, 36) to (start + 2, 2) Function name: async2::main -Raw bytes (9): 0x[01, 01, 00, 01, 01, 19, 01, 07, 02] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 1c, 01, 07, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 25, 1) to (start + 7, 2) +- Code(Counter(0)) at (prev + 28, 1) to (start + 7, 2) Function name: async2::non_async_func -Raw bytes (24): 0x[01, 01, 00, 04, 01, 05, 01, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 06, 00, 07, 01, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 08, 01, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 06, 00, 07, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 5, 1) to (start + 3, 9) +- Code(Counter(0)) at (prev + 8, 1) to (start + 3, 9) - Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6) - Code(Zero) at (prev + 2, 6) to (start + 0, 7) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) diff --git a/tests/coverage/async2.coverage b/tests/coverage/async2.coverage index bd5b701491b..ed9bc4c239d 100644 --- a/tests/coverage/async2.coverage +++ b/tests/coverage/async2.coverage @@ -2,6 +2,9 @@ LL| |#![feature(noop_waker)] LL| |//@ edition: 2018 LL| | + LL| |//@ aux-build: executor.rs + LL| |extern crate executor; + LL| | LL| 1|fn non_async_func() { LL| 1| println!("non_async_func was covered"); LL| 1| let b = true; @@ -32,22 +35,4 @@ LL| 1| executor::block_on(async_func()); LL| 1| executor::block_on(async_func_just_println()); LL| 1|} - LL| | - LL| |mod executor { - LL| | use core::future::Future; - LL| | use core::pin::pin; - LL| | use core::task::{Context, Poll, Waker}; - LL| | - LL| | #[coverage(off)] - LL| | pub fn block_on<F: Future>(mut future: F) -> F::Output { - LL| | let mut future = pin!(future); - LL| | let mut context = Context::from_waker(Waker::noop()); - LL| | - LL| | loop { - LL| | if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - LL| | break val; - LL| | } - LL| | } - LL| | } - LL| |} diff --git a/tests/coverage/async2.rs b/tests/coverage/async2.rs index 713c70d277a..f52c848f6f2 100644 --- a/tests/coverage/async2.rs +++ b/tests/coverage/async2.rs @@ -2,6 +2,9 @@ #![feature(noop_waker)] //@ edition: 2018 +//@ aux-build: executor.rs +extern crate executor; + fn non_async_func() { println!("non_async_func was covered"); let b = true; @@ -30,21 +33,3 @@ fn main() { executor::block_on(async_func()); executor::block_on(async_func_just_println()); } - -mod executor { - use core::future::Future; - use core::pin::pin; - use core::task::{Context, Poll, Waker}; - - #[coverage(off)] - pub fn block_on<F: Future>(mut future: F) -> F::Output { - let mut future = pin!(future); - let mut context = Context::from_waker(Waker::noop()); - - loop { - if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - break val; - } - } - } -} diff --git a/tests/coverage/async_block.cov-map b/tests/coverage/async_block.cov-map index e54c15c0436..65f3d821f6e 100644 --- a/tests/coverage/async_block.cov-map +++ b/tests/coverage/async_block.cov-map @@ -1,11 +1,11 @@ Function name: async_block::main -Raw bytes (36): 0x[01, 01, 01, 01, 05, 06, 01, 05, 01, 00, 0b, 05, 01, 09, 00, 0a, 03, 00, 0e, 00, 13, 05, 00, 14, 01, 16, 05, 07, 0a, 02, 06, 01, 03, 01, 00, 02] +Raw bytes (36): 0x[01, 01, 01, 01, 05, 06, 01, 08, 01, 00, 0b, 05, 01, 09, 00, 0a, 03, 00, 0e, 00, 13, 05, 00, 14, 01, 16, 05, 07, 0a, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 1 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) Number of file 0 mappings: 6 -- Code(Counter(0)) at (prev + 5, 1) to (start + 0, 11) +- Code(Counter(0)) at (prev + 8, 1) to (start + 0, 11) - Code(Counter(1)) at (prev + 1, 9) to (start + 0, 10) - Code(Expression(0, Add)) at (prev + 0, 14) to (start + 0, 19) = (c0 + c1) @@ -14,13 +14,13 @@ Number of file 0 mappings: 6 - Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) Function name: async_block::main::{closure#0} -Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 07, 1c, 01, 17, 05, 01, 18, 02, 0e, 02, 02, 14, 02, 0e, 01, 03, 09, 00, 0a] +Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 0a, 1c, 01, 17, 05, 01, 18, 02, 0e, 02, 02, 14, 02, 0e, 01, 03, 09, 00, 0a] Number of files: 1 - file 0 => global file 1 Number of expressions: 1 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 7, 28) to (start + 1, 23) +- Code(Counter(0)) at (prev + 10, 28) to (start + 1, 23) - Code(Counter(1)) at (prev + 1, 24) to (start + 2, 14) - Code(Expression(0, Sub)) at (prev + 2, 20) to (start + 2, 14) = (c0 - c1) diff --git a/tests/coverage/async_block.coverage b/tests/coverage/async_block.coverage index 7fd17bc51c3..d9be8480d80 100644 --- a/tests/coverage/async_block.coverage +++ b/tests/coverage/async_block.coverage @@ -2,6 +2,9 @@ LL| |#![feature(noop_waker)] LL| |//@ edition: 2021 LL| | + LL| |//@ aux-build: executor.rs + LL| |extern crate executor; + LL| | LL| 1|fn main() { LL| 17| for i in 0..16 { ^16 @@ -15,22 +18,4 @@ LL| 16| executor::block_on(future); LL| 16| } LL| 1|} - LL| | - LL| |mod executor { - LL| | use core::future::Future; - LL| | use core::pin::pin; - LL| | use core::task::{Context, Poll, Waker}; - LL| | - LL| | #[coverage(off)] - LL| | pub fn block_on<F: Future>(mut future: F) -> F::Output { - LL| | let mut future = pin!(future); - LL| | let mut context = Context::from_waker(Waker::noop()); - LL| | - LL| | loop { - LL| | if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - LL| | break val; - LL| | } - LL| | } - LL| | } - LL| |} diff --git a/tests/coverage/async_block.rs b/tests/coverage/async_block.rs index a70dd747032..7ae8241aa77 100644 --- a/tests/coverage/async_block.rs +++ b/tests/coverage/async_block.rs @@ -2,6 +2,9 @@ #![feature(noop_waker)] //@ edition: 2021 +//@ aux-build: executor.rs +extern crate executor; + fn main() { for i in 0..16 { let future = async { @@ -14,21 +17,3 @@ fn main() { executor::block_on(future); } } - -mod executor { - use core::future::Future; - use core::pin::pin; - use core::task::{Context, Poll, Waker}; - - #[coverage(off)] - pub fn block_on<F: Future>(mut future: F) -> F::Output { - let mut future = pin!(future); - let mut context = Context::from_waker(Waker::noop()); - - loop { - if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - break val; - } - } - } -} diff --git a/tests/coverage/auxiliary/executor.rs b/tests/coverage/auxiliary/executor.rs new file mode 100644 index 00000000000..fb07c8ce304 --- /dev/null +++ b/tests/coverage/auxiliary/executor.rs @@ -0,0 +1,19 @@ +#![feature(coverage_attribute, noop_waker)] +//@ edition: 2021 + +use core::future::Future; +use core::pin::pin; +use core::task::{Context, Poll, Waker}; + +/// Dummy "executor" that just repeatedly polls a future until it's ready. +#[coverage(off)] +pub fn block_on<F: Future>(mut future: F) -> F::Output { + let mut future = pin!(future); + let mut context = Context::from_waker(Waker::noop()); + + loop { + if let Poll::Ready(val) = future.as_mut().poll(&mut context) { + break val; + } + } +} diff --git a/tests/coverage/await_ready.cov-map b/tests/coverage/await_ready.cov-map index 0c9f2ae29a8..38c2cf7b2d3 100644 --- a/tests/coverage/await_ready.cov-map +++ b/tests/coverage/await_ready.cov-map @@ -1,25 +1,17 @@ Function name: await_ready::await_ready -Raw bytes (9): 0x[01, 01, 00, 01, 01, 0a, 01, 00, 1e] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 0f, 01, 00, 1e] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 10, 1) to (start + 0, 30) +- Code(Counter(0)) at (prev + 15, 1) to (start + 0, 30) Function name: await_ready::await_ready::{closure#0} -Raw bytes (14): 0x[01, 01, 00, 02, 01, 0a, 1e, 03, 0f, 05, 04, 01, 00, 02] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 0f, 1e, 03, 0f, 05, 04, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 10, 30) to (start + 3, 15) +- Code(Counter(0)) at (prev + 15, 30) to (start + 3, 15) - Code(Counter(1)) at (prev + 4, 1) to (start + 0, 2) -Function name: await_ready::main -Raw bytes (9): 0x[01, 01, 00, 01, 01, 10, 01, 03, 02] -Number of files: 1 -- file 0 => global file 1 -Number of expressions: 0 -Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 16, 1) to (start + 3, 2) - diff --git a/tests/coverage/await_ready.coverage b/tests/coverage/await_ready.coverage index 0075f09426e..7ab03e6d3de 100644 --- a/tests/coverage/await_ready.coverage +++ b/tests/coverage/await_ready.coverage @@ -1,38 +1,25 @@ LL| |#![feature(coverage_attribute)] - LL| |#![feature(custom_inner_attributes)] // for #![rustfmt::skip] LL| |#![feature(noop_waker)] - LL| |#![rustfmt::skip] + LL| |#![coverage(off)] LL| |//@ edition: 2021 LL| | - LL| |#[coverage(off)] - LL| |async fn ready() -> u8 { 1 } + LL| |//@ aux-build: executor.rs + LL| |extern crate executor; LL| | + LL| |async fn ready() -> u8 { + LL| | 1 + LL| |} + LL| | + LL| |#[coverage(on)] + LL| |#[rustfmt::skip] LL| 1|async fn await_ready() -> u8 { LL| 1| // await should be covered even if the function never yields LL| 1| ready() LL| 1| .await LL| 1|} LL| | - LL| 1|fn main() { - LL| 1| let mut future = Box::pin(await_ready()); - LL| 1| executor::block_on(future.as_mut()); - LL| 1|} - LL| | - LL| |mod executor { - LL| | use core::future::Future; - LL| | use core::pin::pin; - LL| | use core::task::{Context, Poll, Waker}; - LL| | - LL| | #[coverage(off)] - LL| | pub fn block_on<F: Future>(mut future: F) -> F::Output { - LL| | let mut future = pin!(future); - LL| | let mut context = Context::from_waker(Waker::noop()); - LL| | - LL| | loop { - LL| | if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - LL| | break val; - LL| | } - LL| | } - LL| | } + LL| |fn main() { + LL| | let mut future = Box::pin(await_ready()); + LL| | executor::block_on(future.as_mut()); LL| |} diff --git a/tests/coverage/await_ready.rs b/tests/coverage/await_ready.rs index 9212a4ba705..27ee99d3989 100644 --- a/tests/coverage/await_ready.rs +++ b/tests/coverage/await_ready.rs @@ -1,12 +1,17 @@ #![feature(coverage_attribute)] -#![feature(custom_inner_attributes)] // for #![rustfmt::skip] #![feature(noop_waker)] -#![rustfmt::skip] +#![coverage(off)] //@ edition: 2021 -#[coverage(off)] -async fn ready() -> u8 { 1 } +//@ aux-build: executor.rs +extern crate executor; +async fn ready() -> u8 { + 1 +} + +#[coverage(on)] +#[rustfmt::skip] async fn await_ready() -> u8 { // await should be covered even if the function never yields ready() @@ -17,21 +22,3 @@ fn main() { let mut future = Box::pin(await_ready()); executor::block_on(future.as_mut()); } - -mod executor { - use core::future::Future; - use core::pin::pin; - use core::task::{Context, Poll, Waker}; - - #[coverage(off)] - pub fn block_on<F: Future>(mut future: F) -> F::Output { - let mut future = pin!(future); - let mut context = Context::from_waker(Waker::noop()); - - loop { - if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - break val; - } - } - } -} diff --git a/tests/coverage/closure_macro_async.cov-map b/tests/coverage/closure_macro_async.cov-map index 1286d663bd4..4d0597f58bf 100644 --- a/tests/coverage/closure_macro_async.cov-map +++ b/tests/coverage/closure_macro_async.cov-map @@ -1,27 +1,27 @@ Function name: closure_macro_async::load_configuration_files -Raw bytes (9): 0x[01, 01, 00, 01, 01, 1f, 01, 02, 02] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 22, 01, 02, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 31, 1) to (start + 2, 2) +- Code(Counter(0)) at (prev + 34, 1) to (start + 2, 2) Function name: closure_macro_async::test -Raw bytes (9): 0x[01, 01, 00, 01, 01, 23, 01, 00, 2b] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 26, 01, 00, 2b] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 35, 1) to (start + 0, 43) +- Code(Counter(0)) at (prev + 38, 1) to (start + 0, 43) Function name: closure_macro_async::test::{closure#0} -Raw bytes (36): 0x[01, 01, 01, 01, 05, 06, 01, 23, 2b, 01, 21, 02, 02, 09, 00, 0f, 01, 00, 12, 00, 54, 05, 00, 54, 00, 55, 02, 02, 09, 02, 0b, 01, 03, 01, 00, 02] +Raw bytes (36): 0x[01, 01, 01, 01, 05, 06, 01, 26, 2b, 01, 21, 02, 02, 09, 00, 0f, 01, 00, 12, 00, 54, 05, 00, 54, 00, 55, 02, 02, 09, 02, 0b, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 1 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) Number of file 0 mappings: 6 -- Code(Counter(0)) at (prev + 35, 43) to (start + 1, 33) +- Code(Counter(0)) at (prev + 38, 43) to (start + 1, 33) - Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 15) = (c0 - c1) - Code(Counter(0)) at (prev + 0, 18) to (start + 0, 84) @@ -31,7 +31,7 @@ Number of file 0 mappings: 6 - Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) Function name: closure_macro_async::test::{closure#0}::{closure#0} -Raw bytes (35): 0x[01, 01, 03, 01, 05, 05, 0b, 09, 00, 05, 01, 12, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 00, 00, 17, 00, 1e, 07, 02, 09, 00, 0a] +Raw bytes (35): 0x[01, 01, 03, 01, 05, 05, 0b, 09, 00, 05, 01, 15, 1c, 03, 21, 05, 04, 11, 01, 27, 02, 03, 11, 00, 16, 00, 00, 17, 00, 1e, 07, 02, 09, 00, 0a] Number of files: 1 - file 0 => global file 1 Number of expressions: 3 @@ -39,7 +39,7 @@ Number of expressions: 3 - expression 1 operands: lhs = Counter(1), rhs = Expression(2, Add) - expression 2 operands: lhs = Counter(2), rhs = Zero Number of file 0 mappings: 5 -- Code(Counter(0)) at (prev + 18, 28) to (start + 3, 33) +- Code(Counter(0)) at (prev + 21, 28) to (start + 3, 33) - Code(Counter(1)) at (prev + 4, 17) to (start + 1, 39) - Code(Expression(0, Sub)) at (prev + 3, 17) to (start + 0, 22) = (c0 - c1) diff --git a/tests/coverage/closure_macro_async.coverage b/tests/coverage/closure_macro_async.coverage index 0557ce47d68..a8c72efac66 100644 --- a/tests/coverage/closure_macro_async.coverage +++ b/tests/coverage/closure_macro_async.coverage @@ -2,6 +2,9 @@ LL| |#![feature(noop_waker)] LL| |//@ edition: 2018 LL| | + LL| |//@ aux-build: executor.rs + LL| |extern crate executor; + LL| | LL| |macro_rules! bail { LL| | ($msg:literal $(,)?) => { LL| | if $msg.len() > 0 { @@ -46,22 +49,4 @@ LL| |fn main() { LL| | executor::block_on(test()).unwrap(); LL| |} - LL| | - LL| |mod executor { - LL| | use core::future::Future; - LL| | use core::pin::pin; - LL| | use core::task::{Context, Poll, Waker}; - LL| | - LL| | #[coverage(off)] - LL| | pub fn block_on<F: Future>(mut future: F) -> F::Output { - LL| | let mut future = pin!(future); - LL| | let mut context = Context::from_waker(Waker::noop()); - LL| | - LL| | loop { - LL| | if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - LL| | break val; - LL| | } - LL| | } - LL| | } - LL| |} diff --git a/tests/coverage/closure_macro_async.rs b/tests/coverage/closure_macro_async.rs index 735214629b6..defd1b6d632 100644 --- a/tests/coverage/closure_macro_async.rs +++ b/tests/coverage/closure_macro_async.rs @@ -2,6 +2,9 @@ #![feature(noop_waker)] //@ edition: 2018 +//@ aux-build: executor.rs +extern crate executor; + macro_rules! bail { ($msg:literal $(,)?) => { if $msg.len() > 0 { @@ -45,21 +48,3 @@ pub async fn test() -> Result<(), String> { fn main() { executor::block_on(test()).unwrap(); } - -mod executor { - use core::future::Future; - use core::pin::pin; - use core::task::{Context, Poll, Waker}; - - #[coverage(off)] - pub fn block_on<F: Future>(mut future: F) -> F::Output { - let mut future = pin!(future); - let mut context = Context::from_waker(Waker::noop()); - - loop { - if let Poll::Ready(val) = future.as_mut().poll(&mut context) { - break val; - } - } - } -} diff --git a/tests/incremental/issue-61530.rs b/tests/incremental/issue-61530.rs index b4914dda11a..71ac39d0e03 100644 --- a/tests/incremental/issue-61530.rs +++ b/tests/incremental/issue-61530.rs @@ -9,9 +9,12 @@ extern "rust-intrinsic" { fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; } +#[repr(simd)] +struct SimdShuffleIdx<const LEN: usize>([u32; LEN]); + fn main() { unsafe { - const IDX: [u32; 2] = [0, 0]; + const IDX: SimdShuffleIdx<2> = SimdShuffleIdx([0, 0]); let _: I32x2 = simd_shuffle(I32x2([1, 2]), I32x2([3, 4]), IDX); let _: I32x2 = simd_shuffle(I32x2([1, 2]), I32x2([3, 4]), IDX); } diff --git a/tests/ui/coherence/coherence-conflicting-repeated-negative-trait-impl-70849.rs b/tests/ui/coherence/coherence-conflicting-repeated-negative-trait-impl-70849.rs new file mode 100644 index 00000000000..88b9d9e62bf --- /dev/null +++ b/tests/ui/coherence/coherence-conflicting-repeated-negative-trait-impl-70849.rs @@ -0,0 +1,10 @@ +#![feature(negative_impls)] +//@ edition: 2021 +// Test to ensure we are printing the polarity of the impl trait ref +// when printing out conflicting trait impls + +struct MyType; + +impl !Clone for &mut MyType {} +//~^ ERROR conflicting implementations of trait `Clone` for type `&mut MyType` +fn main() {} diff --git a/tests/ui/coherence/coherence-conflicting-repeated-negative-trait-impl-70849.stderr b/tests/ui/coherence/coherence-conflicting-repeated-negative-trait-impl-70849.stderr new file mode 100644 index 00000000000..b317197eb40 --- /dev/null +++ b/tests/ui/coherence/coherence-conflicting-repeated-negative-trait-impl-70849.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Clone` for type `&mut MyType` + --> $DIR/coherence-conflicting-repeated-negative-trait-impl-70849.rs:8:1 + | +LL | impl !Clone for &mut MyType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl<T> !Clone for &mut T + where T: ?Sized; + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/simd/intrinsic/generic-elements-pass.rs b/tests/ui/simd/intrinsic/generic-elements-pass.rs index b159387ab62..7b1bda4fbcd 100644 --- a/tests/ui/simd/intrinsic/generic-elements-pass.rs +++ b/tests/ui/simd/intrinsic/generic-elements-pass.rs @@ -23,6 +23,9 @@ extern "rust-intrinsic" { fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; } +#[repr(simd)] +struct SimdShuffleIdx<const LEN: usize>([u32; LEN]); + macro_rules! all_eq { ($a: expr, $b: expr) => {{ let a = $a; @@ -30,9 +33,8 @@ macro_rules! all_eq { // type inference works better with the concrete type on the // left, but humans work better with the expected on the // right. - assert!(b == a, - "{:?} != {:?}", a, b); - }} + assert!(b == a, "{:?} != {:?}", a, b); + }}; } fn main() { @@ -79,20 +81,34 @@ fn main() { let y4 = i32x4([140, 141, 142, 143]); let y8 = i32x8([180, 181, 182, 183, 184, 185, 186, 187]); unsafe { - all_eq!(simd_shuffle(x2, y2, const { [3u32, 0] }), i32x2([121, 20])); - all_eq!(simd_shuffle(x2, y2, const { [3u32, 0, 1, 2] }), i32x4([121, 20, 21, 120])); - all_eq!(simd_shuffle(x2, y2, const { [3u32, 0, 1, 2, 1, 2, 3, 0] }), - i32x8([121, 20, 21, 120, 21, 120, 121, 20])); + all_eq!(simd_shuffle(x2, y2, const { SimdShuffleIdx([3u32, 0]) }), i32x2([121, 20])); + all_eq!( + simd_shuffle(x2, y2, const { SimdShuffleIdx([3u32, 0, 1, 2]) }), + i32x4([121, 20, 21, 120]) + ); + all_eq!( + simd_shuffle(x2, y2, const { SimdShuffleIdx([3u32, 0, 1, 2, 1, 2, 3, 0]) }), + i32x8([121, 20, 21, 120, 21, 120, 121, 20]) + ); - all_eq!(simd_shuffle(x4, y4, const { [7u32, 2] }), i32x2([143, 42])); - all_eq!(simd_shuffle(x4, y4, const { [7u32, 2, 5, 0] }), i32x4([143, 42, 141, 40])); - all_eq!(simd_shuffle(x4, y4, const { [7u32, 2, 5, 0, 3, 6, 4, 1] }), - i32x8([143, 42, 141, 40, 43, 142, 140, 41])); + all_eq!(simd_shuffle(x4, y4, const { SimdShuffleIdx([7u32, 2]) }), i32x2([143, 42])); + all_eq!( + simd_shuffle(x4, y4, const { SimdShuffleIdx([7u32, 2, 5, 0]) }), + i32x4([143, 42, 141, 40]) + ); + all_eq!( + simd_shuffle(x4, y4, const { SimdShuffleIdx([7u32, 2, 5, 0, 3, 6, 4, 1]) }), + i32x8([143, 42, 141, 40, 43, 142, 140, 41]) + ); - all_eq!(simd_shuffle(x8, y8, const { [11u32, 5] }), i32x2([183, 85])); - all_eq!(simd_shuffle(x8, y8, const { [11u32, 5, 15, 0] }), i32x4([183, 85, 187, 80])); - all_eq!(simd_shuffle(x8, y8, const { [11u32, 5, 15, 0, 3, 8, 12, 1] }), - i32x8([183, 85, 187, 80, 83, 180, 184, 81])); + all_eq!(simd_shuffle(x8, y8, const { SimdShuffleIdx([11u32, 5]) }), i32x2([183, 85])); + all_eq!( + simd_shuffle(x8, y8, const { SimdShuffleIdx([11u32, 5, 15, 0]) }), + i32x4([183, 85, 187, 80]) + ); + all_eq!( + simd_shuffle(x8, y8, const { SimdShuffleIdx([11u32, 5, 15, 0, 3, 8, 12, 1]) }), + i32x8([183, 85, 187, 80, 83, 180, 184, 81]) + ); } - } diff --git a/tests/ui/simd/intrinsic/generic-elements.rs b/tests/ui/simd/intrinsic/generic-elements.rs index 4848fd1b803..5d784a25eab 100644 --- a/tests/ui/simd/intrinsic/generic-elements.rs +++ b/tests/ui/simd/intrinsic/generic-elements.rs @@ -37,6 +37,9 @@ extern "rust-intrinsic" { fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U; } +#[repr(simd)] +struct SimdShuffleIdx<const LEN: usize>([u32; LEN]); + fn main() { let x = i32x4([0, 0, 0, 0]); @@ -48,13 +51,13 @@ fn main() { simd_extract::<_, f32>(x, 0); //~^ ERROR expected return type `i32` (element of input `i32x4`), found `f32` - const IDX2: [u32; 2] = [0; 2]; + const IDX2: SimdShuffleIdx<2> = SimdShuffleIdx([0; 2]); simd_shuffle::<i32, _, i32>(0, 0, IDX2); //~^ ERROR expected SIMD input type, found non-SIMD `i32` - const IDX4: [u32; 4] = [0; 4]; + const IDX4: SimdShuffleIdx<4> = SimdShuffleIdx([0; 4]); simd_shuffle::<i32, _, i32>(0, 0, IDX4); //~^ ERROR expected SIMD input type, found non-SIMD `i32` - const IDX8: [u32; 8] = [0; 8]; + const IDX8: SimdShuffleIdx<8> = SimdShuffleIdx([0; 8]); simd_shuffle::<i32, _, i32>(0, 0, IDX8); //~^ ERROR expected SIMD input type, found non-SIMD `i32` diff --git a/tests/ui/simd/intrinsic/generic-elements.stderr b/tests/ui/simd/intrinsic/generic-elements.stderr index 0788a7c17f9..fd726d75326 100644 --- a/tests/ui/simd/intrinsic/generic-elements.stderr +++ b/tests/ui/simd/intrinsic/generic-elements.stderr @@ -1,125 +1,125 @@ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:44:9 + --> $DIR/generic-elements.rs:47:9 | LL | simd_insert(0, 0, 0); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `i32` (element of input `i32x4`), found `f64` - --> $DIR/generic-elements.rs:46:9 + --> $DIR/generic-elements.rs:49:9 | LL | simd_insert(x, 0, 1.0); | ^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_extract` intrinsic: expected return type `i32` (element of input `i32x4`), found `f32` - --> $DIR/generic-elements.rs:48:9 + --> $DIR/generic-elements.rs:51:9 | LL | simd_extract::<_, f32>(x, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:52:9 + --> $DIR/generic-elements.rs:55:9 | LL | simd_shuffle::<i32, _, i32>(0, 0, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:55:9 + --> $DIR/generic-elements.rs:58:9 | LL | simd_shuffle::<i32, _, i32>(0, 0, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:58:9 + --> $DIR/generic-elements.rs:61:9 | LL | simd_shuffle::<i32, _, i32>(0, 0, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - --> $DIR/generic-elements.rs:61:9 + --> $DIR/generic-elements.rs:64:9 | LL | simd_shuffle::<_, _, f32x2>(x, x, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - --> $DIR/generic-elements.rs:63:9 + --> $DIR/generic-elements.rs:66:9 | LL | simd_shuffle::<_, _, f32x4>(x, x, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` - --> $DIR/generic-elements.rs:65:9 + --> $DIR/generic-elements.rs:68:9 | LL | simd_shuffle::<_, _, f32x8>(x, x, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 2, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:68:9 + --> $DIR/generic-elements.rs:71:9 | LL | simd_shuffle::<_, _, i32x8>(x, x, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 4, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:70:9 + --> $DIR/generic-elements.rs:73:9 | LL | simd_shuffle::<_, _, i32x8>(x, x, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 8, found `i32x2` with length 2 - --> $DIR/generic-elements.rs:72:9 + --> $DIR/generic-elements.rs:75:9 | LL | simd_shuffle::<_, _, i32x2>(x, x, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:76:9 + --> $DIR/generic-elements.rs:79:9 | LL | simd_shuffle_generic::<i32, i32, I2>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:79:9 + --> $DIR/generic-elements.rs:82:9 | LL | simd_shuffle_generic::<i32, i32, I4>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:82:9 + --> $DIR/generic-elements.rs:85:9 | LL | simd_shuffle_generic::<i32, i32, I8>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - --> $DIR/generic-elements.rs:85:9 + --> $DIR/generic-elements.rs:88:9 | LL | simd_shuffle_generic::<_, f32x2, I2>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - --> $DIR/generic-elements.rs:87:9 + --> $DIR/generic-elements.rs:90:9 | LL | simd_shuffle_generic::<_, f32x4, I4>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` - --> $DIR/generic-elements.rs:89:9 + --> $DIR/generic-elements.rs:92:9 | LL | simd_shuffle_generic::<_, f32x8, I8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 2, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:92:9 + --> $DIR/generic-elements.rs:95:9 | LL | simd_shuffle_generic::<_, i32x8, I2>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 4, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:94:9 + --> $DIR/generic-elements.rs:97:9 | LL | simd_shuffle_generic::<_, i32x8, I4>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 8, found `i32x2` with length 2 - --> $DIR/generic-elements.rs:96:9 + --> $DIR/generic-elements.rs:99:9 | LL | simd_shuffle_generic::<_, i32x2, I8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-shuffle.rs b/tests/ui/simd/intrinsic/generic-shuffle.rs index c0888f67784..2752718d99d 100644 --- a/tests/ui/simd/intrinsic/generic-shuffle.rs +++ b/tests/ui/simd/intrinsic/generic-shuffle.rs @@ -14,13 +14,16 @@ extern "rust-intrinsic" { } fn main() { - const I: [u32; 2] = [0; 2]; - const I2: [f32; 2] = [0.; 2]; + const I: Simd<u32, 2> = Simd([0; 2]); + const I2: Simd<f32, 2> = Simd([0.; 2]); let v = Simd::<u32, 4>([0; 4]); unsafe { let _: Simd<u32, 2> = simd_shuffle(v, v, I); + let _: Simd<u32, 2> = simd_shuffle(v, v, const { [0u32; 2] }); + //~^ ERROR invalid monomorphization of `simd_shuffle` intrinsic + let _: Simd<u32, 4> = simd_shuffle(v, v, I); //~^ ERROR invalid monomorphization of `simd_shuffle` intrinsic diff --git a/tests/ui/simd/intrinsic/generic-shuffle.stderr b/tests/ui/simd/intrinsic/generic-shuffle.stderr index 81e641612ce..7e6d51a5f65 100644 --- a/tests/ui/simd/intrinsic/generic-shuffle.stderr +++ b/tests/ui/simd/intrinsic/generic-shuffle.stderr @@ -1,21 +1,27 @@ -error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 2, found `Simd<u32, 4>` with length 4 +error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: simd_shuffle index must be a SIMD vector of `u32`, got `[u32; 2]` --> $DIR/generic-shuffle.rs:24:31 | +LL | let _: Simd<u32, 2> = simd_shuffle(v, v, const { [0u32; 2] }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 2, found `Simd<u32, 4>` with length 4 + --> $DIR/generic-shuffle.rs:27:31 + | LL | let _: Simd<u32, 4> = simd_shuffle(v, v, I); | ^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `u32` (element of input `Simd<u32, 4>`), found `Simd<f32, 2>` with element type `f32` - --> $DIR/generic-shuffle.rs:27:31 + --> $DIR/generic-shuffle.rs:30:31 | LL | let _: Simd<f32, 2> = simd_shuffle(v, v, I); | ^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: simd_shuffle index must be an array of `u32`, got `[f32; 2]` - --> $DIR/generic-shuffle.rs:30:31 +error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: simd_shuffle index must be a SIMD vector of `u32`, got `Simd<f32, 2>` + --> $DIR/generic-shuffle.rs:33:31 | LL | let _: Simd<u32, 2> = simd_shuffle(v, v, I2); | ^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0511`. diff --git a/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs b/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs index a64a7c0b48a..d9239ef5801 100644 --- a/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs +++ b/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs @@ -13,6 +13,9 @@ extern "rust-intrinsic" { #[derive(Debug, PartialEq)] struct Simd2([u8; 2]); +#[repr(simd)] +struct SimdShuffleIdx<const LEN: usize>([u32; LEN]); + fn main() { unsafe { let _: Simd2 = inline_me(); @@ -21,6 +24,6 @@ fn main() { #[inline(always)] unsafe fn inline_me() -> Simd2 { - const IDX: [u32; 2] = [0, 3]; + const IDX: SimdShuffleIdx<2> = SimdShuffleIdx([0, 3]); simd_shuffle(Simd2([10, 11]), Simd2([12, 13]), IDX) } diff --git a/tests/ui/simd/intrinsic/inlining-issue67557.rs b/tests/ui/simd/intrinsic/inlining-issue67557.rs index cb80d65d468..23dd5075f96 100644 --- a/tests/ui/simd/intrinsic/inlining-issue67557.rs +++ b/tests/ui/simd/intrinsic/inlining-issue67557.rs @@ -13,9 +13,12 @@ extern "rust-intrinsic" { #[derive(Debug, PartialEq)] struct Simd2([u8; 2]); +#[repr(simd)] +struct SimdShuffleIdx<const LEN: usize>([u32; LEN]); + fn main() { unsafe { - const IDX: [u32; 2] = [0, 1]; + const IDX: SimdShuffleIdx<2> = SimdShuffleIdx([0, 1]); let p_res: Simd2 = simd_shuffle(Simd2([10, 11]), Simd2([12, 13]), IDX); let a_res: Simd2 = inline_me(); @@ -37,6 +40,6 @@ fn assert_10_13(x: Simd2) { #[inline(always)] unsafe fn inline_me() -> Simd2 { - const IDX: [u32; 2] = [0, 3]; + const IDX: SimdShuffleIdx<2> = SimdShuffleIdx([0, 3]); simd_shuffle(Simd2([10, 11]), Simd2([12, 13]), IDX) } diff --git a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr index c4cfca7be1d..2d1fa1f8da2 100644 --- a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr +++ b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr @@ -1,8 +1,8 @@ error: overly complex generic constant --> $DIR/monomorphize-shuffle-index.rs:29:45 | -LL | return simd_shuffle_generic::<_, _, { &Self::I }>(a, b); - | ^^--------^^ +LL | return simd_shuffle_generic::<_, _, { &Self::I.0 }>(a, b); + | ^^----------^^ | | | pointer casts are not allowed in generic constants | diff --git a/tests/ui/simd/monomorphize-shuffle-index.rs b/tests/ui/simd/monomorphize-shuffle-index.rs index 30c345cb904..140cf6fbe96 100644 --- a/tests/ui/simd/monomorphize-shuffle-index.rs +++ b/tests/ui/simd/monomorphize-shuffle-index.rs @@ -16,8 +16,8 @@ extern "rust-intrinsic" { struct Simd<T, const N: usize>([T; N]); trait Shuffle<const N: usize> { - const I: [u32; N]; - const J: &'static [u32] = &Self::I; + const I: Simd<u32, N>; + const J: &'static [u32] = &Self::I.0; unsafe fn shuffle<T, const M: usize>(&self, a: Simd<T, M>, b: Simd<T, M>) -> Simd<T, N> where @@ -26,7 +26,7 @@ trait Shuffle<const N: usize> { #[cfg(old)] return simd_shuffle(a, b, Self::I); #[cfg(generic)] - return simd_shuffle_generic::<_, _, { &Self::I }>(a, b); + return simd_shuffle_generic::<_, _, { &Self::I.0 }>(a, b); //[generic]~^ overly complex generic constant #[cfg(generic_with_fn)] return simd_shuffle_generic::<_, _, { Self::J }>(a, b); @@ -38,12 +38,12 @@ struct Thing<const X: &'static [u32]>; fn main() { struct I1; impl Shuffle<4> for I1 { - const I: [u32; 4] = [0, 2, 4, 6]; + const I: Simd<u32, 4> = Simd([0, 2, 4, 6]); } struct I2; impl Shuffle<2> for I2 { - const I: [u32; 2] = [1, 5]; + const I: Simd<u32, 2> = Simd([1, 5]); } let a = Simd::<u8, 4>([0, 1, 2, 3]); diff --git a/tests/ui/simd/not-out-of-bounds.rs b/tests/ui/simd/not-out-of-bounds.rs index 36d7a5865bc..4bd2a69edbf 100644 --- a/tests/ui/simd/not-out-of-bounds.rs +++ b/tests/ui/simd/not-out-of-bounds.rs @@ -30,6 +30,9 @@ struct u8x64([u8; 64]); use std::intrinsics::simd::*; +#[repr(simd)] +struct SimdShuffleIdx<const LEN: usize>([u32; LEN]); + // Test vectors by lane size. Since LLVM does not distinguish between a shuffle // over two f32s and a shuffle over two u64s, or any other such combination, // it is not necessary to test every possible vector, only lane counts. @@ -37,26 +40,26 @@ macro_rules! test_shuffle_lanes { ($n:literal, $x:ident, $y:ident) => { unsafe { let shuffle: $x = { - const ARR: [u32; $n] = { + const IDX: SimdShuffleIdx<$n> = SimdShuffleIdx({ let mut arr = [0; $n]; arr[0] = $n * 2; arr - }; + }); let mut n: u8 = $n; let vals = [0; $n].map(|_| { n = n - 1; n }); let vec1 = $x(vals); let vec2 = $x(vals); - $y(vec1, vec2, ARR) + $y(vec1, vec2, IDX) }; } } } -//~^^^^^ ERROR: invalid monomorphization of `simd_shuffle` intrinsic -//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic -//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic -//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic -//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic -//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic +//~^^^^^ ERROR: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds +//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds +//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds +//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds +//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds +//~| ERROR: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds // Because the test is mostly embedded in a macro, all the errors have the same origin point. // And unfortunately, standard comments, as in the UI test harness, disappear in macros! @@ -69,15 +72,15 @@ fn main() { test_shuffle_lanes!(64, u8x64, simd_shuffle); let v = u8x2([0, 0]); - const I: [u32; 2] = [4, 4]; + const I: SimdShuffleIdx<2> = SimdShuffleIdx([4, 4]); unsafe { let _: u8x2 = simd_shuffle(v, v, I); - //~^ ERROR invalid monomorphization of `simd_shuffle` intrinsic + //~^ ERROR invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds } // also check insert/extract unsafe { - simd_insert(v, 2, 0); //~ ERROR invalid monomorphization of `simd_insert` intrinsic - let _val: u8 = simd_extract(v, 2); //~ ERROR invalid monomorphization of `simd_extract` intrinsic + simd_insert(v, 2, 0u8); //~ ERROR invalid monomorphization of `simd_insert` intrinsic: SIMD index #1 is out of bounds + let _val: u8 = simd_extract(v, 2); //~ ERROR invalid monomorphization of `simd_extract` intrinsic: SIMD index #1 is out of bounds } } diff --git a/tests/ui/simd/not-out-of-bounds.stderr b/tests/ui/simd/not-out-of-bounds.stderr index 5682935c1f1..4b6bda93e45 100644 --- a/tests/ui/simd/not-out-of-bounds.stderr +++ b/tests/ui/simd/not-out-of-bounds.stderr @@ -1,7 +1,7 @@ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 4) - --> $DIR/not-out-of-bounds.rs:49:21 + --> $DIR/not-out-of-bounds.rs:52:21 | -LL | $y(vec1, vec2, ARR) +LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(2, u8x2, simd_shuffle); @@ -10,9 +10,9 @@ LL | test_shuffle_lanes!(2, u8x2, simd_shuffle); = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 8) - --> $DIR/not-out-of-bounds.rs:49:21 + --> $DIR/not-out-of-bounds.rs:52:21 | -LL | $y(vec1, vec2, ARR) +LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(4, u8x4, simd_shuffle); @@ -21,9 +21,9 @@ LL | test_shuffle_lanes!(4, u8x4, simd_shuffle); = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 16) - --> $DIR/not-out-of-bounds.rs:49:21 + --> $DIR/not-out-of-bounds.rs:52:21 | -LL | $y(vec1, vec2, ARR) +LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(8, u8x8, simd_shuffle); @@ -32,9 +32,9 @@ LL | test_shuffle_lanes!(8, u8x8, simd_shuffle); = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 32) - --> $DIR/not-out-of-bounds.rs:49:21 + --> $DIR/not-out-of-bounds.rs:52:21 | -LL | $y(vec1, vec2, ARR) +LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(16, u8x16, simd_shuffle); @@ -43,9 +43,9 @@ LL | test_shuffle_lanes!(16, u8x16, simd_shuffle); = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 64) - --> $DIR/not-out-of-bounds.rs:49:21 + --> $DIR/not-out-of-bounds.rs:52:21 | -LL | $y(vec1, vec2, ARR) +LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(32, u8x32, simd_shuffle); @@ -54,9 +54,9 @@ LL | test_shuffle_lanes!(32, u8x32, simd_shuffle); = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 128) - --> $DIR/not-out-of-bounds.rs:49:21 + --> $DIR/not-out-of-bounds.rs:52:21 | -LL | $y(vec1, vec2, ARR) +LL | $y(vec1, vec2, IDX) | ^^^^^^^^^^^^^^^^^^^ ... LL | test_shuffle_lanes!(64, u8x64, simd_shuffle); @@ -65,19 +65,19 @@ LL | test_shuffle_lanes!(64, u8x64, simd_shuffle); = note: this error originates in the macro `test_shuffle_lanes` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: SIMD index #0 is out of bounds (limit 4) - --> $DIR/not-out-of-bounds.rs:74:23 + --> $DIR/not-out-of-bounds.rs:77:23 | LL | let _: u8x2 = simd_shuffle(v, v, I); | ^^^^^^^^^^^^^^^^^^^^^ -error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `u8` (element of input `u8x2`), found `i32` - --> $DIR/not-out-of-bounds.rs:80:9 +error[E0511]: invalid monomorphization of `simd_insert` intrinsic: SIMD index #1 is out of bounds (limit 2) + --> $DIR/not-out-of-bounds.rs:83:9 | -LL | simd_insert(v, 2, 0); - | ^^^^^^^^^^^^^^^^^^^^ +LL | simd_insert(v, 2, 0u8); + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_extract` intrinsic: SIMD index #1 is out of bounds (limit 2) - --> $DIR/not-out-of-bounds.rs:81:24 + --> $DIR/not-out-of-bounds.rs:84:24 | LL | let _val: u8 = simd_extract(v, 2); | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/shuffle.rs b/tests/ui/simd/shuffle.rs index dc0d688284e..96c0ed2118f 100644 --- a/tests/ui/simd/shuffle.rs +++ b/tests/ui/simd/shuffle.rs @@ -16,16 +16,13 @@ extern "rust-intrinsic" { #[repr(simd)] struct Simd<T, const N: usize>([T; N]); -unsafe fn __shuffle_vector16<const IDX: [u32; 16], T, U>(x: T, y: T) -> U { - simd_shuffle(x, y, IDX) -} -unsafe fn __shuffle_vector16_v2<const IDX: Simd<u32, 16>, T, U>(x: T, y: T) -> U { +unsafe fn __shuffle_vector16<const IDX: Simd<u32, 16>, T, U>(x: T, y: T) -> U { simd_shuffle(x, y, IDX) } fn main() { - const I1: [u32; 4] = [0, 2, 4, 6]; - const I2: [u32; 2] = [1, 5]; + const I1: Simd<u32, 4> = Simd([0, 2, 4, 6]); + const I2: Simd<u32, 2> = Simd([1, 5]); let a = Simd::<u8, 4>([0, 1, 2, 3]); let b = Simd::<u8, 4>([4, 5, 6, 7]); unsafe { @@ -35,16 +32,6 @@ fn main() { let y: Simd<u8, 2> = simd_shuffle(a, b, I2); assert_eq!(y.0, [1, 5]); } - // Test that we can also use a SIMD vector instead of a normal array for the shuffle. - const I1_SIMD: Simd<u32, 4> = Simd([0, 2, 4, 6]); - const I2_SIMD: Simd<u32, 2> = Simd([1, 5]); - unsafe { - let x: Simd<u8, 4> = simd_shuffle(a, b, I1_SIMD); - assert_eq!(x.0, [0, 2, 4, 6]); - - let y: Simd<u8, 2> = simd_shuffle(a, b, I2_SIMD); - assert_eq!(y.0, [1, 5]); - } // Test that an indirection (via an unnamed constant) // through a const generic parameter also works. @@ -53,13 +40,6 @@ fn main() { let b = Simd::<u8, 16>([16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]); unsafe { __shuffle_vector16::< - { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] }, - Simd<u8, 16>, - Simd<u8, 16>, - >(a, b); - } - unsafe { - __shuffle_vector16_v2::< { Simd([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) }, Simd<u8, 16>, Simd<u8, 16>, |
