use fehler::throws;
trait FooTrait {}
struct FooStruct;
struct FooError;
impl FooTrait for FooStruct {}
#[throws(FooError)]
fn foo() -> Box<dyn FooTrait> {
Box::new(FooStruct)
}
Error[E0271]: type mismatch resolving ...
|
104 | #[throws(FooError)]
| ^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn mymodule::FooTrait`, found struct `mymodule::FooStruct`
|
= note: expected type `std::boxed::Box<dyn mymodule::FooTrait>`
found struct `std::boxed::Box<mymodule::FooStruct>`
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)