Squashed 'third_party/rules_rust/' content from commit bf59038ca

git-subtree-dir: third_party/rules_rust
git-subtree-split: bf59038cac11798cbaef9f3bf965bad8182b97fa
Signed-off-by: Brian Silverman <bsilver16384@gmail.com>
Change-Id: I5a20e403203d670df467ea97dde9a4ac40339a8d
diff --git a/examples/env_locations/main.rs b/examples/env_locations/main.rs
new file mode 100644
index 0000000..3b07b1d
--- /dev/null
+++ b/examples/env_locations/main.rs
@@ -0,0 +1,12 @@
+#[test]
+fn test() {
+    // our source file should be readable
+    let source_file = std::fs::read_to_string(env!("SOURCE_FILE")).unwrap();
+    assert_eq!(source_file, "source\n");
+    // our generated data file should be readable at run time and build time
+    let generated_data = std::fs::read_to_string(env!("GENERATED_DATA_ROOT")).unwrap();
+    let generated_data2 = include_str!(env!("GENERATED_DATA_ABS"));
+    assert_eq!(generated_data, generated_data2);
+    // and we should be able to read (and thus execute) our tool
+    assert!(!std::fs::read(env!("SOME_TOOL")).unwrap().is_empty());
+}