Bug 275265
| Summary: | Alias WTF::Expected against std::expected | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Abrar Rahman Protyasha <a_protyasha> |
| Component: | WebKit Misc. | Assignee: | Abrar Rahman Protyasha <a_protyasha> |
| Status: | NEW | ||
| Severity: | Normal | CC: | a_protyasha, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=275190 | ||
| Bug Depends on: | 263122 | ||
| Bug Blocks: | |||
Abrar Rahman Protyasha
As a first step towards replacing `WTF::Expected` altogether.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/129411820>
Abrar Rahman Protyasha
Pull request: https://github.com/WebKit/WebKit/pull/29633
Abrar Rahman Protyasha
This is blocked by the fact that most of our types do not have non-throwing move constructors (or, they're not marked as such).
If either the result or the error type of `std::expected<Result, Error>` does not satisfy `std::is_nothrow_move_constructible_v`, then the copy assignment operator of that `std::expected` specialization is deleted.
Abrar Rahman Protyasha
Here's a representative error message:
```
In file included from /Users/aprotyas/dev/safari/OpenSource/WebKitBuild/Debug/DerivedSources/WebCore/unified-sources/UnifiedSource86.cpp:8:
/Users/aprotyas/dev/safari/OpenSource/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp:138:21: error: object of type 'ExceptionOr<Ref<Database>>' cannot be assigned because its copy assignment operator is implicitly deleted
138 | backend = tryToOpenDatabaseBackend(document, name, expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, RetryOpenDatabase);
In file included from /Users/aprotyas/dev/safari/OpenSource/WebKitBuild/Debug/DerivedSources/WebCore/unified-sources/UnifiedSource86.cpp:1:
In file included from /Users/aprotyas/dev/safari/OpenSource/Source/WebCore/Modules/webcodecs/WebCodecsVideoEncoder.cpp:27:
In file included from /Users/aprotyas/dev/safari/OpenSource/Source/WebCore/Modules/webcodecs/WebCodecsVideoEncoder.h:31:
In file included from /Users/aprotyas/dev/safari/OpenSource/Source/WebCore/dom/EventTarget.h:36:
/Users/aprotyas/dev/safari/OpenSource/Source/WebCore/dom/ExceptionOr.h:51:37: note: copy assignment operator of 'ExceptionOr<WTF::Ref<WebCore::Database>>' is implicitly deleted because field 'm_value' has a deleted copy assignment operator
51 | Expected<ReturnType, Exception> m_value;
In file included from /Users/aprotyas/dev/safari/OpenSource/WebKitBuild/Debug/DerivedSources/WebCore/unified-sources/UnifiedSource86.cpp:1:
In file included from /Users/aprotyas/dev/safari/OpenSource/Source/WebCore/WebCorePrefix.h:165:
In file included from /Users/aprotyas/dev/safari/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/HashMap.h:24:
In file included from /Users/aprotyas/dev/safari/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/Forward.h:24:
In file included from /Users/aprotyas/dev/safari/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/Expected.h:30:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.Internal.sdk/usr/include/c++/v1/expected:44:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.Internal.sdk/usr/include/c++/v1/__expected/expected.h:628:45: note: 'operator=' has been explicitly marked deleted here
628 | _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete;
```