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+ type Result < T , E = Error > = :: std:: result:: Result < T , E > ;
2+ struct Error ;
3+
4+ trait ForEach {
5+ type Input ;
6+ fn for_each < F , U > ( self , f : F )
7+ where
8+ F : FnOnce ( Self :: Input ) -> U ;
9+ }
10+
11+ impl < T > ForEach for A < T > {
12+ type Input = T ;
13+ fn for_each < F , U > ( self , f : F )
14+ where
15+ F : FnOnce ( Self :: Input ) -> U ,
16+ {
17+ todo ! ( )
18+ }
19+ }
20+
21+ struct A < T > ( T ) ;
22+
23+ fn main ( ) {
24+ let a = A ( Result :: Ok ( Result :: Ok ( ( ) ) ) ) ; //~ ERROR type annotations needed
25+ a. for_each ( |a : Result < _ > | {
26+ let f = || match a {
27+ Ok ( Ok ( a) ) => { }
28+ Ok ( Err ( a) ) => { }
29+ Err ( a) => { }
30+ } ;
31+ } ) ;
32+ }
Original file line number Diff line number Diff line change 1+ error[E0282]: type annotations needed for `A<std::result::Result<std::result::Result<(), E>, Error>>`
2+ --> $DIR/issue-104649.rs:24:9
3+ |
4+ LL | let a = A(Result::Ok(Result::Ok(())));
5+ | ^
6+ |
7+ help: consider giving `a` an explicit type, where the type for type parameter `E` is specified
8+ |
9+ LL | let a: A<std::result::Result<std::result::Result<(), E>, Error>> = A(Result::Ok(Result::Ok(())));
10+ | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11+
12+ error: aborting due to previous error
13+
14+ For more information about this error, try `rustc --explain E0282`.
You can’t perform that action at this time.
0 commit comments