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