Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn build_registry() -> Registry {
/// This is instantiated once for each castable trait. It describes how a trait
/// can insert itself into the global table.
pub struct EntryBuilder {
pub insert: Box<Fn(&mut Registry)>,
pub insert: Box<dyn Fn(&mut Registry)>,
}

impl EntryBuilder {
Expand Down
2 changes: 1 addition & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl<To: ?Sized + 'static> CastIntoTrait<To> {
/// An entry in the table for a particular castable trait. Stores methods to
/// cast into one particular struct that implements the trait.
pub struct ImplEntry<DynTrait: ?Sized> {
pub cast_box: fn(Box<Any>) -> Result<Box<DynTrait>, Box<Any>>,
pub cast_box: fn(Box<dyn Any>) -> Result<Box<DynTrait>, Box<dyn Any>>,
pub cast_mut: fn(&mut dyn Any) -> Option<&mut DynTrait>,
pub cast_ref: fn(&dyn Any) -> Option<&DynTrait>,
pub tid: TypeId,
Expand Down
4 changes: 2 additions & 2 deletions traitcast/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ use crate::Traitcast;

#[test]
fn test_traitcast() {
let mut x: Box<Any> = Box::new(A { x: 0 });
let mut y: Box<Any> = Box::new(B { y: 1 });
let mut x: Box<dyn Any> = Box::new(A { x: 0 });
let mut y: Box<dyn Any> = Box::new(B { y: 1 });

{
// Can cast from Any to Bar
Expand Down