Skip to content

Commit

Permalink
[rust] convert error msg to string for panic macro (apache#8289)
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfu authored and ylc committed Sep 29, 2021
1 parent 58c41f1 commit da0646b
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 da0646b

Please sign in to comment.