about summary refs log tree commit diff
path: root/src/comp/back
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-01-30 21:00:57 -0800
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-01-31 10:08:24 -0800
commitfba35e1a3c87892823d1f4d436b9f00a7864cf16 (patch)
tree1fadaaee99ef266bd2f709fb2aa5577184ab611e /src/comp/back
parent813a55d89135efb716dd80e96453a091a7cfc631 (diff)
downloadrust-fba35e1a3c87892823d1f4d436b9f00a7864cf16.tar.gz
rust-fba35e1a3c87892823d1f4d436b9f00a7864cf16.zip
Require alts to be exhaustive
middle::check_alt does the work. Lots of changes to add default cases
into alts that were previously inexhaustive.
Diffstat (limited to 'src/comp/back')
-rw-r--r--src/comp/back/rpath.rs29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/comp/back/rpath.rs b/src/comp/back/rpath.rs
index b848ca94590..a2030e10fab 100644
--- a/src/comp/back/rpath.rs
+++ b/src/comp/back/rpath.rs
@@ -11,6 +11,13 @@ import util::filesearch;
 
 export get_rpath_flags;
 
+pure fn not_win32(os: session::os) -> bool {
+  alt os {
+      session::os_win32 { false }
+      _ { true }
+  }
+}
+
 fn get_rpath_flags(sess: session::session, out_filename: str) -> [str] {
     let os = sess.targ_cfg.os;
 
@@ -99,12 +106,13 @@ fn get_rpaths_relative_to_output(os: session::os,
 fn get_rpath_relative_to_output(os: session::os,
                                 cwd: fs::path,
                                 output: fs::path,
-                                &&lib: fs::path) -> str {
+                                &&lib: fs::path) : not_win32(os) -> str {
     // Mac doesn't appear to support $ORIGIN
     let prefix = alt os {
         session::os_linux { "$ORIGIN" + fs::path_sep() }
         session::os_freebsd { "$ORIGIN" + fs::path_sep() }
         session::os_macos { "@executable_path" + fs::path_sep() }
+        session::os_win32 { std::util::unreachable(); }
     };
 
     prefix + get_relative_to(
@@ -309,24 +317,31 @@ mod test {
     #[test]
     #[cfg(target_os = "linux")]
     fn test_rpath_relative() {
-        let res = get_rpath_relative_to_output(session::os_linux,
+      let o = session::os_linux;
+      check not_win32(o);
+      let res = get_rpath_relative_to_output(o,
             "/usr", "bin/rustc", "lib/libstd.so");
-        assert res == "$ORIGIN/../lib";
+      assert res == "$ORIGIN/../lib";
     }
 
     #[test]
     #[cfg(target_os = "freebsd")]
     fn test_rpath_relative() {
-        let res = get_rpath_relative_to_output(session::os_freebsd,
+      let o = session::os_freebsd;
+      check not_win32(o);
+      let res = get_rpath_relative_to_output(o,
             "/usr", "bin/rustc", "lib/libstd.so");
-        assert res == "$ORIGIN/../lib";
+      assert res == "$ORIGIN/../lib";
     }
 
     #[test]
     #[cfg(target_os = "macos")]
     fn test_rpath_relative() {
-        let res = get_rpath_relative_to_output(session::os_macos,
-            "/usr", "bin/rustc", "lib/libstd.so");
+      // this is why refinements would be nice
+      let o = session::os_macos;
+      check not_win32(o);
+      let res = get_rpath_relative_to_output(o, "/usr", "bin/rustc",
+                                             "lib/libstd.so");
         assert res == "@executable_path/../lib";
     }