diff --git a/src/test/compile-fail/coherence-impl-trait-for-trait-object-safe.rs b/src/test/compile-fail/coherence-impl-trait-for-trait-object-safe.rs new file mode 100644 index 00000000000..ce6baeb204c --- /dev/null +++ b/src/test/compile-fail/coherence-impl-trait-for-trait-object-safe.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we give suitable error messages when the user attempts to +// impl a trait `Trait` for its own object type. + +// If the trait is not object-safe, we give a more tailored message +// because we're such schnuckels: +trait NotObjectSafe { fn eq(&self, other: Self); } +impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0372 + +fn main() { } diff --git a/src/test/compile-fail/coherence-impl-trait-for-trait.rs b/src/test/compile-fail/coherence-impl-trait-for-trait.rs index 332965cc940..cd75b0e34f2 100644 --- a/src/test/compile-fail/coherence-impl-trait-for-trait.rs +++ b/src/test/compile-fail/coherence-impl-trait-for-trait.rs @@ -24,9 +24,4 @@ impl Baz for Baz { } //~ ERROR E0371 trait Other { } impl Other for Baz { } // OK, Other not a supertrait of Baz -// If the trait is not object-safe, we give a more tailored message -// because we're such schnuckels: -trait NotObjectSafe { fn eq(&self, other: Self); } -impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0372 - fn main() { }