tighten span slightly for synthetic item
This commit is contained in:
parent
0ae0643a53
commit
bf38111ac1
2 changed files with 12 additions and 4 deletions
|
@ -346,8 +346,16 @@ fn associated_type_for_impl_trait_in_impl(
|
||||||
) -> LocalDefId {
|
) -> LocalDefId {
|
||||||
let impl_local_def_id = tcx.local_parent(impl_fn_def_id);
|
let impl_local_def_id = tcx.local_parent(impl_fn_def_id);
|
||||||
|
|
||||||
// FIXME fix the span, we probably want the def_id of the return type of the function
|
let decl = tcx
|
||||||
let span = tcx.def_span(impl_fn_def_id);
|
.hir()
|
||||||
|
.find_by_def_id(impl_fn_def_id)
|
||||||
|
.expect("expected item")
|
||||||
|
.fn_decl()
|
||||||
|
.expect("expected decl");
|
||||||
|
let span = match decl.output {
|
||||||
|
hir::FnRetTy::DefaultReturn(_) => tcx.def_span(impl_fn_def_id),
|
||||||
|
hir::FnRetTy::Return(ty) => ty.span,
|
||||||
|
};
|
||||||
let impl_assoc_ty = tcx.at(span).create_def(impl_local_def_id, DefPathData::ImplTraitAssocTy);
|
let impl_assoc_ty = tcx.at(span).create_def(impl_local_def_id, DefPathData::ImplTraitAssocTy);
|
||||||
|
|
||||||
let local_def_id = impl_assoc_ty.def_id();
|
let local_def_id = impl_assoc_ty.def_id();
|
||||||
|
|
|
@ -13,10 +13,10 @@ LL | where Self: 'b;
|
||||||
| ~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error[E0477]: the type `&'a I` does not fulfill the required lifetime
|
error[E0477]: the type `&'a I` does not fulfill the required lifetime
|
||||||
--> $DIR/bad-item-bound-within-rpitit.rs:19:5
|
--> $DIR/bad-item-bound-within-rpitit.rs:19:23
|
||||||
|
|
|
|
||||||
LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
|
LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: type must outlive the anonymous lifetime as defined here
|
note: type must outlive the anonymous lifetime as defined here
|
||||||
--> $DIR/bad-item-bound-within-rpitit.rs:10:28
|
--> $DIR/bad-item-bound-within-rpitit.rs:10:28
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue