-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
update error generic member access #243
Conversation
For what it's worth, the test failure on this PR is what I expected based on my attempts to use a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Is rust-lang/rust#113464 (comment) the failure that this is intended to address? That error is caused by a bug in rustc's bootstrap where, in some stages, the standard library that gets picked up if $RUSTC is run from a build script is not the standard library that the rest of the crate will get built against.
That needs to get fixed in bootstrap.
I would prefer not to accept this PR because it implies that the iteration loop on rust-lang/rust#113464 involves creating a thiserror PR, reviewing/merging the PR, publishing a release of thiserror, upgrading thiserror in rustc's Cargo.lock, and then updating the standard library PR, which is not reasonable.
I would be open to a different thiserror PR that does not rewrite any of the macro, but just changes build.rs to detect when it is being built as a dependency of rustc (hopefully there is an environment variable or cfg for this) and permanently disables unstable functionality in that case. Rustc tools would not be able to get backtraces from thiserror even after the Provider refactor, until either bootstrap's handling of the build script environment is fixed or the generic member access API stabilizes.
First off, thanks so much for the quick feedback!
Yes, in part. But strangely enough I can't seem to reproduce the issue 🤔 -- I also wanted to prep this PR as a courtesy since I am proposing a change to the nightly rust that will break nightly builds of
Okay, let's say I figure out how to reproduce the
Does that mean you want to keep Anyway, I'll ask on Zulip if there is any way to detect that code is being compiled as part of a rust toolchain build so we can do as you suggest. Thanks again for the feedback! |
That's right — after the changed API is in nightly, I can reopen this (and the CI will pass). |
Okay cool. Also, just FYI -- I realized why I can no longer reproduce that bootstrap bug. It's because one of the latest commits on my rust PR actually removes the |
The purpose of this PR is to align
thiserror
with changes being made to theprovide_any
anderror_generic_member_access
features in nightly Rust, specifically:Provider
trait of theprovide_any
feature has been rejected.provide_any
(namely, theDemand
/Request
type) RFC has been effectively merged into theerror_generic_member_access
RFCI've verified this PR builds as expected and the tests run with both the
stable
andnightly
toolchains as well as a custom-built toolchain using my draft PR that removes theProvider
trait from nightly rust. The only thing I've found doesn't work with the currentnightly
toolchain are the tests intests/test_backtrace.rs
(because those depend on the rename ofRequest
toDemand
).Builds continue to compile for
nightly
because of the compile probe inbuild.rs
that only sets theerror_generic_member_access
if the probe code compiles, which it won't until my draft PR to rust is merged. This could potentially be a problem forthiserror
nightly users who have come to rely on the backtrace functionality whenprovide_any
/error_generic_member_access
is enabled.I have thought a bit about merge strategy considerations here since there are rust tools that (in nightly rust) rely on
thiserror
which won't build without the changes in this PR (or at least I haven't figured out a way to get them to build yet). Because of this chicken-and-egg problem and becausethiserror
continues to build onnightly
branch (albeit without the nifty generic member access to backtraces), my suggestion is to merge this change prior to my draft PR to rust. The only alternative I can think of for that PR is to first pin all rust dependencies and transitivethiserror
dependencies to the git commit in this PR; but I don't think that would be very palatable for rust maintainers.