Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: noir-lang/noir
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 753e52fc7d6235311e0211c7c275a9aeb311c9b9
Choose a base ref
..
head repository: noir-lang/noir
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fcc4e3e4f1ffccf1a5bd6516893ed66d03a4eac0
Choose a head ref
4 changes: 2 additions & 2 deletions crates/lsp/src/lib.rs
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@ fn on_code_lens_request(
async move {
// TODO: Requiring `Language` and `is_opcode_supported` to construct a driver makes for some real stinky code
// The driver should not require knowledge of the backend; instead should be implemented as an independent pass (in nargo?)
let mut driver = Driver::new(&Language::R1CS, Box::new(|_op| false));
let mut driver = Driver::new(Language::R1CS, Box::new(|_op| false));

let file_path = &params.text_document.uri.to_file_path().unwrap();

@@ -224,7 +224,7 @@ fn on_did_save_text_document(
) -> ControlFlow<Result<(), async_lsp::Error>> {
// TODO: Requiring `Language` and `is_opcode_supported` to construct a driver makes for some real stinky code
// The driver should not require knowledge of the backend; instead should be implemented as an independent pass (in nargo?)
let mut driver = Driver::new(&Language::R1CS, Box::new(|_op| false));
let mut driver = Driver::new(Language::R1CS, Box::new(|_op| false));

let file_path = &params.text_document.uri.to_file_path().unwrap();

2 changes: 1 addition & 1 deletion crates/nargo_cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
@@ -179,7 +179,7 @@ mod tests {
/// This is used for tests.
fn file_compiles<P: AsRef<Path>>(root_file: P) -> bool {
let mut driver = Driver::new(
&acvm::Language::R1CS,
acvm::Language::R1CS,
#[allow(deprecated)]
Box::new(acvm::pwg::default_is_opcode_supported(acvm::Language::R1CS)),
);
2 changes: 1 addition & 1 deletion crates/nargo_cli/src/resolver.rs
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ impl<'a> Resolver<'a> {
np_language: Language,
is_opcode_supported: Box<dyn Fn(&Opcode) -> bool>,
) -> Result<Driver, DependencyResolutionError> {
let mut driver = Driver::new(&np_language, is_opcode_supported);
let mut driver = Driver::new(np_language, is_opcode_supported);
let (entry_path, crate_type) = super::lib_or_bin(dir_path)?;

let manifest_path = super::find_package_manifest(dir_path)?;
14 changes: 6 additions & 8 deletions crates/noirc_driver/src/lib.rs
Original file line number Diff line number Diff line change
@@ -73,8 +73,8 @@ pub type Warnings = Vec<FileDiagnostic>;
pub type ErrorsAndWarnings = Vec<FileDiagnostic>;

impl Driver {
pub fn new(language: &Language, is_opcode_supported: Box<dyn Fn(&Opcode) -> bool>) -> Self {
Driver { context: Context::default(), language: language.clone(), is_opcode_supported }
pub fn new(language: Language, is_opcode_supported: Box<dyn Fn(&Opcode) -> bool>) -> Self {
Driver { context: Context::default(), language, is_opcode_supported }
}

// TODO(#1599): Move control of the FileManager into nargo
@@ -86,7 +86,7 @@ impl Driver {
// with the restricted version which only uses one file
pub fn compile_file(
root_file: PathBuf,
language: &Language,
language: Language,
is_opcode_supported: Box<dyn Fn(&Opcode) -> bool>,
) -> Result<(CompiledProgram, Warnings), ErrorsAndWarnings> {
let mut driver = Driver::new(language, is_opcode_supported);
@@ -345,20 +345,18 @@ impl Driver {
) -> Result<CompiledProgram, FileDiagnostic> {
let program = monomorphize(main_function, &self.context.def_interner);

let np_language = self.language.clone();

let circuit_abi = if options.experimental_ssa {
experimental_create_circuit(
program,
np_language,
self.language,
&self.is_opcode_supported,
options.show_ssa,
options.show_output,
)
} else {
create_circuit(
program,
np_language,
self.language,
&self.is_opcode_supported,
options.show_ssa,
options.show_output,
@@ -408,6 +406,6 @@ impl Driver {
impl Default for Driver {
fn default() -> Self {
#[allow(deprecated)]
Self::new(&Language::R1CS, Box::new(acvm::pwg::default_is_opcode_supported(Language::R1CS)))
Self::new(Language::R1CS, Box::new(acvm::pwg::default_is_opcode_supported(Language::R1CS)))
}
}
2 changes: 1 addition & 1 deletion crates/noirc_driver/src/main.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ fn main() {
const ROOT_DIR_MAIN: &str = "example_real_project/main.nr";

let mut driver = Driver::new(
&Language::R1CS,
Language::R1CS,
#[allow(deprecated)]
Box::new(acvm::pwg::default_is_opcode_supported(Language::R1CS)),
);
2 changes: 1 addition & 1 deletion crates/noirc_evaluator/src/ssa/acir_gen/operations/sort.rs
Original file line number Diff line number Diff line change
@@ -192,7 +192,7 @@ mod test {
}
// compute the network output by solving the constraints
let backend = MockBackend {};
let acvm = ACVM::new(backend, eval.opcodes.clone(), initial_witness);
let mut acvm = ACVM::new(backend, eval.opcodes.clone(), initial_witness);
let solver_status = acvm.solve().expect("Could not solve permutation constraints");
assert_eq!(solver_status, PartialWitnessGeneratorStatus::Solved, "Incomplete solution");
let solved_witness = acvm.finalize();