I've seen this error when building on Arch linux. I just disable it with this patch, never looked into why it happens:
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index c748bd36eba..eef2c349848 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -10,7 +10,6 @@ SET(SWIFT_SPHINX_PAPER_SIZE "letter"
CACHE STRING "Paper size for generated documentation")
SET(SPHINX_ARGS
- -W
-D latex_elements.papersize=${SWIFT_SPHINX_PAPER_SIZE}
-d ${CMAKE_BINARY_DIR}/doctrees)