From 8420f89f417750f9324327518af7fb78c7ca2c22 Mon Sep 17 00:00:00 2001 From: Conor Bronsdon <120674402+conorbronsdon@users.noreply.github.com> Date: Fri, 31 Jul 2026 14:31:45 -0700 Subject: [PATCH 1/2] Replace the removed String.write static call with the String constructor Mojo's stdlib made String.write an instance method -- both overloads now take `mut self` -- so the old static form no longer resolves and the test module fails to parse. String.__init__ takes a variadic pack of Writable arguments and Error conforms to Writable, so String(e) is the direct replacement. Test-only; nothing in src/ used the static form. Co-Authored-By: Claude Opus 5 (1M context) --- test/test_errors.mojo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_errors.mojo b/test/test_errors.mojo index 92ebbd2..833d65f 100644 --- a/test/test_errors.mojo +++ b/test/test_errors.mojo @@ -12,7 +12,7 @@ def _assert_lc(source: String, offset: Int, line: Int, col: Int) raises: def _msg(e: Error) -> String: - return String.write(e) + return String(e) def _strict_drain(var source: String) raises: From 3864bbc7a2a1e90ae12b4930699875da91b68b9e Mon Sep 17 00:00:00 2001 From: Conor Bronsdon <120674402+conorbronsdon@users.noreply.github.com> Date: Fri, 31 Jul 2026 14:35:01 -0700 Subject: [PATCH 2/2] Build the stripped string into a temporary before reassigning s.strip() borrows s while the String initializer is constructing s as its result, which the compiler now rejects: error: aliasing values passed immutably to 'args' argument and constructed as a result in 'String' initializer call Constructing into a temporary and moving it in separates the borrow from the assignment. This is why mojo-xml's conformance job was already red on 7/29, before the String.write breakage in the previous commit. Co-Authored-By: Claude Opus 5 (1M context) --- test/anchor_dump.mojo | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/anchor_dump.mojo b/test/anchor_dump.mojo index cceb6fb..68a5a70 100644 --- a/test/anchor_dump.mojo +++ b/test/anchor_dump.mojo @@ -15,7 +15,8 @@ from xml import fromstring, Element def _esc(s_in: String, strip: Bool) -> String: var s = s_in if strip: - s = String(s.strip()) + var stripped = String(s.strip()) + s = stripped^ # order matters: backslash first var out = String() for ch in s.codepoint_slices():