// Followup to https://github.com/rust-lang/rust/issues/92940 and impl-box.rs. // // Show traits implemented on fundamental types that wrap local ones: nested edition. #![crate_name = "foo"] use std::pin::Pin; pub struct Local; //@ has 'foo/struct.Local.html' // Nested fundamental + foreign Self. //@ has '-' '//*[@id="impl-From%3CBox%3CLocal%3E%3E-for-String"]' 'impl From> for String' impl From> for String { fn from(_: Box) -> String { String::new() } } // Also test with Pin. //@ has '-' '//*[@id="impl-From%3CPin%3CLocal%3E%3E-for-u8"]' 'impl From> for u8' impl From> for u8 { fn from(_: Pin) -> u8 { 0 } } // Reference to a fundamental wrapper. //@ has '-' '//*[@id="impl-From%3C%26Box%3CLocal%3E%3E-for-u16"]' "impl<'a> From<&'a Box> for u16" impl<'a> From<&'a Box> for u16 { fn from(_: &'a Box) -> u16 { 0 } } // Nested two levels deep in Self. //@ has '-' '//*[@id="impl-From%3Cu32%3E-for-Box%3CBox%3CLocal%3E%3E"]' 'impl From for Box>' impl From for Box> { fn from(_: u32) -> Box> { Box::new(Box::new(Local)) } } // Mixed fundamental wrappers in Self. //@ has '-' '//*[@id="impl-From%3Cu64%3E-for-Pin%3CBox%3CLocal%3E%3E"]' 'impl From for Pin>' impl From for Pin> { fn from(_: u64) -> Pin> { Pin::new(Box::new(Local)) } } // A non-fundamental wrapper must not show up on Local's page, but it should still be listed on the // trait's own page. pub trait Marker {} //@ has 'foo/trait.Marker.html' '//*[@id="impl-Marker-for-Vec%3CLocal%3E"]' 'impl Marker for Vec' //@ !has 'foo/struct.Local.html' '//*[@id="impl-Marker-for-Vec%3CLocal%3E"]' 'impl Marker for Vec' impl Marker for Vec {}