]> git.lizzy.rs Git - rust.git/commitdiff
Fix fallout from allowing impls outside of the type's definition module.
authorEduard Burtescu <edy.burt@gmail.com>
Fri, 20 Feb 2015 09:36:31 +0000 (11:36 +0200)
committerEduard Burtescu <edy.burt@gmail.com>
Tue, 24 Feb 2015 12:16:02 +0000 (14:16 +0200)
src/librustc_typeck/coherence/orphan.rs
src/test/compile-fail/issue-12729.rs [deleted file]
src/test/compile-fail/issue-7607-2.rs [deleted file]
src/test/run-pass/issue-12729.rs [new file with mode: 0644]
src/test/run-pass/issue-7607-2.rs [new file with mode: 0644]
src/test/run-pass/trait-impl-2.rs

index 34fadc70af8b7548f8982ea5e29ad7f2a1c3fc5d..465b3c8e3ac1eb888ac8abd19886c1677b14453a 100644 (file)
@@ -15,7 +15,6 @@
 use middle::ty;
 use syntax::ast::{Item, ItemImpl};
 use syntax::ast;
-use syntax::ast_map;
 use syntax::ast_util;
 use syntax::visit;
 use util::ppaux::{Repr, UserString};
diff --git a/src/test/compile-fail/issue-12729.rs b/src/test/compile-fail/issue-12729.rs
deleted file mode 100644 (file)
index ae033bb..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 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.
-
-// ignore-tidy-linelength
-
-pub struct Foo;
-
-mod bar {
-    use Foo;
-
-    impl Foo { //~ERROR inherent implementations are only allowed on types defined in the current module
-        fn baz(&self) {}
-    }
-}
-fn main() {}
-
diff --git a/src/test/compile-fail/issue-7607-2.rs b/src/test/compile-fail/issue-7607-2.rs
deleted file mode 100644 (file)
index 9541899..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2012 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.
-
-// ignore-tidy-linelength
-
-pub mod a {
-    pub struct Foo { a: usize }
-}
-
-pub mod b {
-    use a::Foo;
-    impl Foo { //~ERROR inherent implementations are only allowed on types defined in the current module
-        fn bar(&self) { }
-    }
-}
-
-pub fn main() { }
-
-
diff --git a/src/test/run-pass/issue-12729.rs b/src/test/run-pass/issue-12729.rs
new file mode 100644 (file)
index 0000000..09c0c86
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright 2012 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.
+
+pub struct Foo;
+
+mod bar {
+    use Foo;
+
+    impl Foo {
+        fn baz(&self) {}
+    }
+}
+fn main() {}
+
diff --git a/src/test/run-pass/issue-7607-2.rs b/src/test/run-pass/issue-7607-2.rs
new file mode 100644 (file)
index 0000000..c52051f
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright 2012 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.
+
+pub mod a {
+    pub struct Foo { a: usize }
+}
+
+pub mod b {
+    use a::Foo;
+    impl Foo {
+        fn bar(&self) { }
+    }
+}
+
+pub fn main() { }
+
+
index 727c33d6ce56f3ee9a5ae3fa5afe5e72673f0600..abc35bcc29d415b8655687ee8c7a9d548399fa74 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-mod Foo {
-    trait Trait {
+pub mod Foo {
+    pub trait Trait {
         fn foo(&self);
     }
 }