Skip to content

Commit a1a1866

Browse files
authored
Create ZST-nthback.rs test for nth_back method
Add test for Intolter::nth_back with ZSTs
1 parent c1805f5 commit a1a1866

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/ui/iterators/ZST-nthback.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ check-pass
2+
// test Intolter::nth_back does not cause UB for ZSTs with high alignment
3+
4+
#[repr(align(8))]
5+
struct Thing;
6+
7+
fn main() {
8+
let v = vec![Thing, Thing];
9+
let _ = v.into_iter().nth_back(1);
10+
}

0 commit comments

Comments
 (0)