[tint] Add empty SuccessType to utils/result/

Use it in the IR validator.

Change-Id: I016a843ed40e0f697eaa818351e4bab04416645a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/143322
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/lang/core/ir/validator.cc b/src/tint/lang/core/ir/validator.cc
index 02f1892..ddda53f 100644
--- a/src/tint/lang/core/ir/validator.cc
+++ b/src/tint/lang/core/ir/validator.cc
@@ -71,7 +71,7 @@
     mod_.disassembly_file = std::make_unique<Source::File>("", dis_.Disassemble());
 }
 
-utils::Result<Success, diag::List> Validator::IsValid() {
+utils::Result<utils::SuccessType, diag::List> Validator::IsValid() {
     CheckRootBlock(mod_.root_block);
 
     for (auto* func : mod_.functions) {
@@ -84,7 +84,7 @@
                               "# Disassembly\n" + mod_.disassembly_file->content.data, {});
         return std::move(diagnostics_);
     }
-    return Success{};
+    return utils::Success;
 }
 
 std::string Validator::InstError(Instruction* inst, std::string err) {
@@ -621,7 +621,7 @@
     return nullptr;
 }
 
-utils::Result<Success, diag::List> Validate(Module& mod) {
+utils::Result<utils::SuccessType, diag::List> Validate(Module& mod) {
     Validator v(mod);
     return v.IsValid();
 }
diff --git a/src/tint/lang/core/ir/validator.h b/src/tint/lang/core/ir/validator.h
index cbd1611..d0698c5 100644
--- a/src/tint/lang/core/ir/validator.h
+++ b/src/tint/lang/core/ir/validator.h
@@ -37,13 +37,10 @@
 
 namespace tint::ir {
 
-/// Signifies the validation completed successfully
-struct Success {};
-
 /// Validates that a given IR module is correctly formed
 /// @param mod the module to validate
 /// @returns true on success, an error result otherwise
-utils::Result<Success, diag::List> Validate(Module& mod);
+utils::Result<utils::SuccessType, diag::List> Validate(Module& mod);
 
 /// The core IR validator.
 class Validator {
@@ -58,7 +55,7 @@
     /// Runs the validator over the module provided during construction
     /// @returns the results of validation, either a success result object or the diagnostics of
     /// validation failures.
-    utils::Result<Success, diag::List> IsValid();
+    utils::Result<utils::SuccessType, diag::List> IsValid();
 
   protected:
     /// @param inst the instruction
diff --git a/src/tint/utils/result/result.h b/src/tint/utils/result/result.h
index 8117ad1..ef52312 100644
--- a/src/tint/utils/result/result.h
+++ b/src/tint/utils/result/result.h
@@ -23,6 +23,12 @@
 
 namespace tint::utils {
 
+/// Empty structure that can be used as the SUCCESS_TYPE for a Result.
+struct SuccessType {};
+
+/// An instance of SuccessType that can be used as a generic success value for a Result.
+static constexpr const SuccessType Success;
+
 /// Empty structure used as the default FAILURE_TYPE for a Result.
 struct FailureType {};