2019-10-29 00:00:00 +00:00
|
|
|
// build-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(dead_code)]
|
2015-03-22 13:13:15 -07:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2014-03-06 09:55:35 -08:00
|
|
|
mod a {
|
|
|
|
pub enum Enum<T> {
|
|
|
|
A(T),
|
|
|
|
}
|
|
|
|
|
2015-02-12 10:29:52 -05:00
|
|
|
pub trait X {
|
|
|
|
fn dummy(&self) { }
|
|
|
|
}
|
2015-03-25 17:06:52 -07:00
|
|
|
impl X for isize {}
|
2014-03-06 09:55:35 -08:00
|
|
|
|
2019-05-28 14:46:13 -04:00
|
|
|
pub struct Z<'a>(Enum<&'a (dyn X + 'a)>);
|
|
|
|
fn foo() { let x: isize = 42; let z = Z(Enum::A(&x as &dyn X)); let _ = z; }
|
2014-03-06 09:55:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
mod b {
|
2015-02-12 10:29:52 -05:00
|
|
|
trait X {
|
|
|
|
fn dummy(&self) { }
|
|
|
|
}
|
2015-03-25 17:06:52 -07:00
|
|
|
impl X for isize {}
|
2014-03-06 09:55:35 -08:00
|
|
|
struct Y<'a>{
|
2019-05-28 14:46:13 -04:00
|
|
|
x:Option<&'a (dyn X + 'a)>,
|
2014-03-06 09:55:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn bar() {
|
2015-03-25 17:06:52 -07:00
|
|
|
let x: isize = 42;
|
2019-05-28 14:46:13 -04:00
|
|
|
let _y = Y { x: Some(&x as &dyn X) };
|
2014-03-06 09:55:35 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod c {
|
|
|
|
pub trait X { fn f(&self); }
|
2015-03-25 17:06:52 -07:00
|
|
|
impl X for isize { fn f(&self) {} }
|
2019-05-28 14:46:13 -04:00
|
|
|
pub struct Z<'a>(Option<&'a (dyn X + 'a)>);
|
|
|
|
fn main() { let x: isize = 42; let z = Z(Some(&x as &dyn X)); let _ = z; }
|
2014-03-06 09:55:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {}
|