Use mopa and downcast-rs

use downcast_rs::Downcast;
trait N<'a>:Downcast+Debug+Display{}
impl<'a> N<'a> for &'a str {}
fn main() {


for above code, it warns : no rules expected this token in macro call

then I tried mopa (another crate) again, got the same warning.

below mopa code:

extern crate mopa;

trait N<'a>:mopa::Any+Debug+Display{}

impl<'a> N<'a> for &'a str {}

fn main() {


how to modify the code to avoid such warnings,
I didn't see introduction from those two crates for <'a> lifetime name,

That's because it is not possible to downcast non-'static types. (Explanation.)

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.