Skip to content

Commit

Permalink
[rust] convert error msg to string for panic macro
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfu committed Jun 22, 2021
1 parent 841e195 commit 4cf8d55
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rust/tvm-macros/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ pub(crate) fn attr_to_str(attr: &syn::Attribute) -> syn::LitStr {
..
})) => s,
Ok(m) => panic!("Expected a string literal, got {:?}", m),
Err(e) => panic!(e),
Err(e) => panic!("{}", e),
}
}
2 changes: 1 addition & 1 deletion rust/tvm-rt/src/object/object_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl Object {
let mut index = 0;
unsafe {
if TVMObjectTypeKey2Index(cstring.as_ptr(), &mut index) != 0 {
panic!(crate::get_last_error())
panic!("{}", crate::get_last_error())
}
}
return index;
Expand Down
2 changes: 1 addition & 1 deletion rust/tvm/src/ir/diagnostics/codespan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ fn renderer(state: &mut DiagnosticState, diag_ctx: DiagnosticContext) {
let config = codespan_reporting::term::Config::default();
for diagnostic in diag_ctx.diagnostics.clone() {
match source_map.source_map.get(&diagnostic.span.source_name) {
Err(err) => panic!(err),
Err(err) => panic!("{}", err),
Ok(source) => {
state.add_source(source);
let diagnostic = state.to_diagnostic(diagnostic);
Expand Down

0 comments on commit 4cf8d55

Please sign in to comment.