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