Skip to content

Commit

Permalink
add test to check for popping wrong items
Browse files Browse the repository at this point in the history
co-authored-by: Alex Macleod <[email protected]>
  • Loading branch information
tesuji and Alexendoo committed Feb 6, 2025
1 parent bcfd0d1 commit 9ea2b65
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/ui/use_self.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -691,3 +691,24 @@ mod issue_13092 {
}
}
}

mod crash_check_13128 {
struct A;

impl A {
fn a() {
struct B;

// pushes a NoCheck
impl Iterator for &B {
// Pops the NoCheck
type Item = A;

// Lints A -> Self
fn next(&mut self) -> Option<A> {
Some(A)
}
}
}
}
}
21 changes: 21 additions & 0 deletions tests/ui/use_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,3 +691,24 @@ mod issue_13092 {
}
}
}

mod crash_check_13128 {
struct A;

impl A {
fn a() {
struct B;

// pushes a NoCheck
impl Iterator for &B {
// Pops the NoCheck
type Item = A;

// Lints A -> Self
fn next(&mut self) -> Option<A> {
Some(A)
}
}
}
}
}

0 comments on commit 9ea2b65

Please sign in to comment.