From 25a53039232ef3993d13145f7ed4e6c9e16c287c Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Wed, 24 Aug 2022 16:46:55 +0200 Subject: [PATCH 1/2] improved lib dir error msg --- crates/compiler/builtins/src/bitcode.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/compiler/builtins/src/bitcode.rs b/crates/compiler/builtins/src/bitcode.rs index 94ef5be80d..f94a5aa86b 100644 --- a/crates/compiler/builtins/src/bitcode.rs +++ b/crates/compiler/builtins/src/bitcode.rs @@ -3,10 +3,10 @@ use roc_target::TargetInfo; use roc_utils::get_lib_path; use std::ops::Index; +const LIB_DIR_ERROR: &'static str = "Failed to find the lib directory. Did you copy the roc binary without also copying the lib directory?\nIf you built roc from source, the lib dir should be in target/release.\nIf not, the lib dir should be included in the release tar.gz file."; + pub fn get_builtins_host_obj_path() -> String { - let builtins_host_path = get_lib_path() - .expect("Failed to find lib dir.") - .join("builtins-host.o"); + let builtins_host_path = get_lib_path().expect(LIB_DIR_ERROR).join("builtins-host.o"); builtins_host_path .into_os_string() @@ -16,7 +16,7 @@ pub fn get_builtins_host_obj_path() -> String { pub fn get_builtins_wasm32_obj_path() -> String { let builtins_wasm32_path = get_lib_path() - .expect("Failed to find lib dir.") + .expect(LIB_DIR_ERROR) .join("builtins-wasm32.o"); builtins_wasm32_path From 53aa346f4783c54b10eec7fa435d189704c85e32 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Wed, 24 Aug 2022 17:32:36 +0200 Subject: [PATCH 2/2] clippy --- crates/compiler/builtins/src/bitcode.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/compiler/builtins/src/bitcode.rs b/crates/compiler/builtins/src/bitcode.rs index f94a5aa86b..e44ecc0f9e 100644 --- a/crates/compiler/builtins/src/bitcode.rs +++ b/crates/compiler/builtins/src/bitcode.rs @@ -3,7 +3,7 @@ use roc_target::TargetInfo; use roc_utils::get_lib_path; use std::ops::Index; -const LIB_DIR_ERROR: &'static str = "Failed to find the lib directory. Did you copy the roc binary without also copying the lib directory?\nIf you built roc from source, the lib dir should be in target/release.\nIf not, the lib dir should be included in the release tar.gz file."; +const LIB_DIR_ERROR: &str = "Failed to find the lib directory. Did you copy the roc binary without also copying the lib directory?\nIf you built roc from source, the lib dir should be in target/release.\nIf not, the lib dir should be included in the release tar.gz file."; pub fn get_builtins_host_obj_path() -> String { let builtins_host_path = get_lib_path().expect(LIB_DIR_ERROR).join("builtins-host.o");