Auto merge of #55069 - matthewjasper:explain-free-region-liveness, r=nikomatsakis
[NLL] Use new region infer errors when explaining borrows Use the new free region infer errors for explaining borrows This gives at least some explanation for why a borrow is expected to last for a certain free region. Also: * Reports E0373: "closure may outlive the current function" with NLL. * Special cases the case of returning a reference to (or value referencing) a local variable or temporary (E0515). * Special case assigning a reference to a local variable in a closure to a captured variable. (E0521) Closes #51026 - `regions-nested-fns-2.rs` isn't changed to that diagnostic, since that would not be the correct error here. Closes #51169 cc #53882 - The error is (IMO) better now, but it could be better when we trace lifetimes in these error messages. r? @nikomatsakis cc @pnkfelix
Showing
此差异已折叠。
此差异已折叠。
此差异已折叠。
想要评论请 注册 或 登录