Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace set_last_error with set_last_error_and_return #3941

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

noahmbright
Copy link
Contributor

@noahmbright noahmbright commented Oct 4, 2024

Took care of the simple patterns. Other patterns involved setting an error and then using write_int or setting metadata and returning -1. Unsure if those are in the scope of this change

Looks like this has conflicts with #3779, so I can update when how to handle that is decided.

Part of #3930.

Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the formatting changes unless they are from ./miri fmt (you may need to configure your vscode correctly with the settings from CONTRIBUTING.md)

Also use LibcError("foobar") everywhere while you're doing this change.

src/shims/unix/fs.rs Show resolved Hide resolved
src/shims/unix/fd.rs Outdated Show resolved Hide resolved
@oli-obk
Copy link
Contributor

oli-obk commented Oct 5, 2024

Ignore #3779, i'll rebase at some point

src/shims/unix/fd.rs Outdated Show resolved Hide resolved
src/shims/unix/fs.rs Outdated Show resolved Hide resolved
src/shims/unix/fs.rs Outdated Show resolved Hide resolved
src/shims/unix/fs.rs Outdated Show resolved Hide resolved
src/shims/unix/fs.rs Outdated Show resolved Hide resolved
@RalfJung
Copy link
Member

Not sure why the comments above have all been marked as resolved -- in the PR they are definitely still unresolved.

@rustbot author

@rustbot rustbot added the S-waiting-on-author Status: Waiting for the PR author to address review comments label Oct 12, 2024
@noahmbright
Copy link
Contributor Author

Not sure why the comments above have all been marked as resolved -- in the PR they are definitely still unresolved.

Yes, sorry for the wait. How do you want to handle the InterpResult<'tcx, i64> vs . InterpResult<'tcx, Scalar> issue in my comment above? Once I fix that I'll push the update.

@RalfJung
Copy link
Member

Which comment?

@RalfJung
Copy link
Member

It's possible that you have an unsubmitted review, then only you can see those comments. They are marked with "pending". There should be a button somewhere to submit the review and make the comments visible to everyone.

src/shims/unix/fs.rs Outdated Show resolved Hide resolved
src/shims/unix/fd.rs Outdated Show resolved Hide resolved
@noahmbright
Copy link
Contributor Author

Again sorry about the wait and the careless mistakes, but I added two commits, one a small formatting fix, and in the other I added set_last_error_and_return_i64 and fixed the type issues I introduced. Diff is smaller now too so hopefully this will be easier to re-review.

@RalfJung
Copy link
Member

RalfJung commented Oct 19, 2024

There are unfortunately conflicts with the master branch, could you take care of them with a rebase?
Then write @rustbot ready to initiate the next round of review.

@noahmbright
Copy link
Contributor Author

There are unfortunately conflicts with the master branch, could you take care of them with a rebase? Then write @rustbot ready to initiate the next round of review.

Of course. All the conflicts are something like this:

<<<<<<< unix_shims
            return this.set_last_error_and_return_i32(ErrorKind::PermissionDenied);
=======
            this.set_last_error(ErrorKind::PermissionDenied)?;
            return interp_ok(Scalar::from_i32(-1));
>>>>>>> master

I can wrap interp_ok(this.set_last_error_and_return_*(e)) where these all occur, and we'll have an interp_ok(InterpResult<'tcx, Scalar>). Does that sound alright for the resolution?

@RalfJung
Copy link
Member

return this.set_last_error_and_return_i32(ErrorKind::PermissionDenied); looks like the right resolution for that example.

@noahmbright
Copy link
Contributor Author

return this.set_last_error_and_return_i32(ErrorKind::PermissionDenied); looks like the right resolution for that example.

I agree, after seeing the new changes while rebasing. @rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels Oct 19, 2024
Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this all looks correct but there is one spot where we can make it a bit more compact. :)

Please also squash the commits (with git rebase --keep-base).

src/shims/unix/linux/epoll.rs Outdated Show resolved Hide resolved
@RalfJung
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels Oct 20, 2024
Add `set_last_error_and_return_i64`, change calls from
`this.libc_eval` to `LibcError`, and replace pairs of
`set_last_error` and returning values of the right type
with the new helper functions
@noahmbright
Copy link
Contributor Author

Thanks, this all looks correct but there is one spot where we can make it a bit more compact. :)

Good catch. Thank you for the close reviews, this should have been much simpler. If I'm still welcome, I'll make sure my next PR goes more smoothly

@RalfJung
Copy link
Member

Looks good, thanks for the PR!
@bors r+

Thank you for the close reviews, this should have been much simpler. If I'm still welcome, I'll make sure my next PR goes more smoothly

Sure thing, hickups happen. :) Just be careful and ask us rather than making guesses if you're not sure about something. :D When submitting a PR, it is a very good idea to list which things in the PR you are least sure about -- that greatly helps focus the review effort.

