[mojo] Enhance the StructTraits failed-to-find assert message.
Before this change the compile error that catches missing StructTraits specialization suggests confirming the header file is included properly as a potential fix. However, the build system automatically includes the header so it's a little confusing as to what this is suggesting might be wrong. After this change we specifically suggest the reader to check their build config to confirm the header is there and to confirm the StructTraits specialization is defined as expected. Bug: N/A Change-Id: I57d6eb8695fd4d21038f105b444c3ddde3205dcc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6349118 Reviewed-by: Fred Shih <ffred@chromium.org> Commit-Queue: Justin Lulejian <jlulejian@chromium.org> Cr-Commit-Position: refs/heads/main@{#1431767}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
525991731f
commit
c19aa50f80
@ -143,9 +143,15 @@ namespace mojo {
|
||||
//
|
||||
template <typename DataViewType, typename T>
|
||||
struct StructTraits {
|
||||
static_assert(internal::AlwaysFalse<T>::value,
|
||||
"Cannot find the mojo::StructTraits specialization. Did you "
|
||||
"forget to include the corresponding header file?");
|
||||
static_assert(
|
||||
internal::AlwaysFalse<T>::value,
|
||||
"Cannot find the mojo::StructTraits specialization. Did you confirm "
|
||||
"that:"
|
||||
" * the corresponding header file is included in your build file"
|
||||
" typemap?"
|
||||
" * the mojom::StructTraits specialization you've created is defined"
|
||||
" *exactly* the same as the mojom::StructTraits specialization"
|
||||
" specified in this stack trace?");
|
||||
};
|
||||
|
||||
} // namespace mojo
|
||||
|
Reference in New Issue
Block a user