about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-07-13 07:21:23 +0200
committerGitHub <noreply@github.com>2025-07-13 07:21:23 +0200
commitf8bbc91f76f9e936755cd5b4add3cbfedc933c34 (patch)
tree614ecc9d238ee0ff48e102233d7c19b511f78917
parent95b5a082cc1b41f7c30ba2a002461e775af583a9 (diff)
parent507fd38a3fd2121d4a39df6fcf14eb50f868d471 (diff)
downloadrust-f8bbc91f76f9e936755cd5b4add3cbfedc933c34.tar.gz
rust-f8bbc91f76f9e936755cd5b4add3cbfedc933c34.zip
Rollup merge of #143814 - lolbinarycat:htmldocck-negative-err, r=fmease
htmldocck: better error messages for some negative directives

Previously it was saying "did not match pattern" even when the error was that it did match the pattern, and it wasn't supposed to.
-rwxr-xr-xsrc/etc/htmldocck.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py
index 1806e2be9bb..ddbd256a0d8 100755
--- a/src/etc/htmldocck.py
+++ b/src/etc/htmldocck.py
@@ -564,10 +564,14 @@ def check_command(c, cache):
             # hasraw/matchesraw <path> <pat> = string test
             elif len(c.args) == 2 and "raw" in c.cmd:
                 cerr = "`PATTERN` did not match"
+                if c.negated:
+                    cerr = "`PATTERN` unexpectedly matched"
                 ret = check_string(cache.get_file(c.args[0]), c.args[1], regexp)
             # has/matches <path> <pat> <match> = XML tree test
             elif len(c.args) == 3 and "raw" not in c.cmd:
                 cerr = "`XPATH PATTERN` did not match"
+                if c.negated:
+                    cerr = "`XPATH PATTERN` unexpectedly matched"
                 ret = get_nb_matching_elements(cache, c, regexp, True) != 0
             else:
                 raise InvalidCheck("Invalid number of {} arguments".format(c.cmd))