File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
compiler/rustc_ty_utils/src
tests/ui/impl-trait/in-trait Expand file tree Collapse file tree 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(
346346) -> LocalDefId {
347347 let impl_local_def_id = tcx. local_parent ( impl_fn_def_id) ;
348348
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+ } ;
351359 let impl_assoc_ty = tcx. at ( span) . create_def ( impl_local_def_id, DefPathData :: ImplTraitAssocTy ) ;
352360
353361 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;
1313 | ~~~~~~~~~~~~~~
1414
1515error[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
1717 |
1818LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
19- | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020 |
2121note: type must outlive the anonymous lifetime as defined here
2222 --> $DIR/bad-item-bound-within-rpitit.rs:10:28
You can’t perform that action at this time.
0 commit comments