Documentation

Common.Diagnostics.Code

Diagnostic codes: the stable identity of a diagnostic, independent of its wording.

rustc-shaped — E0042, W0003 — because that shape is already what a user expects to be able to look up (fugue explain E0042), grep a build log for, or write into a regression fixture's expectations. Wording changes freely; a code never does.

inductive Severity :

Whether a diagnostic stops the compile. The letter a code starts with.

  • error : Severity

    Fatal: E….

  • warning : Severity

    Non-fatal: W…, and suppressible via -Wno-<name>.

Instances For
    @[implicit_reducible]
    Equations
    Equations
    Instances For
      @[implicit_reducible]
      Equations
      Equations
      Instances For
        @[implicit_reducible]
        Equations
        Equations
        Instances For
          @[implicit_reducible]
          Equations

          The letter this severity's codes start with.

          Equations
          Instances For
            structure DiagnosticCode :

            A diagnostic's code: a severity and a four-digit number, e.g. E0042.

            A structure over Fin 10000 rather than a String, so a malformed code cannot be constructed in the first place — every code that exists renders in the one canonical form, and explain's argument either parses into this type or was never a code at all.

            • severity : Severity

              Error or warning.

            • number : Fin 10000

              The number, unique within the whole compiler (not per severity, not per stage).

            Instances For
              Equations
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Equations
                  Instances For
                    Equations
                    Instances For
                      Equations
                      Instances For

                        E0042: the letter, then the number padded to four digits.

                        Equations
                        Instances For

                          Parse a code back from its printed form; none if s is not one. Strict: the letter must be E/W, and exactly four digits must follow — E42 and banana are both simply not codes.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For