]> git.lizzy.rs Git - rust.git/commitdiff
Add tests that the injected runtime is inaccessible
authorBrian Anderson <banderson@mozilla.com>
Fri, 25 Jul 2014 22:26:51 +0000 (15:26 -0700)
committerBrian Anderson <banderson@mozilla.com>
Fri, 25 Jul 2014 23:54:09 +0000 (16:54 -0700)
src/test/compile-fail/hidden-rt-injection.rs [new file with mode: 0644]
src/test/compile-fail/hidden-rt-injection2.rs [new file with mode: 0644]

diff --git a/src/test/compile-fail/hidden-rt-injection.rs b/src/test/compile-fail/hidden-rt-injection.rs
new file mode 100644 (file)
index 0000000..a27a846
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2014 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.
+
+// This is testing that users can't access the runtime crate.
+
+mod m {
+    // The rt has been called both 'native' and 'rt'
+    use native; //~ ERROR unresolved import
+}
+
+fn main() { }
diff --git a/src/test/compile-fail/hidden-rt-injection2.rs b/src/test/compile-fail/hidden-rt-injection2.rs
new file mode 100644 (file)
index 0000000..fa6584d
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 2014 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.
+
+// This is testing that users can't access the runtime crate.
+
+mod m {
+    // The rt has been called both 'native' and 'rt'
+    use rt; //~ ERROR unresolved import
+}
+
+fn main() { }