From 5045e12bd7001956b14a6dfd642637a471e4b378 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Wed, 28 Nov 2018 21:15:06 -0500 Subject: Filter out self-referential projection predicates If we end up with a projection predicate that equates a type with itself (e.g. ::Value == ::Value), we can run into issues if we try to add it to our ParamEnv. --- .../rustdoc/synthetic_auto/self-referential.rs | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/test/rustdoc/synthetic_auto/self-referential.rs (limited to 'src/test/rustdoc') diff --git a/src/test/rustdoc/synthetic_auto/self-referential.rs b/src/test/rustdoc/synthetic_auto/self-referential.rs new file mode 100644 index 00000000000..077786b280f --- /dev/null +++ b/src/test/rustdoc/synthetic_auto/self-referential.rs @@ -0,0 +1,40 @@ +// Copyright 2018 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. + +// Some unusual code minimized from +// https://github.com/sile/handy_async/tree/7b619b762c06544fc67792c8ff8ebc24a88fdb98 + +pub trait Pattern { + type Value; +} + +pub struct Constrain(A, B, C); + +impl Pattern for Constrain + where A: Pattern, + B: Pattern, + C: Pattern, +{ + type Value = A::Value; +} + +pub struct Wrapper(T); + +impl Pattern for Wrapper { + type Value = T; +} + + +// @has self_referential/struct.WriteAndThen.html +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl Send for \ +// WriteAndThen where ::Value: Send" +pub struct WriteAndThen(pub P1::Value, pub > as Pattern>::Value) + where P1: Pattern; + -- cgit 1.4.1-3-g733a5