1. Trait Aliases (unstable feature):
#![feature(trait_alias)]

trait Foo = std::fmt::Debug + Send;
trait Bar = Foo + Sync;

// Use trait alias as bound on type parameter.
fn foo<T: Foo>(v: &T) {
    println!("{:?}", v);
}

pub fn main() {
    foo(&1);

    // Use trait alias for trait objects.
    let a: &Bar = &123;
    println!("{:?}", a);
    let b = Box::new(456) as Box<dyn Foo>;
    println!("{:?}", b);
}
  1. Dynamic Traits and Casts:
trait Base {
    fn base_method(&self);
}

trait Derived: Base {
    fn derived_method(&self);
}

struct MyStruct;

impl Base for MyStruct {
    fn base_method(&self) {
        println!("Base method");
    }
}

impl Derived for MyStruct {
    fn derived_method(&self) {
        println!("Derived method");
    }
}

fn main() {
    let obj: Box<dyn Derived> = Box::new(MyStruct);

    // Cast to the base trait
    let base_obj: &dyn Base = &*obj;
    base_obj.base_method();

    // Attempt to downcast back to the derived trait
    if let Ok(derived_obj) = obj.downcast::<MyStruct>() {
        derived_obj.derived_method();
    }
}

  1. Specialization (unstable feature):