W3cubDocs

/Rust

Error code E0226

More than one explicit lifetime bound was used on a trait object.

Example of erroneous code:

#![allow(unused)]
fn main() {
trait Foo {}

type T<'a, 'b> = dyn Foo + 'a + 'b; // error: Trait object `arg` has two
                                    //        lifetime bound, 'a and 'b.
}

Here T is a trait object with two explicit lifetime bounds, 'a and 'b.

Only a single explicit lifetime bound is permitted on trait objects. To fix this error, consider removing one of the lifetime bounds:

#![allow(unused)]
fn main() {
trait Foo {}

type T<'a> = dyn Foo + 'a;
}

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/error_codes/E0226.html