Merge pull request #19162 from hvitved/rust/to-string-non-rec

Rust: Make `Element.toString` non-recursive
This commit is contained in:
Tom Hvitved
2025-04-01 15:31:18 +02:00
committed by GitHub
12 changed files with 40 additions and 13 deletions

View File

@@ -30,7 +30,11 @@ module Generated {
* Gets the string representation of this element.
*/
cached
final string toString() { result = this.toStringImpl() }
final string toString() {
result = this.toStringImpl() and
// recursion guard to prevent `toString` from being defined recursively
(exists(any(Element e).toStringImpl()) implies any())
}
/**
* INTERNAL: Do not use.