diff options
| author | bors <bors@rust-lang.org> | 2024-08-03 21:19:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-08-03 21:19:42 +0000 |
| commit | 64ebd39da5ec28caa3bd7cbb3f22f5949432fe2b (patch) | |
| tree | 3c2c7dfa5c39be2dbd6aff2d26e3bfb0f3ef135d /tests/codegen | |
| parent | bbf60c897e18a72923129c63ff33ce2de2968815 (diff) | |
| parent | 0655ed234f942959c70560ec907ae442fb51f146 (diff) | |
| download | rust-64ebd39da5ec28caa3bd7cbb3f22f5949432fe2b.tar.gz rust-64ebd39da5ec28caa3bd7cbb3f22f5949432fe2b.zip | |
Auto merge of #128614 - matthiaskrgr:rollup-d2fextz, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #127921 (Stabilize unsafe extern blocks (RFC 3484)) - #128283 (bootstrap: fix bug preventing the use of custom targets) - #128530 (Implement `UncheckedIterator` directly for `RepeatN`) - #128551 (chore: refactor backtrace style in panic) - #128573 (Simplify `body` usage in rustdoc) - #128581 (Assert that all attributes are actually checked via `CheckAttrVisitor` and aren't accidentally usable on completely unrelated HIR nodes) - #128603 (Update run-make/used to use `any_symbol_contains`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/iter-repeat-n-trivial-drop.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/codegen/iter-repeat-n-trivial-drop.rs b/tests/codegen/iter-repeat-n-trivial-drop.rs index 31020b77984..7de224b92d8 100644 --- a/tests/codegen/iter-repeat-n-trivial-drop.rs +++ b/tests/codegen/iter-repeat-n-trivial-drop.rs @@ -1,8 +1,9 @@ -//@ compile-flags: -O +//@ compile-flags: -C opt-level=3 //@ only-x86_64 #![crate_type = "lib"] #![feature(iter_repeat_n)] +#![feature(array_repeat)] #[derive(Clone)] pub struct NotCopy(u16); @@ -54,3 +55,15 @@ pub fn vec_extend_via_iter_repeat_n() -> Vec<u8> { v.extend(std::iter::repeat_n(42_u8, n)); v } + +// Array repeat uses `RepeatN::next_unchecked` internally, +// so also check that the distinction disappears there. + +#[no_mangle] +// CHECK-LABEL: @array_repeat_not_copy +pub unsafe fn array_repeat_not_copy(item: NotCopy) -> [NotCopy; 8] { + // CHECK: insertelement {{.+}} i16 %item + // CHECK: shufflevector <8 x i16> {{.+}} zeroinitializer + // CHECK: store <8 x i16> + std::array::repeat(item) +} |
