3 #![allow(non_upper_case_globals)]
5 #![allow(unused_assignments)]
6 #![allow(unused_variables)]
7 // Test a scenario where we generate a constraint like `?1 <: &?2`.
8 // In such a case, it is important that we instantiate `?1` with `&?3`
9 // where `?3 <: ?2`, and not with `&?2`. This is a regression test for
10 // #18653. The important thing is that we build.
12 use std::cell::RefCell;
24 trait Get<T: ?Sized> {
28 impl Get<dyn MyShow + 'static> for Wrap<T> {
29 fn get(&self) -> &(dyn MyShow + 'static) {
35 impl Get<usize> for Wrap<U> {
36 fn get(&self) -> &usize {
42 trait MyShow { fn dummy(&self) { } }
43 impl<'a> MyShow for &'a (dyn MyShow + 'a) { }
44 impl MyShow for usize { }
45 fn constrain<'a>(rc: RefCell<&'a (dyn MyShow + 'a)>) { }
48 let mut collection: Wrap<_> = WrapNone;
51 let __arg0 = Get::get(&collection);
52 let __args_cell = RefCell::new(__arg0);
53 constrain(__args_cell);
55 collection = WrapSome(T);