From 92d16d961d01dfa5f16218ddc630df31b099d2aa Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 7 Aug 2015 10:59:28 -0400 Subject: [PATCH] Fallout in tests -- break the object safety part into a separate file because error will be in future reported by wfcheck, which runs in a later stage than coherence --- ...erence-impl-trait-for-trait-object-safe.rs | 19 +++++++++++++++++++ .../coherence-impl-trait-for-trait.rs | 5 ----- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 src/test/compile-fail/coherence-impl-trait-for-trait-object-safe.rs 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() { }