From e3b28b4ae8092ca58f45053fc8f6be4f9b82c2e8 Mon Sep 17 00:00:00 2001 From: scalexm Date: Thu, 10 Aug 2017 15:13:34 +0200 Subject: [PATCH] Add tests --- .../issue-43784-associated-type.rs | 25 +++++++++++++++++++ .../compile-fail/issue-43784-supertrait.rs | 18 +++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/test/compile-fail/issue-43784-associated-type.rs create mode 100644 src/test/compile-fail/issue-43784-supertrait.rs diff --git a/src/test/compile-fail/issue-43784-associated-type.rs b/src/test/compile-fail/issue-43784-associated-type.rs new file mode 100644 index 00000000000..94b5c0034a7 --- /dev/null +++ b/src/test/compile-fail/issue-43784-associated-type.rs @@ -0,0 +1,25 @@ +// Copyright 2017 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. + +pub trait Partial: Copy { +} + +pub trait Complete { + type Assoc: Partial; +} + +impl Partial for T::Assoc where + T: Complete +{ +} + +impl Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied + type Assoc = T; +} diff --git a/src/test/compile-fail/issue-43784-supertrait.rs b/src/test/compile-fail/issue-43784-supertrait.rs new file mode 100644 index 00000000000..e70df113da3 --- /dev/null +++ b/src/test/compile-fail/issue-43784-supertrait.rs @@ -0,0 +1,18 @@ +// Copyright 2017 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. + +pub trait Partial: Copy { +} + +pub trait Complete: Partial { +} + +impl Partial for T where T: Complete {} +impl Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied