-
Notifications
You must be signed in to change notification settings - Fork 144
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
util: Add tl::expected type #2317
Conversation
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.
Added in other GCC folks, are we allowed to do this in GCC?
Another option might be to take your optional implementation and reuse it to bootstrap a Result<Value, Error> class helper.
I am not sure how i feel about it my initial thought is we might have issues using this with GCC but on the other hand it could be a useful interface. @dkm and @tschwinge any opinion? |
This has recently been discussed in GCC/Rust IRC, 2023-06-15: https://github.com/Rust-GCC/gccrs/wiki/IRC-2023-06-15. |
The outcome of that -- per my free interpretation -- was something like this: Should talk to libstdc++ maintainers to determine whether doing this via existing (or future) libstdc++ code is feasible, whilst maintaining GCC 4.8 compatibility, and otherwise it's deemed OKish to import external code. |
One thing that's going to be useful for future maintenance: first import the external file(s) verbatim, and then do local changes in separate commit(s). For some (?) external imports, $ find -name LOCAL_PATCHES
./libffi/LOCAL_PATCHES
./libsanitizer/LOCAL_PATCHES
./libstdc++-v3/src/c++17/fast_float/LOCAL_PATCHES
./libstdc++-v3/src/c++17/ryu/LOCAL_PATCHES |
@tschwinge this is going to create commits that do not compile, as the original implementation uses exceptions which we explicitly disable. So I'm not sure how needed this is? |
There's no such problem: the file will be unused initially. :-) |
ah, that's a good point! :D |
I'll split up the commit then |
Directly taken from https://github.com/TartanLlama/expected. gcc/rust/ChangeLog: * util/expected.h: New file.
bdbf94e
to
986ff27
Compare
Disable exceptions and remove inclusion of poisoned headers. gcc/rust/ChangeLog: * util/expected.h: Adapt class to GCC requirements.
Directly taken from https://github.com/TartanLlama/expected and adapted
slightly for our use case.
gcc/rust/ChangeLog:
This type offers a type similar to
std::expected
, which is only available since C++23. It will be useful for cleaning up our error handling, chaining errors together, and easier control flow in general.This will be used for the upcoming experimental name resolution algorithm.