Skip to content

Commit ac1b1ce

Browse files
authored
Refresh some flatbuffer code (#4745)
Regenerated with a new `flatc` version which generates nicer more 2024-edition-friendly edition code. --------- Signed-off-by: Adam Gutglick <[email protected]>
1 parent 6076181 commit ac1b1ce

File tree

8 files changed

+62
-75
lines changed

8 files changed

+62
-75
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
name: "Setup flatc"
22
description: "Download and install flatc binary"
3+
inputs:
4+
flatc_version:
5+
description: "Version of the flatc binary"
6+
default: "25.9.23"
37
runs:
48
using: "composite"
59
steps:
610
- name: Download flatc
711
id: download-flatc
812
shell: bash
913
run: |
10-
wget -O /tmp/flatc.zip https://github.com/google/flatbuffers/releases/download/v25.1.21/Linux.flatc.binary.clang++-18.zip
14+
wget -O /tmp/flatc.zip "https://github.com/google/flatbuffers/releases/download/v${{ inputs.flatc_version }}/Linux.flatc.binary.clang++-18.zip"
1115
unzip /tmp/flatc.zip flatc
1216
mv flatc /usr/local/bin/

vortex-flatbuffers/src/generated/array.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'a> flatbuffers::Follow<'a> for Compression {
5757
type Inner = Self;
5858
#[inline]
5959
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
60-
let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
60+
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) };
6161
Self(b)
6262
}
6363
}
@@ -66,7 +66,7 @@ impl flatbuffers::Push for Compression {
6666
type Output = Compression;
6767
#[inline]
6868
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
69-
flatbuffers::emplace_scalar::<u8>(dst, self.0);
69+
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
7070
}
7171
}
7272

@@ -142,7 +142,7 @@ impl<'a> flatbuffers::Follow<'a> for Precision {
142142
type Inner = Self;
143143
#[inline]
144144
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
145-
let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
145+
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) };
146146
Self(b)
147147
}
148148
}
@@ -151,7 +151,7 @@ impl flatbuffers::Push for Precision {
151151
type Output = Precision;
152152
#[inline]
153153
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
154-
flatbuffers::emplace_scalar::<u8>(dst, self.0);
154+
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
155155
}
156156
}
157157

@@ -206,21 +206,21 @@ impl<'a> flatbuffers::Follow<'a> for Buffer {
206206
type Inner = &'a Buffer;
207207
#[inline]
208208
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
209-
<&'a Buffer>::follow(buf, loc)
209+
unsafe { <&'a Buffer>::follow(buf, loc) }
210210
}
211211
}
212212
impl<'a> flatbuffers::Follow<'a> for &'a Buffer {
213213
type Inner = &'a Buffer;
214214
#[inline]
215215
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
216-
flatbuffers::follow_cast_ref::<Buffer>(buf, loc)
216+
unsafe { flatbuffers::follow_cast_ref::<Buffer>(buf, loc) }
217217
}
218218
}
219219
impl<'b> flatbuffers::Push for Buffer {
220220
type Output = Buffer;
221221
#[inline]
222222
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
223-
let src = ::core::slice::from_raw_parts(self as *const Buffer as *const u8, <Self as flatbuffers::Push>::size());
223+
let src = unsafe { ::core::slice::from_raw_parts(self as *const Buffer as *const u8, <Self as flatbuffers::Push>::size()) };
224224
dst.copy_from_slice(src);
225225
}
226226
#[inline]
@@ -390,7 +390,7 @@ impl<'a> flatbuffers::Follow<'a> for Array<'a> {
390390
type Inner = Array<'a>;
391391
#[inline]
392392
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
393-
Self { _tab: flatbuffers::Table::new(buf, loc) }
393+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
394394
}
395395
}
396396

@@ -506,7 +506,7 @@ impl<'a> flatbuffers::Follow<'a> for ArrayNode<'a> {
506506
type Inner = ArrayNode<'a>;
507507
#[inline]
508508
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
509-
Self { _tab: flatbuffers::Table::new(buf, loc) }
509+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
510510
}
511511
}
512512

@@ -671,7 +671,7 @@ impl<'a> flatbuffers::Follow<'a> for ArrayStats<'a> {
671671
type Inner = ArrayStats<'a>;
672672
#[inline]
673673
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
674-
Self { _tab: flatbuffers::Table::new(buf, loc) }
674+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
675675
}
676676
}
677677

@@ -979,14 +979,14 @@ pub fn size_prefixed_root_as_array_with_opts<'b, 'o>(
979979
/// # Safety
980980
/// Callers must trust the given bytes do indeed contain a valid `Array`.
981981
pub unsafe fn root_as_array_unchecked(buf: &[u8]) -> Array {
982-
flatbuffers::root_unchecked::<Array>(buf)
982+
unsafe { flatbuffers::root_unchecked::<Array>(buf) }
983983
}
984984
#[inline]
985985
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Array and returns it.
986986
/// # Safety
987987
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Array`.
988988
pub unsafe fn size_prefixed_root_as_array_unchecked(buf: &[u8]) -> Array {
989-
flatbuffers::size_prefixed_root_unchecked::<Array>(buf)
989+
unsafe { flatbuffers::size_prefixed_root_unchecked::<Array>(buf) }
990990
}
991991
#[inline]
992992
pub fn finish_array_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(

vortex-flatbuffers/src/generated/dtype.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl<'a> flatbuffers::Follow<'a> for PType {
9292
type Inner = Self;
9393
#[inline]
9494
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
95-
let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
95+
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) };
9696
Self(b)
9797
}
9898
}
@@ -101,7 +101,7 @@ impl flatbuffers::Push for PType {
101101
type Output = PType;
102102
#[inline]
103103
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
104-
flatbuffers::emplace_scalar::<u8>(dst, self.0);
104+
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
105105
}
106106
}
107107

@@ -213,7 +213,7 @@ impl<'a> flatbuffers::Follow<'a> for Type {
213213
type Inner = Self;
214214
#[inline]
215215
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
216-
let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
216+
let b = unsafe { flatbuffers::read_scalar_at::<u8>(buf, loc) };
217217
Self(b)
218218
}
219219
}
@@ -222,7 +222,7 @@ impl flatbuffers::Push for Type {
222222
type Output = Type;
223223
#[inline]
224224
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
225-
flatbuffers::emplace_scalar::<u8>(dst, self.0);
225+
unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
226226
}
227227
}
228228

@@ -264,7 +264,7 @@ impl<'a> flatbuffers::Follow<'a> for Null<'a> {
264264
type Inner = Null<'a>;
265265
#[inline]
266266
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
267-
Self { _tab: flatbuffers::Table::new(buf, loc) }
267+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
268268
}
269269
}
270270

@@ -343,7 +343,7 @@ impl<'a> flatbuffers::Follow<'a> for Bool<'a> {
343343
type Inner = Bool<'a>;
344344
#[inline]
345345
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
346-
Self { _tab: flatbuffers::Table::new(buf, loc) }
346+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
347347
}
348348
}
349349

@@ -440,7 +440,7 @@ impl<'a> flatbuffers::Follow<'a> for Primitive<'a> {
440440
type Inner = Primitive<'a>;
441441
#[inline]
442442
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
443-
Self { _tab: flatbuffers::Table::new(buf, loc) }
443+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
444444
}
445445
}
446446

@@ -554,7 +554,7 @@ impl<'a> flatbuffers::Follow<'a> for Decimal<'a> {
554554
type Inner = Decimal<'a>;
555555
#[inline]
556556
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
557-
Self { _tab: flatbuffers::Table::new(buf, loc) }
557+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
558558
}
559559
}
560560

@@ -685,7 +685,7 @@ impl<'a> flatbuffers::Follow<'a> for Utf8<'a> {
685685
type Inner = Utf8<'a>;
686686
#[inline]
687687
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
688-
Self { _tab: flatbuffers::Table::new(buf, loc) }
688+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
689689
}
690690
}
691691

@@ -782,7 +782,7 @@ impl<'a> flatbuffers::Follow<'a> for Binary<'a> {
782782
type Inner = Binary<'a>;
783783
#[inline]
784784
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
785-
Self { _tab: flatbuffers::Table::new(buf, loc) }
785+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
786786
}
787787
}
788788

@@ -879,7 +879,7 @@ impl<'a> flatbuffers::Follow<'a> for Struct_<'a> {
879879
type Inner = Struct_<'a>;
880880
#[inline]
881881
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
882-
Self { _tab: flatbuffers::Table::new(buf, loc) }
882+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
883883
}
884884
}
885885

@@ -1010,7 +1010,7 @@ impl<'a> flatbuffers::Follow<'a> for List<'a> {
10101010
type Inner = List<'a>;
10111011
#[inline]
10121012
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1013-
Self { _tab: flatbuffers::Table::new(buf, loc) }
1013+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
10141014
}
10151015
}
10161016

@@ -1124,7 +1124,7 @@ impl<'a> flatbuffers::Follow<'a> for FixedSizeList<'a> {
11241124
type Inner = FixedSizeList<'a>;
11251125
#[inline]
11261126
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1127-
Self { _tab: flatbuffers::Table::new(buf, loc) }
1127+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
11281128
}
11291129
}
11301130

@@ -1255,7 +1255,7 @@ impl<'a> flatbuffers::Follow<'a> for Extension<'a> {
12551255
type Inner = Extension<'a>;
12561256
#[inline]
12571257
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1258-
Self { _tab: flatbuffers::Table::new(buf, loc) }
1258+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
12591259
}
12601260
}
12611261

@@ -1386,7 +1386,7 @@ impl<'a> flatbuffers::Follow<'a> for DType<'a> {
13861386
type Inner = DType<'a>;
13871387
#[inline]
13881388
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
1389-
Self { _tab: flatbuffers::Table::new(buf, loc) }
1389+
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
13901390
}
13911391
}
13921392

@@ -1778,14 +1778,14 @@ pub fn size_prefixed_root_as_dtype_with_opts<'b, 'o>(
17781778
/// # Safety
17791779
/// Callers must trust the given bytes do indeed contain a valid `DType`.
17801780
pub unsafe fn root_as_dtype_unchecked(buf: &[u8]) -> DType {
1781-
flatbuffers::root_unchecked::<DType>(buf)
1781+
unsafe { flatbuffers::root_unchecked::<DType>(buf) }
17821782
}
17831783
#[inline]
17841784
/// Assumes, without verification, that a buffer of bytes contains a size prefixed DType and returns it.
17851785
/// # Safety
17861786
/// Callers must trust the given bytes do indeed contain a valid size prefixed `DType`.
17871787
pub unsafe fn size_prefixed_root_as_dtype_unchecked(buf: &[u8]) -> DType {
1788-
flatbuffers::size_prefixed_root_unchecked::<DType>(buf)
1788+
unsafe { flatbuffers::size_prefixed_root_unchecked::<DType>(buf) }
17891789
}
17901790
#[inline]
17911791
pub fn finish_dtype_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(

0 commit comments

Comments
 (0)