diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-07-06 18:27:43 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-07-26 19:00:31 +0200 |
| commit | ae70e366f3b77c127f6cb799fcaab4de96974d5c (patch) | |
| tree | 1e54d96ba365d64d9d87a4c68dbdd876e301bae6 | |
| parent | 10be0dd8dfc46eda4dc4d1555df31de2e8b7551a (diff) | |
| download | rust-ae70e366f3b77c127f6cb799fcaab4de96974d5c.tar.gz rust-ae70e366f3b77c127f6cb799fcaab4de96974d5c.zip | |
Check that we do not ICE when anonymous lifetimes appear in AnonConst.
Fixes #98932.
| -rw-r--r-- | src/test/ui/impl-header-lifetime-elision/constant-used-as-arraylen.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/impl-header-lifetime-elision/constant-used-as-arraylen.rs b/src/test/ui/impl-header-lifetime-elision/constant-used-as-arraylen.rs new file mode 100644 index 00000000000..929b82bfc43 --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/constant-used-as-arraylen.rs @@ -0,0 +1,24 @@ +// check-pass +// Verify that we do not ICE when anonymous lifetimes appear inside an AnonConst. + +pub struct EntriesBuffer(Box<[[u8; HashesEntry::LEN]; 5]>); + +impl EntriesBuffer { + pub fn iter_child_buffers(&mut self) -> impl Iterator<Item = &mut [u8; HashesEntry::LEN]> { + self.0.iter_mut() + } + + pub fn iter_child_buffers_explicit( + &mut self, + ) -> impl Iterator<Item = &mut [u8; HashesEntry::<'_>::LEN]> { + self.0.iter_mut() + } +} + +pub struct HashesEntry<'a>(&'a [u8]); + +impl HashesEntry<'_> { + pub const LEN: usize = 1; +} + +fn main() {} |
