about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/session/search_paths.rs4
-rw-r--r--src/test/compile-fail/manual-link-bad-search-path.rs15
2 files changed, 19 insertions, 0 deletions
diff --git a/src/librustc/session/search_paths.rs b/src/librustc/session/search_paths.rs
index f85fb303910..3c5d9744505 100644
--- a/src/librustc/session/search_paths.rs
+++ b/src/librustc/session/search_paths.rs
@@ -10,6 +10,7 @@
 
 use std::slice;
 use std::path::{Path, PathBuf};
+use session::early_error;
 
 #[derive(Clone, Debug)]
 pub struct SearchPaths {
@@ -50,6 +51,9 @@ impl SearchPaths {
         } else {
             (PathKind::All, path)
         };
+        if path.is_empty() {
+            early_error("empty search path given via `-L`");
+        }
         self.paths.push((kind, PathBuf::new(path)));
     }
 
diff --git a/src/test/compile-fail/manual-link-bad-search-path.rs b/src/test/compile-fail/manual-link-bad-search-path.rs
new file mode 100644
index 00000000000..2bf61cbe24c
--- /dev/null
+++ b/src/test/compile-fail/manual-link-bad-search-path.rs
@@ -0,0 +1,15 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:-L native=
+// error-pattern: empty search path given via `-L`
+
+fn main() {
+}