1 // run-pass 2 // Regression test for issue #21010: Normalize associated types in 3 // various special paths in the `type_is_immediate` function. 4 5 pub trait OffsetState: Sized {} 6 pub trait Offset { 7 type State: OffsetState; dummy(&self)8 fn dummy(&self) { } 9 } 10 11 #[derive(Copy, Clone)] pub struct X; 12 impl Offset for X { type State = Y; } 13 14 #[derive(Copy, Clone)] pub struct Y; 15 impl OffsetState for Y {} 16 now() -> DateTime<X>17pub fn now() -> DateTime<X> { from_utc(Y) } 18 19 pub struct DateTime<Off: Offset> { pub offset: Off::State } from_utc<Off: Offset>(offset: Off::State) -> DateTime<Off>20pub fn from_utc<Off: Offset>(offset: Off::State) -> DateTime<Off> { DateTime { offset: offset } } 21 main()22pub fn main() { 23 let _x = now(); 24 } 25