github / codeql

CodeQL: the libraries and queries that power security researchers around the world, as well as code scanning in GitHub Advanced Security
https://codeql.github.com
MIT License
7.72k stars 1.55k forks source link

Rust: add some `toString` implementations #18035

Open redsun82 opened 3 days ago

redsun82 commented 3 days ago

This sets up better toString implementations to give more meaningful test expectations and AST printing results.

This is by no means systematic and complete. Most notably almost all type representations are still missing, and some less frequent Exprs, but it should get us started.

The strategy is to make toString as close as possible to the rust syntax, but

What is considered a "simple" subnode (causing it to be part of the parent toString) can be tweaked by implementing toAbbreviatedString(), which returns ... by default. Currently simple subnodes are:

This means for example that