File tree 2 files changed +12
-4
lines changed
compiler/rustc_ty_utils/src
tests/ui/impl-trait/in-trait
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -346,8 +346,16 @@ fn associated_type_for_impl_trait_in_impl(
346
346
) -> LocalDefId {
347
347
let impl_local_def_id = tcx. local_parent ( impl_fn_def_id) ;
348
348
349
- // FIXME fix the span, we probably want the def_id of the return type of the function
350
- let span = tcx. def_span ( impl_fn_def_id) ;
349
+ let decl = tcx
350
+ . hir ( )
351
+ . find_by_def_id ( impl_fn_def_id)
352
+ . expect ( "expected item" )
353
+ . fn_decl ( )
354
+ . expect ( "expected decl" ) ;
355
+ let span = match decl. output {
356
+ hir:: FnRetTy :: DefaultReturn ( _) => tcx. def_span ( impl_fn_def_id) ,
357
+ hir:: FnRetTy :: Return ( ty) => ty. span ,
358
+ } ;
351
359
let impl_assoc_ty = tcx. at ( span) . create_def ( impl_local_def_id, DefPathData :: ImplTraitAssocTy ) ;
352
360
353
361
let local_def_id = impl_assoc_ty. def_id ( ) ;
Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ LL | where Self: 'b;
13
13
| ~~~~~~~~~~~~~~
14
14
15
15
error[E0477]: the type `&'a I` does not fulfill the required lifetime
16
- --> $DIR/bad-item-bound-within-rpitit.rs:19:5
16
+ --> $DIR/bad-item-bound-within-rpitit.rs:19:23
17
17
|
18
18
LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
19
- | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20
20
|
21
21
note: type must outlive the anonymous lifetime as defined here
22
22
--> $DIR/bad-item-bound-within-rpitit.rs:10:28
You can’t perform that action at this time.
0 commit comments