This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +42
-3
lines changed Expand file tree Collapse file tree 2 files changed +42
-3
lines changed Original file line number Diff line number Diff line change @@ -1358,9 +1358,9 @@ impl Function {
1358
1358
/// Get this function's return type
1359
1359
pub fn ret_type ( self , db : & dyn HirDatabase ) -> Type {
1360
1360
let resolver = self . id . resolver ( db. upcast ( ) ) ;
1361
- let ret_type = & db . function_data ( self . id ) . ret_type ;
1362
- let ctx = hir_ty :: TyLoweringContext :: new ( db , & resolver ) ;
1363
- let ty = ctx . lower_ty ( ret_type ) ;
1361
+ let substs = TyBuilder :: placeholder_subst ( db , self . id ) ;
1362
+ let callable_sig = db . callable_item_signature ( self . id . into ( ) ) . substitute ( Interner , & substs ) ;
1363
+ let ty = callable_sig . ret ( ) . clone ( ) ;
1364
1364
Type :: new_with_resolver_inner ( db, & resolver, ty)
1365
1365
}
1366
1366
Original file line number Diff line number Diff line change @@ -602,3 +602,42 @@ fn func() {
602
602
"# ] ] ,
603
603
) ;
604
604
}
605
+
606
+ #[ test]
607
+ fn detail_impl_trait_in_return_position ( ) {
608
+ check_empty (
609
+ r"
610
+ //- minicore: sized
611
+ trait Trait<T> {}
612
+ fn foo<U>() -> impl Trait<U> {}
613
+ fn main() {
614
+ self::$0
615
+ }
616
+ " ,
617
+ expect ! [ [ r"
618
+ tt Trait
619
+ fn main() fn()
620
+ fn foo() fn() -> impl Trait<U>
621
+ " ] ] ,
622
+ ) ;
623
+ }
624
+
625
+ #[ test]
626
+ fn detail_async_fn ( ) {
627
+ // FIXME: #11438
628
+ check_empty (
629
+ r#"
630
+ //- minicore: future, sized
631
+ trait Trait<T> {}
632
+ async fn foo() -> u8 {}
633
+ fn main() {
634
+ self::$0
635
+ }
636
+ "# ,
637
+ expect ! [ [ r"
638
+ tt Trait
639
+ fn main() fn()
640
+ fn foo() async fn() -> impl Future<Output = u8>
641
+ " ] ] ,
642
+ ) ;
643
+ }
You can’t perform that action at this time.
0 commit comments