From e2d3d7e9b76233aac03055883ec5c3ad0efe9e1b Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Wed, 18 Oct 2023 20:35:57 +1100 Subject: [PATCH] Fix --- melior/src/context.rs | 4 ++-- melior/src/pass/manager.rs | 2 +- melior/src/pass/operation_manager.rs | 2 +- melior/src/string_ref.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/melior/src/context.rs b/melior/src/context.rs index 94008a5da8..93e0d7a8e6 100644 --- a/melior/src/context.rs +++ b/melior/src/context.rs @@ -48,7 +48,7 @@ impl Context { /// Gets or loads a dialect. pub fn get_or_load_dialect(&self, name: &'static str) -> Dialect { - let name = StringRef::from_static_str(name); + let name = StringRef::new(name); unsafe { Dialect::from_raw(mlirContextGetOrLoadDialect(self.raw, name.to_raw())) } } @@ -80,7 +80,7 @@ impl Context { /// Returns `true` if a given operation is registered in a context. pub fn is_registered_operation(&self, name: &'static str) -> bool { - let name = StringRef::from_static_str(name); + let name = StringRef::new(name); unsafe { mlirContextIsRegisteredOperation(self.raw, name.to_raw()) } } diff --git a/melior/src/pass/manager.rs b/melior/src/pass/manager.rs index f2bceb921e..a0c2dfe973 100644 --- a/melior/src/pass/manager.rs +++ b/melior/src/pass/manager.rs @@ -29,7 +29,7 @@ impl<'c> PassManager<'c> { /// Gets an operation pass manager for nested operations corresponding to a /// given name. pub fn nested_under(&self, name: &'static str) -> OperationPassManager { - let name = StringRef::from_static_str(name); + let name = StringRef::new(name); unsafe { OperationPassManager::from_raw(mlirPassManagerGetNestedUnder(self.raw, name.to_raw())) diff --git a/melior/src/pass/operation_manager.rs b/melior/src/pass/operation_manager.rs index 7d71161f60..d7e14c1484 100644 --- a/melior/src/pass/operation_manager.rs +++ b/melior/src/pass/operation_manager.rs @@ -21,7 +21,7 @@ impl<'c, 'a> OperationPassManager<'c, 'a> { /// Gets an operation pass manager for nested operations corresponding to a /// given name. pub fn nested_under(&self, name: &'static str) -> Self { - let name = StringRef::from_static_str(name); + let name = StringRef::new(name); unsafe { Self::from_raw(mlirOpPassManagerGetNestedUnder(self.raw, name.to_raw())) } } diff --git a/melior/src/string_ref.rs b/melior/src/string_ref.rs index b590a4c2c1..3f48085763 100644 --- a/melior/src/string_ref.rs +++ b/melior/src/string_ref.rs @@ -20,8 +20,8 @@ pub struct StringRef<'c> { } impl<'c> StringRef<'c> { - /// Converts a string into a string reference. - pub fn from_static_str(string: &'c str) -> Self { + /// Creates a string reference. + pub fn new(string: &'c str) -> Self { let string = MlirStringRef { data: string.as_bytes().as_ptr() as *const i8, length: string.len(),