]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr
update comment to explain the importance of this check more clearly
[rust.git] / src / test / ui / regions / regions-close-over-type-parameter-multiple.stderr
1 error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
2   --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5
3    |
4 LL |     box v as Box<dyn SomeTrait + 'a>
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7 note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 18:20...
8   --> $DIR/regions-close-over-type-parameter-multiple.rs:18:20
9    |
10 LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<dyn SomeTrait + 'c> {
11    |                    ^^
12 note: ...so that the declared lifetime parameter bounds are satisfied
13   --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5
14    |
15 LL |     box v as Box<dyn SomeTrait + 'a>
16    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 note: but, the lifetime must be valid for the lifetime `'c` as defined on the function body at 18:26...
18   --> $DIR/regions-close-over-type-parameter-multiple.rs:18:26
19    |
20 LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<dyn SomeTrait + 'c> {
21    |                          ^^
22    = note: ...so that the expression is assignable:
23            expected std::boxed::Box<(dyn SomeTrait + 'c)>
24               found std::boxed::Box<dyn SomeTrait>
25
26 error: aborting due to previous error
27
28 For more information about this error, try `rustc --explain E0495`.