mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-10 05:43:53 +01:00
fix a deadlock when using recursive try
s
This commit is contained in:
parent
f9b62bcefd
commit
1f44b66f08
@ -11,7 +11,7 @@ repository = "https://github.com/Dummi26/mers"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
mers_lib = "0.8.0"
|
||||
# mers_lib = { path = "../mers_lib" }
|
||||
# mers_lib = "0.8.0"
|
||||
mers_lib = { path = "../mers_lib" }
|
||||
clap = { version = "4.3.19", features = ["derive"] }
|
||||
colored = "2.1.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "mers_lib"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "library to use the mers language in other projects"
|
||||
|
@ -33,8 +33,8 @@ impl MersStatement for Try {
|
||||
.collect::<Result<Vec<_>, CheckError>>()?;
|
||||
let mut index_lock = self.index_of_unused_try_statement.lock().unwrap();
|
||||
let mut unused_try_statements_lock = info.global.unused_try_statements.lock().unwrap();
|
||||
let used = if let Some(i) = *index_lock {
|
||||
&mut unused_try_statements_lock[i]
|
||||
let my_index = if let Some(i) = *index_lock {
|
||||
i
|
||||
} else {
|
||||
let my_index = unused_try_statements_lock.len();
|
||||
*index_lock = Some(my_index);
|
||||
@ -42,8 +42,9 @@ impl MersStatement for Try {
|
||||
self.pos_in_src.clone(),
|
||||
self.funcs.iter().map(|v| Some(v.source_range())).collect(),
|
||||
));
|
||||
&mut unused_try_statements_lock[my_index]
|
||||
my_index
|
||||
};
|
||||
drop(unused_try_statements_lock);
|
||||
drop(index_lock);
|
||||
for arg in arg.subtypes_type().types.iter() {
|
||||
let mut found = false;
|
||||
@ -79,7 +80,7 @@ impl MersStatement for Try {
|
||||
errs.push(err);
|
||||
} else {
|
||||
// found the function to use
|
||||
used.1[i] = None;
|
||||
info.global.unused_try_statements.lock().unwrap()[my_index].1[i] = None;
|
||||
found = true;
|
||||
t.add_all(&func_res);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user