2 #![allow(unused_variables)]
4 # ICE when returning struct with reference to trait
6 A function which takes a reference to a trait and returns a
7 struct with that reference results in an ICE.
9 This does not occur with concrete types, only with references
19 impl Inner for isize {
20 fn print(&self) { print!("Inner: {}\n", *self); }
24 inner: &'a (dyn Inner+'a)
28 fn new(inner: &dyn Inner) -> Outer {
37 let outer = Outer::new(&inner as &dyn Inner);
43 pub trait MyTrait<T> {
44 fn dummy(&self, t: T) -> T { panic!() }
47 pub struct MyContainer<'a, T:'a> {
48 foos: Vec<&'a (dyn MyTrait<T>+'a)> ,
51 impl<'a, T> MyContainer<'a, T> {
52 pub fn add (&mut self, foo: &'a dyn MyTrait<T>) {