Expose more information in get_body_with_borrowck_facts#111840
Expose more information in get_body_with_borrowck_facts#111840bors merged 6 commits intorust-lang:masterfrom
get_body_with_borrowck_facts#111840Conversation
oli-obk
left a comment
There was a problem hiding this comment.
These changes look reasonable to me. I cannot promise we'll keep the API around, but I do not foresee this being a maintenance issue for us, so likely some form of it will keep getting provided.
I think they might. They look very similar to some local changes that I have. Thank you very much for the ping. |
|
please rebase, then we can land this |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
|
📌 Commit 6a8112e1f8c02d89fe78667209183f570c502fac has been approved by It is now in the queue for this repository. |
This comment has been minimized.
This comment has been minimized.
|
@voidc would it be possible to slightly extend this and make the |
|
The moment a change is done to a PR it is taken off the queue, so nothing is happening for now until I actually review and r+ it again |
|
I think that the PR should be ready to merge again now, but let's wait for confirmation from @voidc |
|
Yes, the PR is ready @rustbot ready |
|
@bors r+ |
…earth Rollup of 5 pull requests Successful merges: - rust-lang#111741 (Use `ObligationCtxt` in custom type ops) - rust-lang#111840 (Expose more information in `get_body_with_borrowck_facts`) - rust-lang#111876 (Roll compiler_builtins to 0.1.92) - rust-lang#111912 (Use `Option::is_some_and` and `Result::is_ok_and` in the compiler ) - rust-lang#111915 (libtest: Improve error when missing `-Zunstable-options`) r? `@ghost` `@rustbot` modify labels: rollup
Depending on what you want to achieve, I don't believe pub trait T {}
struct S<'a>(&'a ());
impl<'a> T for S<'a> {}
fn foo() -> impl T {
let x = ();
S(&x) //~ ERROR `x` does not live long enough
}The |
Verification tools for Rust such as, for example, Creusot or Prusti would benefit from having access to more information computed by the borrow checker.
As a first step in that direction, #86977 added the
get_body_with_borrowck_factsAPI, allowing compiler consumers to obtain amir::Bodywith accompanying borrow checker information.At RustVerify 2023, multiple people working on verification tools expressed their need for a more comprehensive API.
While eventually borrow information could be part of Stable MIR, in the meantime, this PR proposes a more limited approach, extending the existing
get_body_with_borrowck_factsAPI.In summary, we propose the following changes:
BorrowSetand theRegionInferenceContextinBodyWithBorrowckFactsborrows_out_of_scope_at_locationmapThis is similar to #108328 but smaller in scope.
@smoelius Do you think these changes would also be sufficient for your needs?
r? @oli-obk
cc @JonasAlaif