Skip to content

Commit 08394eb

Browse files
committed
update test
1 parent 29b5844 commit 08394eb

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/test/ui/const-generics/type-dependent/issue-61936.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ struct ArrayWindows<'a, T, const N: usize> {
2020
impl <'a, T: Clone, const N: usize> Iterator for ArrayWindows<'a, T, N> {
2121
type Item = [T; N];
2222
fn next(&mut self) -> Option<Self::Item> {
23+
// Note: this is unsound for some `T` and not meant as an example
24+
// on how to implement `ArrayWindows`.
2325
let mut res = unsafe{ std::mem::zeroed() };
2426
let mut ptr = &mut res as *mut [T; N] as *mut T;
2527

2628
for i in 0..N {
27-
match self.slice[i..].get(i) {
29+
match self.slice[self.idx..].get(i) {
2830
None => return None,
2931
Some(elem) => unsafe { std::ptr::write_volatile(ptr, elem.clone())},
3032
};
@@ -39,7 +41,7 @@ impl <'a, T: Clone, const N: usize> Iterator for ArrayWindows<'a, T, N> {
3941
const FOUR: usize = 4;
4042

4143
fn main() {
42-
let v: Vec<usize> = vec![100; 0usize];
44+
let v: Vec<usize> = vec![0; 100];
4345

4446
for array in v.as_slice().array_windows::<FOUR>() {
4547
assert_eq!(array, [0, 0, 0, 0])

src/test/ui/impl-trait/auto-trait-leak.stderr

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ note: ...which requires building MIR for `cycle1`...
3434
|
3535
LL | fn cycle1() -> impl Clone {
3636
| ^^^^^^^^^^^^^^^^^^^^^^^^^
37-
note: ...which requires type-checking the potential const argument `cycle1`...
38-
--> $DIR/auto-trait-leak.rs:12:1
39-
|
40-
LL | fn cycle1() -> impl Clone {
41-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
4237
note: ...which requires type-checking `cycle1`...
4338
--> $DIR/auto-trait-leak.rs:12:1
4439
|
@@ -80,11 +75,6 @@ note: ...which requires building MIR for `cycle2`...
8075
|
8176
LL | fn cycle2() -> impl Clone {
8277
| ^^^^^^^^^^^^^^^^^^^^^^^^^
83-
note: ...which requires type-checking the potential const argument `cycle2`...
84-
--> $DIR/auto-trait-leak.rs:20:1
85-
|
86-
LL | fn cycle2() -> impl Clone {
87-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
8878
note: ...which requires type-checking `cycle2`...
8979
--> $DIR/auto-trait-leak.rs:20:1
9080
|

0 commit comments

Comments
 (0)