mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-14 01:25:54 +00:00
9a20cf1697
This reverts commit6d2b84b3ed
, reversing changes made to73bc12199e
.
21 lines
399 B
Rust
21 lines
399 B
Rust
// build-pass
|
|
#![feature(trait_upcasting)]
|
|
|
|
pub trait A {}
|
|
pub trait B {}
|
|
|
|
pub trait C: A + B {}
|
|
impl<X: A + B> C for X {}
|
|
|
|
pub fn test<'a, T>(view: T) -> Option<&'a mut dyn B>
|
|
where
|
|
T: IntoIterator<Item = &'a mut dyn B>,
|
|
{
|
|
return Some(view.into_iter().next().unwrap());
|
|
}
|
|
|
|
fn main() {
|
|
let mut a: Vec<Box<dyn C>> = Vec::new();
|
|
test(a.iter_mut().map(|c| c.as_mut() as &mut dyn B));
|
|
}
|