diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-06-15 17:44:53 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-06-16 09:51:48 +1000 |
| commit | 969a2cc8c1e83ce93a13ab126c4519a72405bb69 (patch) | |
| tree | 8cc8f0db26f6b0ba0dfd6819b720a2fc8ca0eff1 /src/librustdoc/html/static/js/source-script.js | |
| parent | ca983054e19afd74d63c3ed37997f3bf30fe85d0 (diff) | |
| download | rust-969a2cc8c1e83ce93a13ab126c4519a72405bb69.tar.gz rust-969a2cc8c1e83ce93a13ab126c4519a72405bb69.zip | |
Fix quadratic behaviour in the `MissingDoc` lint.
The `MissingDoc` lint has quadratic behaviour when processing doc comments. This is a problem for large doc comments (e.g. 1000+ lines) when `deny(missing_code)` is enabled. A 1000-line doc comment using `//!` comments is represented as 1000 attributes on an item. The lint machinery iterates over each attribute with `visit_attribute`. `MissingDoc`'s impl of that function calls `with_lint_attrs`, which calls `enter_attrs`, which iterates over all 1000 attributes looking for a `doc(hidden)` attribute. I.e. for every attribute we iterate over all the other attributes. The fix is simple: don't call `with_lint_attrs` on attributes. This makes sense: `with_lint_attrs` is intended to iterate over the attributes on a language fragment like a statement or expression, but it doesn't need to be called on attributes themselves.
Diffstat (limited to 'src/librustdoc/html/static/js/source-script.js')
0 files changed, 0 insertions, 0 deletions