@bors
Copy link
Contributor

bors commented Oct 21, 2024

📌 Commit ca5c26d has been approved by RalfJung

It is now in the queue for this repository.

bors added a commit that referenced this pull request Oct 21, 2024
Replace set_last_error with set_last_error_and_return

Took care of the simple patterns. Other patterns involved setting an error and then using `write_int` or setting metadata and returning -1. Unsure if those are in the scope of this change

Looks like this has conflicts with #3779, so I can update when how to handle that is decided.

Part of #3930.
@bors
Copy link
Contributor

bors commented Oct 21, 2024

⌛ Testing commit ca5c26d with merge 0a916c5...

@bors
Copy link
Contributor

bors commented Oct 21, 2024

👀 Test was successful, but fast-forwarding failed: 422 1 review requesting changes by reviewers with write access.

@RalfJung
Copy link
Member

That's odd... @rust-lang/infra bors has a problem if we leave a "changes required" review, and then the changes are done? CI is green but the PR has not been pushed to master.

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's see if this helps github.

@RalfJung
Copy link
Member

@bors retry

@RalfJung RalfJung closed this Oct 21, 2024
@RalfJung RalfJung reopened this Oct 21, 2024
@bors
Copy link
Contributor

bors commented Oct 21, 2024

⌛ Testing commit ca5c26d with merge f026d57...

bors added a commit that referenced this pull request Oct 21, 2024
Replace set_last_error with set_last_error_and_return

Took care of the simple patterns. Other patterns involved setting an error and then using `write_int` or setting metadata and returning -1. Unsure if those are in the scope of this change

Looks like this has conflicts with #3779, so I can update when how to handle that is decided.

Part of #3930.
@Kobzol
Copy link
Contributor

Kobzol commented Oct 21, 2024

Wtf, I never saw this error before.. Anyway, what do you think about switching miri from bors to merge queues? xD

@RalfJung
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 21, 2024

💡 This pull request was already approved, no need to approve it again.

  • This pull request previously failed. You should add more commits to fix the bug, or use retry to trigger a build again.

@bors
Copy link
Contributor

bors commented Oct 21, 2024

📌 Commit ca5c26d has been approved by RalfJung

It is now in the queue for this repository.

@RalfJung
Copy link
Member

RalfJung commented Oct 21, 2024

Wtf, I never saw this error before.. Anyway, what do you think about switching miri from bors to merge queues? xD

Yeah someone just needs to put in the work for that and I don't currently have the time.^^
Cc #3882

bors added a commit that referenced this pull request Oct 21, 2024
Replace set_last_error with set_last_error_and_return

Took care of the simple patterns. Other patterns involved setting an error and then using `write_int` or setting metadata and returning -1. Unsure if those are in the scope of this change

Looks like this has conflicts with #3779, so I can update when how to handle that is decided.

Part of #3930.
@bors
Copy link
Contributor

bors commented Oct 21, 2024

⌛ Testing commit ca5c26d with merge 652e860...

@bors
Copy link
Contributor

bors commented Oct 21, 2024

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 652e860 to master...

@bors
Copy link
Contributor

bors commented Oct 21, 2024

👀 Test was successful, but fast-forwarding failed: 422 1 review requesting changes and 1 approving review by reviewers with write access.

@RalfJung
Copy link
Member

@oli-obk I think we need to you to send an "approving" review or so, otherwise this PR can't land...

Is that really how github reviews work? Nobody else can approve a PR after a team member left a "changes required" review? That's a complete disaster.

@oli-obk
Copy link
Contributor

oli-obk commented Oct 21, 2024

you should be able to dismiss my review in the github ui (i approved it now, but for the future)

@bors r+

@bors
Copy link
Contributor

bors commented Oct 21, 2024

💡 This pull request was already approved, no need to approve it again.

  • This pull request previously failed. You should add more commits to fix the bug, or use retry to trigger a build again.

@bors
Copy link
Contributor

bors commented Oct 21, 2024

📌 Commit ca5c26d has been approved by oli-obk

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Oct 21, 2024

⌛ Testing commit ca5c26d with merge 0ebdb0c...

@RalfJung
Copy link
Member

Where is the "dismiss review" button?

@RalfJung
Copy link
Member

Ah I think I found it. That's quite well-hidden...

@bors
Copy link
Contributor

bors commented Oct 21, 2024

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 0ebdb0c to master...

1 similar comment
@bors
Copy link
Contributor

bors commented Oct 21, 2024

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 0ebdb0c to master...

@bors bors merged commit 0ebdb0c into rust-lang:master Oct 21, 2024
15 checks passed
@bors
Copy link
Contributor

bors commented Oct 21, 2024

👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: Waiting for the PR author to address review comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants