File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ trait Wrap < ' b > {
2+ fn foo ( & ' b mut self ) ;
3+ }
4+
5+ struct Wrapper < P > ( P ) ;
6+
7+ impl < ' b , P > Wrap < ' b > for Wrapper < P >
8+ where P : Process < ' b > ,
9+ <P as Process < ' b > >:: Item : Iterator {
10+ fn foo ( & mut self ) { }
11+ }
12+
13+
14+ pub trait Process < ' a > {
15+ type Item ;
16+ fn bar ( & ' a self ) ;
17+ }
18+
19+ fn push_process < P > ( process : P ) where P : Process < ' static > {
20+ let _: Box < for <' b > Wrap < ' b > > = Box :: new ( Wrapper ( process ) ) ;
21+ }
22+
23+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0277]: the trait bound `for<'b> P: Process<'b>` is not satisfied
2+ --> $DIR/issue-22872.rs:20:36
3+ |
4+ LL | let _: Box<for<'b> Wrap<'b>> = Box::new(Wrapper(process));
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> Process<'b>` is not implemented for `P`
6+ |
7+ = help: consider adding a `where for<'b> P: Process<'b>` bound
8+ = note: required because of the requirements on the impl of `for<'b> Wrap<'b>` for `Wrapper<P>`
9+ = note: required for the cast to the object type `dyn for<'b> Wrap<'b>`
10+
11+ error[E0277]: `<P as Process<'b>>::Item` is not an iterator
12+ --> $DIR/issue-22872.rs:20:36
13+ |
14+ LL | let _: Box<for<'b> Wrap<'b>> = Box::new(Wrapper(process));
15+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `<P as Process<'b>>::Item` is not an iterator
16+ |
17+ = help: the trait `for<'b> std::iter::Iterator` is not implemented for `<P as Process<'b>>::Item`
18+ = note: required because of the requirements on the impl of `for<'b> Wrap<'b>` for `Wrapper<P>`
19+ = note: required for the cast to the object type `dyn for<'b> Wrap<'b>`
20+
21+ error: aborting due to 2 previous errors
22+
23+ For more information about this error, try `rustc --explain E0277`.
You can’t perform that action at this time.
0 commit comments