-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: refine Coprocessors' API #1180
Conversation
* Allow coprocessor to alloc their own global constants * Remove Coprocessor::eval_arity since the implementer already defines CoCircuit::arity
#[test] | ||
fn test_hello_world_lang() { | ||
use crate::coprocessor::test::HelloWorld; | ||
|
||
let mut lang = Lang::<Fr, HelloWorld<Fr>>::new(); | ||
let hello_world = HelloWorld::new(); | ||
let name = user_sym("hello-world"); | ||
|
||
let s = &Store::default(); | ||
lang.add_coprocessor(name, hello_world); | ||
|
||
let res = HelloWorld::intern_hello_world(s); | ||
let terminal = s.cont_terminal(); | ||
|
||
test_aux::<_, HelloWorld<_>>( | ||
s, | ||
"(hello-world)", | ||
Some(res), | ||
None, | ||
Some(terminal), | ||
None, | ||
&expect!["1"], | ||
&Some(lang.into()), | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test wouldn't pass without the new alloc_globals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I have to say though, that GlobalAllocator
could eventually be completely eliminated. A variable that is constrained to be a constant is really a waste, since we already have one such variable: one
. Any other constant variable can be derived from this by a simple linear combination: the constant multiplied by the variable one
. This is the third point in #1051
Closes #979