File tree Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -269,8 +269,8 @@ impl<'tcx> TyCtxt<'tcx> {
269269 let f_str = values. found . to_string ( ) ;
270270 if & e_str == & f_str && & e_str == "impl std::future::Future" {
271271 // FIXME: use non-string based check.
272- db. help ( "if both futures resolve to the same type, consider `await`ing \
273- on both of them") ;
272+ db. help ( "if both `Future`s have the same `Output` type, consider \
273+ `.await`ing on both of them") ;
274274 }
275275 }
276276 if let ( ty:: Infer ( ty:: IntVar ( _) ) , ty:: Float ( _) ) =
Original file line number Diff line number Diff line change 1+ // edition:2018
2+ use core:: future:: Future ;
3+
4+ async fn base_thing ( ) -> Result < ( ) , ( ) > {
5+ Ok ( ( ) )
6+ }
7+
8+ fn thing_one ( ) -> impl Future < Output = Result < ( ) , ( ) > > {
9+ base_thing ( )
10+ }
11+
12+ fn thing_two ( ) -> impl Future < Output = Result < ( ) , ( ) > > {
13+ base_thing ( )
14+ }
15+
16+ async fn thing ( ) -> Result < ( ) , ( ) > {
17+ if true {
18+ thing_one ( )
19+ } else {
20+ thing_two ( ) //~ ERROR if and else have incompatible types
21+ } . await
22+ }
23+
24+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0308]: if and else have incompatible types
2+ --> $DIR/opaque-type-error.rs:20:9
3+ |
4+ LL | / if true {
5+ LL | | thing_one()
6+ | | ----------- expected because of this
7+ LL | | } else {
8+ LL | | thing_two()
9+ | | ^^^^^^^^^^^ expected opaque type, found a different opaque type
10+ LL | | }.await
11+ | |_____- if and else have incompatible types
12+ |
13+ = note: expected type `impl std::future::Future` (opaque type)
14+ found type `impl std::future::Future` (opaque type)
15+ = note: distinct uses of `impl Trait` result in different opaque types
16+ = help: if both `Future`s have the same `Output` type, consider `.await`ing on both of them
17+
18+ error: aborting due to previous error
19+
20+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments