diff --git a/gcc/rust/checks/errors/borrowck/rust-bir-builder-internal.h b/gcc/rust/checks/errors/borrowck/rust-bir-builder-internal.h index 877c34ba450a..e542c4ebb18d 100644 --- a/gcc/rust/checks/errors/borrowck/rust-bir-builder-internal.h +++ b/gcc/rust/checks/errors/borrowck/rust-bir-builder-internal.h @@ -307,7 +307,7 @@ class AbstractBuilder location_t location) { auto mutability = ty->as ()->mutability (); - auto loan = ctx.place_db.add_loan ({mutability, place_id}); + auto loan = ctx.place_db.add_loan ({mutability, place_id, location}); push_tmp_assignment (new BorrowExpr (place_id, loan, ctx.place_db.get_next_free_region ()), ty, location); @@ -600,7 +600,8 @@ class AbstractExprBuilder : public AbstractBuilder, { // TODO: deduplicate with borrow_place auto loan = ctx.place_db.add_loan ( - {ty->as ()->mutability (), place_id}); + {ty->as ()->mutability (), place_id, + location}); return_expr (new BorrowExpr (place_id, loan, ctx.place_db.get_next_free_region ()), ty, location); diff --git a/gcc/rust/checks/errors/borrowck/rust-bir-place.h b/gcc/rust/checks/errors/borrowck/rust-bir-place.h index 752c8f42c007..06faa77a6fa0 100644 --- a/gcc/rust/checks/errors/borrowck/rust-bir-place.h +++ b/gcc/rust/checks/errors/borrowck/rust-bir-place.h @@ -162,6 +162,7 @@ struct Loan { Mutability mutability; PlaceId place; + location_t location; }; /** Allocated places and keeps track of paths. */