From 8f7eb6229cb301c2ee7900a36a13f2906518378f Mon Sep 17 00:00:00 2001 From: Julien Philippon Date: Mon, 30 Mar 2020 02:50:53 +0200 Subject: Add long error code for error E0226 --- src/librustc_error_codes/error_codes/E0226.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/librustc_error_codes/error_codes/E0226.md (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0226.md b/src/librustc_error_codes/error_codes/E0226.md new file mode 100644 index 00000000000..e485771fc1b --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0226.md @@ -0,0 +1,20 @@ +Only a single explicit lifetime bound is permitted on trait objects. + +Example of erroneous code: + +```compile_fail +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. + +To fix this error, consider removing one of the lifetime bounds: + +``` +trait Foo {} + +type T<'a> = dyn Foo + 'a; +``` -- cgit 1.4.1-3-g733a5