diff options
| author | Lzu Tao <taolzu@gmail.com> | 2024-09-07 01:15:55 +0700 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2025-02-06 14:34:55 +0700 |
| commit | 9ea2b6501e3bd3a6a3d030e1215593f00d8f9ed8 (patch) | |
| tree | 1f465d1eb03d91219718cc37515669926aabe828 | |
| parent | bcfd0d1aba7b63dd2b571771885375f9e1f66d1f (diff) | |
| download | rust-9ea2b6501e3bd3a6a3d030e1215593f00d8f9ed8.tar.gz rust-9ea2b6501e3bd3a6a3d030e1215593f00d8f9ed8.zip | |
add test to check for popping wrong items
co-authored-by: Alex Macleod <alex@macleod.io>
| -rw-r--r-- | tests/ui/use_self.fixed | 21 | ||||
| -rw-r--r-- | tests/ui/use_self.rs | 21 |
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/ui/use_self.fixed b/tests/ui/use_self.fixed index 572e919fb2d..b44840d440b 100644 --- a/tests/ui/use_self.fixed +++ b/tests/ui/use_self.fixed @@ -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) + } + } + } + } +} diff --git a/tests/ui/use_self.rs b/tests/ui/use_self.rs index c900341cadd..342c724c8e4 100644 --- a/tests/ui/use_self.rs +++ b/tests/ui/use_self.rs @@ -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) + } + } + } + } +} |
