Skip to content

Commit e1b0eb4

Browse files
liuyihua-cnyangweijian
authored andcommitted
rename package to haizhi-rocksdb; fix test bug error; ignore doctest to avoid too many changes
1 parent 132acc6 commit e1b0eb4

34 files changed

+78
-43
lines changed

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "rocksdb"
2+
name = "haizhi-rocksdb"
33
description = "Rust wrapper for Facebook's RocksDB embeddable database"
44
version = "0.2.8"
55
edition = "2021"
@@ -52,3 +52,6 @@ tempfile = "3.1"
5252
pretty_assertions = "1.0"
5353
bincode = "1.3"
5454
serde = { version = "1", features = [ "derive" ] }
55+
56+
[lib]
57+
doctest = false

tests/fail/checkpoint_outlive_db.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use haizhi_rocksdb as rocksdb;
12
use rocksdb::{DB, checkpoint::Checkpoint};
23

34
fn main() {
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0597]: `db` does not live long enough
2-
--> tests/fail/checkpoint_outlive_db.rs:6:25
2+
--> tests/fail/checkpoint_outlive_db.rs:7:25
33
|
4-
4 | let _checkpoint = {
4+
5 | let _checkpoint = {
55
| ----------- borrow later stored here
6-
5 | let db = DB::open_default("foo").unwrap();
6+
6 | let db = DB::open_default("foo").unwrap();
77
| -- binding `db` declared here
8-
6 | Checkpoint::new(&db)
8+
7 | Checkpoint::new(&db)
99
| ^^^ borrowed value does not live long enough
10-
7 | };
10+
8 | };
1111
| - `db` dropped here while still borrowed

tests/fail/iterator_outlive_db.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use haizhi_rocksdb as rocksdb;
12
use rocksdb::{IteratorMode, DB};
23

34
fn main() {
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0597]: `db` does not live long enough
2-
--> tests/fail/iterator_outlive_db.rs:6:9
2+
--> tests/fail/iterator_outlive_db.rs:7:9
33
|
4-
4 | let _iter = {
4+
5 | let _iter = {
55
| ----- borrow later stored here
6-
5 | let db = DB::open_default("foo").unwrap();
6+
6 | let db = DB::open_default("foo").unwrap();
77
| -- binding `db` declared here
8-
6 | db.iterator(IteratorMode::Start)
8+
7 | db.iterator(IteratorMode::Start)
99
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
10-
7 | };
10+
8 | };
1111
| - `db` dropped here while still borrowed

tests/fail/open_with_multiple_refs_as_single_threaded.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use haizhi_rocksdb as rocksdb;
12
use rocksdb::{SingleThreaded, DBWithThreadMode, Options};
23

34
fn main() {
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
error[E0596]: cannot borrow `*db_ref1` as mutable, as it is behind a `&` reference
2-
--> tests/fail/open_with_multiple_refs_as_single_threaded.rs:8:5
2+
--> tests/fail/open_with_multiple_refs_as_single_threaded.rs:9:5
33
|
4-
8 | db_ref1.create_cf("cf1", &opts).unwrap();
4+
9 | db_ref1.create_cf("cf1", &opts).unwrap();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `db_ref1` is a `&` reference, so the data it refers to cannot be borrowed as mutable
66
|
77
help: consider changing this to be a mutable reference
88
|
9-
5 | let db_ref1 = &mut db;
9+
6 | let db_ref1 = &mut db;
1010
| ~~~~~~~
1111

1212
error[E0596]: cannot borrow `*db_ref2` as mutable, as it is behind a `&` reference
13-
--> tests/fail/open_with_multiple_refs_as_single_threaded.rs:9:5
14-
|
15-
9 | db_ref2.create_cf("cf2", &opts).unwrap();
16-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `db_ref2` is a `&` reference, so the data it refers to cannot be borrowed as mutable
17-
|
13+
--> tests/fail/open_with_multiple_refs_as_single_threaded.rs:10:5
14+
|
15+
10 | db_ref2.create_cf("cf2", &opts).unwrap();
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `db_ref2` is a `&` reference, so the data it refers to cannot be borrowed as mutable
17+
|
1818
help: consider changing this to be a mutable reference
19-
|
20-
6 | let db_ref2 = &mut db;
21-
| ~~~~~~~
19+
|
20+
7 | let db_ref2 = &mut db;
21+
| ~~~~~~~

tests/fail/snapshot_outlive_db.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use haizhi_rocksdb as rocksdb;
12
use rocksdb::DB;
23

34
fn main() {
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0597]: `db` does not live long enough
2-
--> tests/fail/snapshot_outlive_db.rs:6:9
2+
--> tests/fail/snapshot_outlive_db.rs:7:9
33
|
4-
4 | let _snapshot = {
4+
5 | let _snapshot = {
55
| --------- borrow later stored here
6-
5 | let db = DB::open_default("foo").unwrap();
6+
6 | let db = DB::open_default("foo").unwrap();
77
| -- binding `db` declared here
8-
6 | db.snapshot()
8+
7 | db.snapshot()
99
| ^^^^^^^^^^^^^ borrowed value does not live long enough
10-
7 | };
10+
8 | };
1111
| - `db` dropped here while still borrowed

tests/fail/snapshot_outlive_transaction.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use haizhi_rocksdb as rocksdb;
12
use rocksdb::{TransactionDB, SingleThreaded};
23

34
fn main() {

0 commit comments

Comments
 (0)