Skip to content

Conversation

sunfishcode
Copy link
Member

Define a NotHandle type, that implements std::error::Error, and use
it as the error type in HandleOrNull and HandleOrInvalid.

This addresses this concern.

r? @joshtriplett

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 27, 2022
@rust-log-analyzer

This comment has been minimized.

sunfishcode added a commit to sunfishcode/io-lifetimes that referenced this pull request Mar 29, 2022
Introduce the `InvalidHandleError` and `NullHandleError` error types,
corresponding to rust-lang/rust#95387.
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Apr 13, 2022
@joshtriplett
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 13, 2022

📌 Commit 733ef08 has been approved by joshtriplett

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 13, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 14, 2022
…rror-type, r=joshtriplett

Define a dedicated error type for `HandleOrNull` and `HandleOrInvalid`.

Define a `NotHandle` type, that implements `std::error::Error`, and use
it as the error type in `HandleOrNull` and `HandleOrInvalid`.

This addresses [this concern](rust-lang#87074 (comment)).

r? `@joshtriplett`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 14, 2022
…rror-type, r=joshtriplett

Define a dedicated error type for `HandleOrNull` and `HandleOrInvalid`.

Define a `NotHandle` type, that implements `std::error::Error`, and use
it as the error type in `HandleOrNull` and `HandleOrInvalid`.

This addresses [this concern](rust-lang#87074 (comment)).

r? ``@joshtriplett``
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 14, 2022
…rror-type, r=joshtriplett

Define a dedicated error type for `HandleOrNull` and `HandleOrInvalid`.

Define a `NotHandle` type, that implements `std::error::Error`, and use
it as the error type in `HandleOrNull` and `HandleOrInvalid`.

This addresses [this concern](rust-lang#87074 (comment)).

r? ```@joshtriplett```
Define a `NotHandle` type, that implements `std::error::Error`, and use
it as the error type in `HandleOrNull` and `HandleOrInvalid`.
Also, make the display messages more specific, and remove the `Copy`
implementation.
This test's expected stderr now includes a count of the number of types
that implment `Error`. This PR introduces two new types, so increment
the number by two.
@sunfishcode sunfishcode force-pushed the sunfishcode/handle-or-error-type branch from 733ef08 to e886145 Compare April 15, 2022 04:59
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-12 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
37 error: aborting due to 2 previous errors


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coercion/coerce-issue-49593-box-never.nofallback/coerce-issue-49593-box-never.nofallback.stderr
To only update this specific test, also pass `--test-args coercion/coerce-issue-49593-box-never.rs`


error in revision `nofallback`: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/coercion/coerce-issue-49593-box-never.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "nofallback" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coercion/coerce-issue-49593-box-never.nofallback" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/coercion/coerce-issue-49593-box-never.nofallback/auxiliary"
stdout: none
--- stderr -------------------------------
error[E0277]: the trait bound `(): std::error::Error` is not satisfied
   |
   |
LL |     /* *mut $0 is coerced to Box<dyn Error> here */ Box::<_ /* ! */>::new(x)
   |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
   = help: the following other types implement trait `std::error::Error`:
             !
             &'a T
             AccessError
---

error[E0277]: the trait bound `(): std::error::Error` is not satisfied
  --> /checkout/src/test/ui/coercion/coerce-issue-49593-box-never.rs:22:49
   |
LL |     /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x)
   |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
   = help: the following other types implement trait `std::error::Error`:
             !
             &'a T
             AccessError

@sunfishcode
Copy link
Member Author

sunfishcode commented Apr 15, 2022

The rollup PR failed because of the diff

-	           and 43 others
+	           and 45 others

I added a commit to fix this, but now this PR is failing with the diff

-	           and 45 others
+	           and 43 others

For now, I'll close this PR and wait until whatever other PR it's racing against settles in, and then re-open it.

@sunfishcode
Copy link
Member Author

After rebasing this, github doesn't apparently allow me to reopen this PR, so I created a new one: #96195.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 19, 2022
…rror-type, r=joshtriplett

 Define a dedicated error type for `HandleOrNull` and `HandleOrInvalid`.

Define `NullHandleError` and `InvalidHandleError` types, that implement std::error::Error, and use them as the error types in `HandleOrNull` and `HandleOrInvalid`,

This addresses [this concern](rust-lang#87074 (comment)).

This is the same as rust-lang#95387.

r? `@joshtriplett`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 19, 2022
…rror-type, r=joshtriplett

 Define a dedicated error type for `HandleOrNull` and `HandleOrInvalid`.

Define `NullHandleError` and `InvalidHandleError` types, that implement std::error::Error, and use them as the error types in `HandleOrNull` and `HandleOrInvalid`,

This addresses [this concern](rust-lang#87074 (comment)).

This is the same as rust-lang#95387.

r? ``@joshtriplett``
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 19, 2022
…rror-type, r=joshtriplett

 Define a dedicated error type for `HandleOrNull` and `HandleOrInvalid`.

Define `NullHandleError` and `InvalidHandleError` types, that implement std::error::Error, and use them as the error types in `HandleOrNull` and `HandleOrInvalid`,

This addresses [this concern](rust-lang#87074 (comment)).

This is the same as rust-lang#95387.

r? ```@joshtriplett```
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 27, 2022
…or-type, r=joshtriplett

 Define a dedicated error type for `HandleOrNull` and `HandleOrInvalid`.

Define `NullHandleError` and `InvalidHandleError` types, that implement std::error::Error, and use them as the error types in `HandleOrNull` and `HandleOrInvalid`,

This addresses [this concern](rust-lang#87074 (comment)).

This is the same as rust-lang#95387.

r? `@joshtriplett`
sunfishcode added a commit to sunfishcode/io-lifetimes that referenced this pull request Apr 29, 2022
Introduce the `InvalidHandleError` and `NullHandleError` error types,
corresponding to rust-lang/rust#95387.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants