Skip to content

Commit 777df4e

Browse files
committed
Fixed error with Rice 4.7
1 parent 6af9d15 commit 777df4e

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.3 (unreleased)
2+
3+
- Fixed error with Rice 4.7
4+
15
## 0.4.2 (2025-08-13)
26

37
- Updated Faiss to 1.12.0

ext/faiss/index.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace Rice::detail {
2929
public:
3030
From_Ruby() = default;
3131

32-
From_Ruby(Arg* arg) : arg_(arg) {}
32+
explicit From_Ruby(Arg* arg) : arg_(arg) { }
3333

3434
Convertible is_convertible(VALUE value) { return Convertible::Cast; }
3535

@@ -49,7 +49,7 @@ namespace Rice::detail {
4949
}
5050

5151
private:
52-
Arg* arg_;
52+
Arg* arg_ = nullptr;
5353
};
5454

5555
template<>
@@ -60,6 +60,10 @@ namespace Rice::detail {
6060
template<>
6161
class From_Ruby<faiss::ScalarQuantizer::QuantizerType> {
6262
public:
63+
From_Ruby() = default;
64+
65+
explicit From_Ruby(Arg* arg) : arg_(arg) { }
66+
6367
Convertible is_convertible(VALUE value) { return Convertible::Cast; }
6468

6569
faiss::ScalarQuantizer::QuantizerType convert(VALUE x) {
@@ -82,6 +86,9 @@ namespace Rice::detail {
8286
throw Rice::Exception(rb_eArgError, "Invalid quantizer type: %s", s.c_str());
8387
}
8488
}
89+
90+
private:
91+
Arg* arg_ = nullptr;
8592
};
8693
} // namespace Rice::detail
8794

@@ -134,8 +141,8 @@ void init_index(Rice::Module& m) {
134141
self.search(n, objects.read_ptr(), k, distances.write_ptr(), labels.write_ptr());
135142

136143
Rice::Array ret;
137-
ret.push(distances);
138-
ret.push(labels);
144+
ret.push(std::move(distances), false);
145+
ret.push(std::move(labels), false);
139146
return ret;
140147
})
141148
.define_method(

ext/faiss/index_binary.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ void init_index_binary(Rice::Module& m) {
4848
self.search(n, objects.read_ptr(), k, distances.write_ptr(), labels.write_ptr());
4949

5050
Rice::Array ret;
51-
ret.push(distances);
52-
ret.push(labels);
51+
ret.push(std::move(distances), false);
52+
ret.push(std::move(labels), false);
5353
return ret;
5454
})
5555
.define_method(

faiss.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ Gem::Specification.new do |spec|
1616

1717
spec.required_ruby_version = ">= 3.2"
1818

19-
spec.add_dependency "rice", ">= 4.5"
19+
spec.add_dependency "rice", ">= 4.7"
2020
spec.add_dependency "numo-narray"
2121
end

0 commit comments

Comments
 (0)