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 // Test a scenario where we generate a constraint like `?1 <: &?2`.
12 // In such a case, it is important that we instantiate `?1` with `&?3`
13 // where `?3 <: ?2`, and not with `&?2`. This is a regression test for
14 // #18653. The important thing is that we build.
16 use std::cell::RefCell;
28 trait Get<T: ?Sized> {
32 impl Get<MyShow + 'static> for Wrap<T> {
33 fn get(&self) -> &(MyShow + 'static) {
39 impl Get<usize> for Wrap<U> {
40 fn get(&self) -> &usize {
46 trait MyShow { fn dummy(&self) { } }
47 impl<'a> MyShow for &'a (MyShow + 'a) { }
48 impl MyShow for usize { }
49 fn constrain<'a>(rc: RefCell<&'a (MyShow + 'a)>) { }
52 let mut collection: Wrap<_> = WrapNone;
55 let __arg0 = Get::get(&collection);
56 let __args_cell = RefCell::new(__arg0);
57 constrain(__args_cell);
59 collection = WrapSome(T);