diff options
| author | Andrew Poelstra <apoelstra@wpsoftware.net> | 2014-09-16 17:39:18 -0500 |
|---|---|---|
| committer | Andrew Poelstra <apoelstra@wpsoftware.net> | 2014-09-28 12:58:10 -0500 |
| commit | bb5807919a4b26ba017d2e2f14f2cc9b3d87a278 (patch) | |
| tree | f04fb08c60f7a0a810ad8d18c61c50c6d08001ca /src/test | |
| parent | 9a68da7401d9bef645a8b6a4e0ce4cae12604df4 (diff) | |
| download | rust-bb5807919a4b26ba017d2e2f14f2cc9b3d87a278.tar.gz rust-bb5807919a4b26ba017d2e2f14f2cc9b3d87a278.zip | |
Cleanup error messages for anonymous impl for types not declared in the current module
Followup to RFC 57. Fixes #7607 Fixes #8767 Fixes #12729 Fixes #15060
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/issue-12729.rs | 23 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-7607-1.rs | 22 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-7607-2.rs | 26 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-8767.rs | 18 | ||||
| -rw-r--r-- | src/test/compile-fail/trait-or-new-type-instead.rs | 5 |
5 files changed, 92 insertions, 2 deletions
diff --git a/src/test/compile-fail/issue-12729.rs b/src/test/compile-fail/issue-12729.rs new file mode 100644 index 00000000000..ae033bbf38d --- /dev/null +++ b/src/test/compile-fail/issue-12729.rs @@ -0,0 +1,23 @@ +// 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-1.rs b/src/test/compile-fail/issue-7607-1.rs new file mode 100644 index 00000000000..37878084f03 --- /dev/null +++ b/src/test/compile-fail/issue-7607-1.rs @@ -0,0 +1,22 @@ +// 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 + +struct Foo { + x: int +} + +impl Fo { //~ERROR inherent implementations are not allowed for types not defined in the current module. + fn foo() {} +} + +fn main() {} + diff --git a/src/test/compile-fail/issue-7607-2.rs b/src/test/compile-fail/issue-7607-2.rs new file mode 100644 index 00000000000..8a7022a9a32 --- /dev/null +++ b/src/test/compile-fail/issue-7607-2.rs @@ -0,0 +1,26 @@ +// 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: uint } +} + +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/compile-fail/issue-8767.rs b/src/test/compile-fail/issue-8767.rs new file mode 100644 index 00000000000..c6bb460382c --- /dev/null +++ b/src/test/compile-fail/issue-8767.rs @@ -0,0 +1,18 @@ +// 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 + +impl B { //~ERROR inherent implementations are not allowed for types not defined in the current module. +} + +fn main() { +} + diff --git a/src/test/compile-fail/trait-or-new-type-instead.rs b/src/test/compile-fail/trait-or-new-type-instead.rs index 1a394aa8c9b..c4b4d197283 100644 --- a/src/test/compile-fail/trait-or-new-type-instead.rs +++ b/src/test/compile-fail/trait-or-new-type-instead.rs @@ -8,8 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// FIXME(#8767) bad error message; Option is not a module -impl<T> Option<T> { //~ERROR found module name used as a type +// ignore-tidy-linelength + +impl<T> Option<T> { //~ERROR inherent implementations are not allowed for types not defined in the current module. pub fn foo(&self) { } } |
