]> git.lizzy.rs Git - rust.git/commitdiff
Fix and add tests regarding extern crate paths
authormitaa <mitaa.ceb@gmail.com>
Sat, 1 Aug 2015 17:41:01 +0000 (19:41 +0200)
committermitaa <mitaa.ceb@gmail.com>
Sat, 1 Aug 2015 17:41:01 +0000 (19:41 +0200)
src/test/compile-fail/issue-12997-2.rs
src/test/compile-fail/issue-1920-1.rs [new file with mode: 0644]
src/test/compile-fail/issue-1920-2.rs [new file with mode: 0644]
src/test/compile-fail/issue-1920-3.rs [new file with mode: 0644]
src/test/compile-fail/privacy5.rs
src/test/compile-fail/struct-field-privacy.rs
src/test/compile-fail/suggest-private-fields.rs

index 1cf534e7e419db0b0403181a71ac5d36dd8fc10b..8b467c2ba11f93a475a3c19e0cee5c5d5942bbed 100644 (file)
@@ -15,7 +15,7 @@
 #[bench]
 fn bar(x: isize) { }
 //~^ ERROR mismatched types
-//~| expected `fn(&mut test::Bencher)`
+//~| expected `fn(&mut __test::test::Bencher)`
 //~| found `fn(isize) {bar}`
 //~| expected &-ptr
 //~| found isize
diff --git a/src/test/compile-fail/issue-1920-1.rs b/src/test/compile-fail/issue-1920-1.rs
new file mode 100644 (file)
index 0000000..c26c5ff
--- /dev/null
@@ -0,0 +1,22 @@
+// 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.
+
+//! Test that absolute path names are correct when a crate is not linked into the root namespace
+
+mod foo {
+    extern crate core;
+}
+
+fn assert_clone<T>() where T : Clone { }
+
+fn main() {
+    assert_clone::<foo::core::atomic::AtomicBool>();
+    //~^ ERROR the trait `foo::core::clone::Clone` is not implemented for the type `foo::core::
+}
\ No newline at end of file
diff --git a/src/test/compile-fail/issue-1920-2.rs b/src/test/compile-fail/issue-1920-2.rs
new file mode 100644 (file)
index 0000000..63cfcbd
--- /dev/null
@@ -0,0 +1,20 @@
+// 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.
+
+//! Test that when a crate is linked under another name that that name is used in global paths
+
+extern crate core as bar;
+
+fn assert_clone<T>() where T : Clone { }
+
+fn main() {
+    assert_clone::<bar::atomic::AtomicBool>();
+    //~^ ERROR the trait `bar::clone::Clone` is not implemented for the type `bar::atomic::
+}
\ No newline at end of file
diff --git a/src/test/compile-fail/issue-1920-3.rs b/src/test/compile-fail/issue-1920-3.rs
new file mode 100644 (file)
index 0000000..619c8c3
--- /dev/null
@@ -0,0 +1,24 @@
+// 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.
+
+//! Test that when a crate is linked multiple times that the shortest absolute path name is used
+
+mod foo {
+    extern crate core;
+}
+
+extern crate core;
+
+fn assert_clone<T>() where T : Clone { }
+
+fn main() {
+    assert_clone::<foo::core::atomic::AtomicBool>();
+    //~^ ERROR the trait `core::clone::Clone` is not implemented for the type `core::atomic::
+}
\ No newline at end of file
index 4ca37fc2ad209f6fd1eaab56f01bf0e80b156759..83e13ff52f69a80c08498de47f1ab90d7fd59984 100644 (file)
@@ -101,30 +101,30 @@ fn xcrate() {
     let c = other::C(2, 3); //~ ERROR: cannot invoke tuple struct constructor
     let d = other::D(4);
 
-    let other::A(()) = a; //~ ERROR: field #1 of struct `privacy_tuple_struct::A` is private
+    let other::A(()) = a; //~ ERROR: field #1 of struct `other::A` is private
     let other::A(_) = a;
     match a { other::A(()) => {} }
-    //~^ ERROR: field #1 of struct `privacy_tuple_struct::A` is private
+    //~^ ERROR: field #1 of struct `other::A` is private
     match a { other::A(_) => {} }
 
     let other::B(_) = b;
-    let other::B(_b) = b; //~ ERROR: field #1 of struct `privacy_tuple_struct::B` is private
+    let other::B(_b) = b; //~ ERROR: field #1 of struct `other::B` is private
     match b { other::B(_) => {} }
     match b { other::B(_b) => {} }
-    //~^ ERROR: field #1 of struct `privacy_tuple_struct::B` is private
+    //~^ ERROR: field #1 of struct `other::B` is private
     match b { other::B(1) => {} other::B(_) => {} }
-    //~^ ERROR: field #1 of struct `privacy_tuple_struct::B` is private
+    //~^ ERROR: field #1 of struct `other::B` is private
 
     let other::C(_, _) = c;
     let other::C(_a, _) = c;
-    let other::C(_, _b) = c; //~ ERROR: field #2 of struct `privacy_tuple_struct::C` is private
-    let other::C(_a, _b) = c; //~ ERROR: field #2 of struct `privacy_tuple_struct::C` is private
+    let other::C(_, _b) = c; //~ ERROR: field #2 of struct `other::C` is private
+    let other::C(_a, _b) = c; //~ ERROR: field #2 of struct `other::C` is private
     match c { other::C(_, _) => {} }
     match c { other::C(_a, _) => {} }
     match c { other::C(_, _b) => {} }
-    //~^ ERROR: field #2 of struct `privacy_tuple_struct::C` is private
+    //~^ ERROR: field #2 of struct `other::C` is private
     match c { other::C(_a, _b) => {} }
-    //~^ ERROR: field #2 of struct `privacy_tuple_struct::C` is private
+    //~^ ERROR: field #2 of struct `other::C` is private
 
     let other::D(_) = d;
     let other::D(_d) = d;
index a1b6b9a744c72c56da60b731c7d86318f7ea5044..aae09cc0eae5cb985376d02a0697dced7c56e5a4 100644 (file)
@@ -37,11 +37,11 @@ fn test(a: A, b: inner::A, c: inner::B, d: xc::A, e: xc::B) {
     c.a;
     c.b; //~ ERROR: field `b` of struct `inner::B` is private
 
-    d.a; //~ ERROR: field `a` of struct `struct_field_privacy::A` is private
+    d.a; //~ ERROR: field `a` of struct `xc::A` is private
     d.b;
 
     e.a;
-    e.b; //~ ERROR: field `b` of struct `struct_field_privacy::B` is private
+    e.b; //~ ERROR: field `b` of struct `xc::B` is private
 }
 
 fn main() {}
index f987257d4eea93fc06ac32c7818c6e9d5dad25da..8bc8a7a60bdd369695685297fef357360ea48866 100644 (file)
@@ -22,9 +22,9 @@ struct A {
 fn main () {
     // external crate struct
     let k = B {
-        aa: 20, //~ ERROR structure `struct_field_privacy::B` has no field named `aa`
+        aa: 20, //~ ERROR structure `xc::B` has no field named `aa`
         //~^ HELP did you mean `a`?
-        bb: 20, //~ ERROR structure `struct_field_privacy::B` has no field named `bb`
+        bb: 20, //~ ERROR structure `xc::B` has no field named `bb`
     };
     // local crate struct
     let l = A {