Browse Source

Allow sigma_compiler to be used in settings where it's not an explicit dependency in Cargo.toml

You can now use it in any context in which the name `sigma_compiler`
resolves to the correct crate, such as in the case of where that name is
re-exported from another crate (like the cmz crate) that depends on it.

That means you can list, for example, the cmz crate in your Cargo.toml
file _without_ having to also explicitly list sigma-compiler.
Ian Goldberg 1 week ago
parent
commit
f516821132
2 changed files with 2 additions and 0 deletions
  1. 1 0
      sigma-compiler-core/src/codegen.rs
  2. 1 0
      sigma-compiler-core/src/sigma/codegen.rs

+ 1 - 0
sigma-compiler-core/src/codegen.rs

@@ -507,6 +507,7 @@ impl CodeGen {
         quote! {
             #[allow(non_snake_case)]
             pub mod #proto_name {
+                use super::sigma_compiler;
                 use sigma_compiler::group::Group;
                 use sigma_compiler::group::ff::{Field, PrimeField};
                 use sigma_compiler::group::ff::derive::subtle::ConditionallySelectable;

+ 1 - 0
sigma-compiler-core/src/sigma/codegen.rs

@@ -724,6 +724,7 @@ impl<'a> CodeGen<'a> {
         quote! {
             #[allow(non_snake_case)]
             pub mod #proto_name {
+                use super::sigma_compiler;
                 use sigma_compiler::sigma_proofs;
                 use sigma_compiler::group::ff::PrimeField;
                 use sigma_compiler::rand::{CryptoRng, RngCore};