You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/09/09 02:31:18 UTC

[GitHub] [incubator-tvm] imalsogreg commented on a change in pull request #6401: [Rust] Improve the error reporting in build.rs files by using anyhow.

imalsogreg commented on a change in pull request #6401:
URL: https://github.com/apache/incubator-tvm/pull/6401#discussion_r485301026



##########
File path: rust/tvm-sys/build.rs
##########
@@ -19,22 +19,39 @@
 
 extern crate bindgen;
 
+use std::env;
 use std::path::PathBuf;
 
-use std::env;
+use anyhow::{Context, Result};
 
-fn main() {
+fn main() -> Result<()> {
     let tvm_home = option_env!("TVM_HOME").map(str::to_string).unwrap_or({
         let crate_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
             .canonicalize()
-            .unwrap();
+            .with_context(|| {
+                format!(
+                    "failed to cannonicalize() CARGO MANIFEST_DIR={}",

Review comment:
       Dropped the `_` between `CARGO` and `MANIFEST_DIR`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org