1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Regression test for issue #47139:
13 // Same as issue-47139-1.rs, but the impls of dummy are in the
14 // opposite order. This influenced the way that coherence ran and in
15 // some cases caused the overflow to occur when it wouldn't otherwise.
16 // In an effort to make the regr test more robust, I am including both
21 pub trait Insertable {
24 fn values(self) -> Self::Values;
27 impl<T> Insertable for Option<T>
32 type Values = T::Values;
34 fn values(self) -> Self::Values {
35 self.map(Insertable::values).unwrap_or_default()
39 impl<'a, T> Insertable for &'a Option<T>
41 Option<&'a T>: Insertable,
43 type Values = <Option<&'a T> as Insertable>::Values;
45 fn values(self) -> Self::Values {
46 self.as_ref().values()
50 impl<'a, T> Insertable for &'a [T]
54 fn values(self) -> Self::Values {
59 trait Unimplemented { }
63 struct Foo<T> { t: T }
66 where T: Unimplemented
69 impl<'a, U> Dummy for Foo<&'a U>
70 where &'a U: Insertable