Skip to content

Commit

Permalink
add dyn to display of dynamic (trait) type names
Browse files Browse the repository at this point in the history
The `dyn Trait` syntax was stabilized in 199ee32. Resolves #49277.
  • Loading branch information
zackmdavis committed Jun 24, 2018
1 parent 8fb1180 commit 4b18085
Show file tree
Hide file tree
Showing 57 changed files with 143 additions and 139 deletions.
8 changes: 6 additions & 2 deletions src/librustc/util/ppaux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,10 +1062,14 @@ define_print! {
TyParam(ref param_ty) => write!(f, "{}", param_ty),
TyAdt(def, substs) => cx.parameterized(f, substs, def.did, &[]),
TyDynamic(data, r) => {
data.print(f, cx)?;
let r = r.print_to_string(cx);
if !r.is_empty() {
write!(f, " + {}", r)
write!(f, "(")?;
}
write!(f, "dyn ")?;
data.print(f, cx)?;
if !r.is_empty() {
write!(f, " + {})", r)
} else {
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/cross-borrow-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ impl Trait for Foo {}
pub fn main() {
let x: Box<Trait> = Box::new(Foo);
let _y: &Trait = x; //~ ERROR E0308
//~| expected type `&Trait`
//~| found type `std::boxed::Box<Trait>`
//~| expected type `&dyn Trait`
//~| found type `std::boxed::Box<dyn Trait>`
}
12 changes: 6 additions & 6 deletions src/test/compile-fail/destructure-trait-ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ fn main() {
let &&x = &&(&1isize as &T);

// n == m
let &x = &1isize as &T; //~ ERROR type `&T` cannot be dereferenced
let &&x = &(&1isize as &T); //~ ERROR type `&T` cannot be dereferenced
let box x = box 1isize as Box<T>; //~ ERROR type `std::boxed::Box<T>` cannot be dereferenced
let &x = &1isize as &T; //~ ERROR type `&dyn T` cannot be dereferenced
let &&x = &(&1isize as &T); //~ ERROR type `&dyn T` cannot be dereferenced
let box x = box 1isize as Box<T>; //~ ERROR type `std::boxed::Box<dyn T>` cannot be dereferenced

// n > m
let &&x = &1isize as &T;
//~^ ERROR mismatched types
//~| expected type `T`
//~| expected type `dyn T`
//~| found type `&_`
//~| expected trait T, found reference
let &&&x = &(&1isize as &T);
//~^ ERROR mismatched types
//~| expected type `T`
//~| expected type `dyn T`
//~| found type `&_`
//~| expected trait T, found reference
let box box x = box 1isize as Box<T>;
//~^ ERROR mismatched types
//~| expected type `T`
//~| expected type `dyn T`
//~| found type `std::boxed::Box<_>`
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/dst-bad-assign-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn main() {
let z: Box<ToBar> = Box::new(Bar1 {f: 36});
f5.2 = Bar1 {f: 36};
//~^ ERROR mismatched types
//~| expected type `ToBar`
//~| expected type `dyn ToBar`
//~| found type `Bar1`
//~| expected trait ToBar, found struct `Bar1`
//~| ERROR the size for value values of type
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/dst-bad-assign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub fn main() {
let z: Box<ToBar> = Box::new(Bar1 {f: 36});
f5.ptr = Bar1 {f: 36};
//~^ ERROR mismatched types
//~| expected type `ToBar`
//~| expected type `dyn ToBar`
//~| found type `Bar1`
//~| expected trait ToBar, found struct `Bar1`
//~| ERROR the size for value values of type
Expand Down
6 changes: 3 additions & 3 deletions src/test/compile-fail/fn-trait-formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ fn main() {
let _: () = (box |_: isize| {}) as Box<FnOnce(isize)>;
//~^ ERROR mismatched types
//~| expected type `()`
//~| found type `std::boxed::Box<std::ops::FnOnce(isize)>`
//~| found type `std::boxed::Box<dyn std::ops::FnOnce(isize)>`
let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>;
//~^ ERROR mismatched types
//~| expected type `()`
//~| found type `std::boxed::Box<std::ops::Fn(isize, isize)>`
//~| found type `std::boxed::Box<dyn std::ops::Fn(isize, isize)>`
let _: () = (box || -> isize { unimplemented!() }) as Box<FnMut() -> isize>;
//~^ ERROR mismatched types
//~| expected type `()`
//~| found type `std::boxed::Box<std::ops::FnMut() -> isize>`
//~| found type `std::boxed::Box<dyn std::ops::FnMut() -> isize>`

needs_fn(1);
//~^ ERROR : std::ops::Fn<(isize,)>`
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/issue-13033.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ struct Baz;
impl Foo for Baz {
fn bar(&mut self, other: &Foo) {}
//~^ ERROR method `bar` has an incompatible type for trait
//~| expected type `fn(&mut Baz, &mut Foo)`
//~| found type `fn(&mut Baz, &Foo)`
//~| expected type `fn(&mut Baz, &mut dyn Foo)`
//~| found type `fn(&mut Baz, &dyn Foo)`
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-20939.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
trait Foo {}

impl<'a> Foo for Foo+'a {}
//~^ ERROR the object type `Foo + 'a` automatically implements the trait `Foo`
//~^ ERROR the object type `(dyn Foo + 'a)` automatically implements the trait `Foo`

fn main() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-32963.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }
fn main() {
size_of_copy::<Misc+Copy>();
//~^ ERROR only auto traits can be used as additional traits in a trait object
//~| ERROR the trait bound `Misc: std::marker::Copy` is not satisfied
//~| ERROR the trait bound `dyn Misc: std::marker::Copy` is not satisfied
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-41139.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ fn get_function<'a>() -> &'a Fn() -> Trait { panic!("") }

fn main() {
let t : &Trait = &get_function()();
//~^ ERROR cannot move a value of type Trait + 'static
//~^ ERROR cannot move a value of type (dyn Trait + 'static)
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-5153.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ impl Foo for isize {

fn main() {
(&5isize as &Foo).foo();
//~^ ERROR: no method named `foo` found for type `&Foo` in the current scope
//~^ ERROR: no method named `foo` found for type `&dyn Foo` in the current scope
}
4 changes: 2 additions & 2 deletions src/test/compile-fail/kindck-send-object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ trait Message : Send { }

fn object_ref_with_static_bound_not_ok() {
assert_send::<&'static (Dummy+'static)>();
//~^ ERROR `Dummy + 'static` cannot be shared between threads safely [E0277]
//~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277]
}

fn box_object_with_no_bound_not_ok<'a>() {
assert_send::<Box<Dummy>>();
//~^ ERROR `Dummy` cannot be sent between threads safely
//~^ ERROR `dyn Dummy` cannot be sent between threads safely
}

fn object_with_send_bound_ok() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/kindck-send-object1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait Dummy { }
// careful with object types, who knows what they close over...
fn test51<'a>() {
assert_send::<&'a Dummy>();
//~^ ERROR `Dummy + 'a` cannot be shared between threads safely [E0277]
//~^ ERROR `(dyn Dummy + 'a)` cannot be shared between threads safely [E0277]
}
fn test52<'a>() {
assert_send::<&'a (Dummy+Sync)>();
Expand All @@ -37,7 +37,7 @@ fn test61() {
// them not ok
fn test_71<'a>() {
assert_send::<Box<Dummy+'a>>();
//~^ ERROR `Dummy + 'a` cannot be sent between threads safely
//~^ ERROR `(dyn Dummy + 'a)` cannot be sent between threads safely
}

fn main() { }
4 changes: 2 additions & 2 deletions src/test/compile-fail/kindck-send-object2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ trait Dummy { }

fn test50() {
assert_send::<&'static Dummy>();
//~^ ERROR `Dummy + 'static` cannot be shared between threads safely [E0277]
//~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277]
}

fn test53() {
assert_send::<Box<Dummy>>();
//~^ ERROR `Dummy` cannot be sent between threads safely
//~^ ERROR `dyn Dummy` cannot be sent between threads safely
}

// ...unless they are properly bounded
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/map-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ fn main() {
let x: Box<HashMap<isize, isize>> = box HashMap::new();
let x: Box<Map<isize, isize>> = x;
let y: Box<Map<usize, isize>> = Box::new(x);
//~^ ERROR `std::boxed::Box<Map<isize, isize>>: Map<usize, isize>` is not satisfied
//~^ ERROR `std::boxed::Box<dyn Map<isize, isize>>: Map<usize, isize>` is not satisfied
}
8 changes: 4 additions & 4 deletions src/test/compile-fail/non-interger-atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,22 @@ pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {

pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
intrinsics::atomic_load(p);
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
//~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
}

pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
intrinsics::atomic_store(p, v);
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
//~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
}

pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
intrinsics::atomic_xchg(p, v);
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
//~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
}

pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
intrinsics::atomic_cxchg(p, v, v);
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
//~^ ERROR expected basic integer type, found `&dyn std::ops::Fn()`
}

pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/object-does-not-impl-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
trait Foo {}
fn take_foo<F:Foo>(f: F) {}
fn take_object(f: Box<Foo>) { take_foo(f); }
//~^ ERROR `std::boxed::Box<Foo>: Foo` is not satisfied
//~^ ERROR `std::boxed::Box<dyn Foo>: Foo` is not satisfied
fn main() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/object-safety-by-value-self-use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait Baz {
}

fn use_bar(t: Box<Bar>) {
t.bar() //~ ERROR cannot move a value of type Bar
t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static)
}

fn main() { }
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ mod priv_trait {

pub macro mac1() {
let _: Box<PubTr<AssocTy = u8>>;
//~^ ERROR type `priv_trait::PubTr<AssocTy=u8> + '<empty>` is private
//~| ERROR type `priv_trait::PubTr<AssocTy=u8> + '<empty>` is private
//~^ ERROR type `(dyn priv_trait::PubTr<AssocTy=u8> + '<empty>)` is private
//~| ERROR type `(dyn priv_trait::PubTr<AssocTy=u8> + '<empty>)` is private
type InSignatureTy2 = Box<PubTr<AssocTy = u8>>;
//~^ ERROR type `priv_trait::PubTr<AssocTy=u8> + 'static` is private
//~^ ERROR type `(dyn priv_trait::PubTr<AssocTy=u8> + 'static)` is private
trait InSignatureTr2: PubTr<AssocTy = u8> {}
//~^ ERROR trait `priv_trait::PrivTr` is private
}
pub macro mac2() {
let _: Box<PrivTr<AssocTy = u8>>;
//~^ ERROR type `priv_trait::PrivTr<AssocTy=u8> + '<empty>` is private
//~| ERROR type `priv_trait::PrivTr<AssocTy=u8> + '<empty>` is private
//~^ ERROR type `(dyn priv_trait::PrivTr<AssocTy=u8> + '<empty>)` is private
//~| ERROR type `(dyn priv_trait::PrivTr<AssocTy=u8> + '<empty>)` is private
type InSignatureTy1 = Box<PrivTr<AssocTy = u8>>;
//~^ ERROR type `priv_trait::PrivTr<AssocTy=u8> + 'static` is private
//~^ ERROR type `(dyn priv_trait::PrivTr<AssocTy=u8> + 'static)` is private
trait InSignatureTr1: PrivTr<AssocTy = u8> {}
//~^ ERROR trait `priv_trait::PrivTr` is private
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/private-inferred-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ fn main() {
m::leak_anon2(); //~ ERROR type `m::Priv` is private
m::leak_anon3(); //~ ERROR type `m::Priv` is private

m::leak_dyn1(); //~ ERROR type `m::Trait + 'static` is private
m::leak_dyn1(); //~ ERROR type `(dyn m::Trait + 'static)` is private
m::leak_dyn2(); //~ ERROR type `m::Priv` is private
m::leak_dyn3(); //~ ERROR type `m::Priv` is private

Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/trait-item-privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ fn check_assoc_const() {
// A, B, C are resolved as inherent items, their traits don't need to be in scope
C::A; //~ ERROR associated constant `A` is private
//~^ ERROR the trait `assoc_const::C` cannot be made into an object
//~| ERROR the trait bound `assoc_const::C: assoc_const::A` is not satisfied
//~| ERROR the trait bound `dyn assoc_const::C: assoc_const::A` is not satisfied
C::B; // ERROR the trait `assoc_const::C` cannot be made into an object
//~^ ERROR the trait bound `assoc_const::C: assoc_const::B` is not satisfied
//~^ ERROR the trait bound `dyn assoc_const::C: assoc_const::B` is not satisfied
C::C; // OK
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/traits-repeated-supertrait-ambig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ impl CompareTo<u64> for i64 {
impl CompareToInts for i64 { }

fn with_obj(c: &CompareToInts) -> bool {
c.same_as(22) //~ ERROR `CompareToInts: CompareTo<i32>` is not satisfied
c.same_as(22) //~ ERROR `dyn CompareToInts: CompareTo<i32>` is not satisfied
}

fn with_trait<C:CompareToInts>(c: &C) -> bool {
c.same_as(22) //~ ERROR `C: CompareTo<i32>` is not satisfied
}

fn with_ufcs1<C:CompareToInts>(c: &C) -> bool {
CompareToInts::same_as(c, 22) //~ ERROR `CompareToInts: CompareTo<i32>` is not satisfied
CompareToInts::same_as(c, 22) //~ ERROR `dyn CompareToInts: CompareTo<i32>` is not satisfied
}

fn with_ufcs2<C:CompareToInts>(c: &C) -> bool {
Expand Down
12 changes: 6 additions & 6 deletions src/test/compile-fail/trivial_casts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,25 @@ pub fn main() {

// unsize trait
let x: &Bar = &Bar;
let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&Foo`
let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const Foo`
let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo`
let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo`
let _: &Foo = x;
let _: *const Foo = x;

let x: &mut Bar = &mut Bar;
let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut Foo`
let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut Foo`
let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo`
let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo`
let _: &mut Foo = x;
let _: *mut Foo = x;

let x: Box<Bar> = Box::new(Bar);
let _ = x as Box<Foo>; //~ERROR trivial cast: `std::boxed::Box<Bar>` as `std::boxed::Box<Foo>`
let _ = x as Box<Foo>; //~ERROR `std::boxed::Box<Bar>` as `std::boxed::Box<dyn Foo>`
let x: Box<Bar> = Box::new(Bar);
let _: Box<Foo> = x;

// functions
fn baz(_x: i32) {}
let _ = &baz as &Fn(i32); //~ERROR trivial cast: `&fn(i32) {main::baz}` as `&std::ops::Fn(i32)`
let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)`
let _: &Fn(i32) = &baz;
let x = |_x: i32| {};
let _ = &x as &Fn(i32); //~ERROR trivial cast
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/type-mismatch-same-crate-name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn main() {
//~^ ERROR mismatched types
//~| Perhaps two different versions of crate `crate_a1`
//~| expected trait `main::a::Bar`
//~| expected type `std::boxed::Box<main::a::Bar + 'static>`
//~| found type `std::boxed::Box<main::a::Bar>`
//~| expected type `std::boxed::Box<(dyn main::a::Bar + 'static)>`
//~| found type `std::boxed::Box<dyn main::a::Bar>`
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ fn main() {
let x: i32 = 5;
let y = x as MyAdd<i32>;
//~^ ERROR E0038
//~| ERROR cast to unsized type: `i32` as `MyAdd<i32>`
//~| ERROR cast to unsized type: `i32` as `dyn MyAdd<i32>`
}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-21058.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ fn main() {
std::intrinsics::type_name::<NT>(),
// DST
std::intrinsics::type_name::<DST>()
)}, ("[u8]", "str", "std::marker::Send", "NT", "DST"));
)}, ("[u8]", "str", "dyn std::marker::Send", "NT", "DST"));
}
8 changes: 4 additions & 4 deletions src/test/ui/anonymous-higher-ranked-lifetime.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ error[E0631]: type mismatch in closure arguments
LL | g1(|_: (), _: ()| {}); //~ ERROR type mismatch
| ^^ -------------- found signature of `fn((), ()) -> _`
| |
| expected signature of `for<'r> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>) -> _`
| expected signature of `for<'r> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>) -> _`
|
note: required by `g1`
--> $DIR/anonymous-higher-ranked-lifetime.rs:33:1
Expand Down Expand Up @@ -102,7 +102,7 @@ error[E0631]: type mismatch in closure arguments
LL | g3(|_: (), _: ()| {}); //~ ERROR type mismatch
| ^^ -------------- found signature of `fn((), ()) -> _`
| |
| expected signature of `for<'s> fn(&'s (), std::boxed::Box<for<'r> std::ops::Fn(&'r ()) + 'static>) -> _`
| expected signature of `for<'s> fn(&'s (), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _`
|
note: required by `g3`
--> $DIR/anonymous-higher-ranked-lifetime.rs:35:1
Expand Down Expand Up @@ -130,7 +130,7 @@ error[E0631]: type mismatch in closure arguments
LL | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
| ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _`
| |
| expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<for<'t0> std::ops::Fn(&'t0 ()) + 'static>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _`
| expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<(dyn for<'t0> std::ops::Fn(&'t0 ()) + 'static)>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _`
|
note: required by `h1`
--> $DIR/anonymous-higher-ranked-lifetime.rs:39:1
Expand All @@ -144,7 +144,7 @@ error[E0631]: type mismatch in closure arguments
LL | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
| ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _`
| |
| expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<for<'s> std::ops::Fn(&'s ()) + 'static>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _`
| expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _`
|
note: required by `h2`
--> $DIR/anonymous-higher-ranked-lifetime.rs:40:1
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/arbitrary-self-types-not-object-safe.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LL | let x = Box::new(5usize) as Box<Foo>;
| ^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
|
= note: method `foo` has a non-standard `self` type
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<Foo>>` for `std::boxed::Box<usize>`
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Foo>>` for `std::boxed::Box<usize>`

error: aborting due to 2 previous errors

Expand Down
Loading

0 comments on commit 4b18085

Please sign in to comment.