From cb33aab3e143e20e064387c8c2cc732dba3fd4fa Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Wed, 18 Oct 2023 16:14:39 +1100 Subject: [PATCH] Revert "TEST" This reverts commit 69cc1a4779a9d272d35c9707450c6d4c1a13f8d7. --- melior/src/ir/module.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/melior/src/ir/module.rs b/melior/src/ir/module.rs index ad0f8c47a0..0bf8d654c6 100644 --- a/melior/src/ir/module.rs +++ b/melior/src/ir/module.rs @@ -7,7 +7,7 @@ use mlir_sys::{ mlirModuleCreateEmpty, mlirModuleCreateParse, mlirModuleDestroy, mlirModuleFromOperation, mlirModuleGetBody, mlirModuleGetContext, mlirModuleGetOperation, MlirModule, }; -use std::{ffi::CString, marker::PhantomData, mem::forget}; +use std::{ffi::CString, marker::PhantomData}; /// A module. #[derive(Debug)] @@ -24,16 +24,10 @@ impl<'c> Module<'c> { /// Parses a module. pub fn parse(context: &Context, source: &str) -> Option { - let string = CString::new(source).unwrap(); - let source = StringRef::from_c_str(&string); + let source = CString::new(source).unwrap(); + let source = StringRef::from_c_str(&source); - let module = unsafe { - Self::from_option_raw(mlirModuleCreateParse(context.to_raw(), source.to_raw())) - }; - - forget(string); - - module + unsafe { Self::from_option_raw(mlirModuleCreateParse(context.to_raw(), source.to_raw())) } } /// Converts a module into an operation.