]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #107171 - petrochenkov:encattrs, r=cjgillot
authorYuki Okushi <jtitor@2k36.org>
Fri, 27 Jan 2023 03:57:54 +0000 (12:57 +0900)
committerGitHub <noreply@github.com>
Fri, 27 Jan 2023 03:57:54 +0000 (12:57 +0900)
rustc_metadata: Fix `encode_attrs`

This function didn't do what the authors intended it to do.

- Due to `move` in the closure `is_public` wasn't captured by mutalbe reference and wasn't used as a cache.
- Due to iterator cloning all the `should_encode_attr` logic run for the second time to calculate `may_have_doc_links`

This PR fixes these issues, and calculates all the needed attribute flags in one go.

(Noticed while implementing https://github.com/rust-lang/rust/pull/107136.)

1  2 
compiler/rustc_metadata/src/rmeta/encoder.rs