Skip to content

Commit a986f88

Browse files
committed
leak re-pattern result; tag 0.8.51-a2
1 parent 9431bcb commit a986f88

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.github/workflows/check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
- uses: calcit-lang/[email protected]
1818
with:
19-
version: "0.8.51-a1"
19+
version: "0.8.51-a2"
2020

2121
- uses: dtolnay/rust-toolchain@stable
2222
with:

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "calcit_regex"
3-
version = "0.0.5-a1"
3+
version = "0.0.5-a2"
44
authors = ["jiyinyiyong <[email protected]>"]
55
edition = "2021"
66

@@ -13,7 +13,7 @@ crate-type = ["dylib"] # Creates dynamic lib
1313
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1414

1515
[dependencies]
16-
cirru_edn = "0.6.4-a1"
16+
cirru_edn = "0.6.4-a2"
1717
# cirru_edn = { path = "/Users/chenyong/repo/cirru/edn.rs" }
1818
cirru_parser = "0.1.29"
1919
regex = "1.10.4"

src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ pub fn re_pattern(args: Vec<Edn>) -> Result<Edn, String> {
1313
if args.len() == 1 {
1414
match &args[0] {
1515
Edn::Str(s) => match Regex::new(s) {
16-
Ok(pattern) => Ok(Edn::AnyRef(EdnAnyRef(Arc::from(pattern)))),
16+
Ok(pattern) => {
17+
let p = Arc::from(pattern);
18+
let p2 = p.to_owned();
19+
// std::mem::forget(p);
20+
Ok(Edn::AnyRef(EdnAnyRef(p2)))
21+
}
1722
Err(e) => Err(format!("re-pattern failed, {}", e)),
1823
},
1924
_ => Err(format!("re-pattern expect 1 string, got {:?}", args)),

0 commit comments

Comments
 (0)