Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe committed Oct 18, 2023
1 parent 1890415 commit e2d3d7e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions melior/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())) }
}
Expand Down Expand Up @@ -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()) }
}
Expand Down
2 changes: 1 addition & 1 deletion melior/src/pass/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
2 changes: 1 addition & 1 deletion melior/src/pass/operation_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())) }
}
Expand Down
4 changes: 2 additions & 2 deletions melior/src/string_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit e2d3d7e

Please sign in to comment.