diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-04-22 13:28:43 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-05-03 12:49:43 -0400 |
| commit | 6eb4735acc50f58e501b42c5d75ae73b3d74b44d (patch) | |
| tree | 6e56d363316d940fe4f73a77023a89386e1f5a13 /src/librustdoc/doctest.rs | |
| parent | 78c963945aa35a76703bf62e024af2d85b2796e2 (diff) | |
| download | rust-6eb4735acc50f58e501b42c5d75ae73b3d74b44d.tar.gz rust-6eb4735acc50f58e501b42c5d75ae73b3d74b44d.zip | |
Unify rustc and rustdoc parsing of `cfg()`
This extracts a new `parse_cfg` function that's used between both. - Treat `#[doc(cfg(x), cfg(y))]` the same as `#[doc(cfg(x)] #[doc(cfg(y))]`. Previously it would be completely ignored. - Treat `#[doc(inline, cfg(x))]` the same as `#[doc(inline)] #[doc(cfg(x))]`. Previously, the cfg would be ignored. - Pass the cfg predicate through to rustc_expand to be validated Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
Diffstat (limited to 'src/librustdoc/doctest.rs')
| -rw-r--r-- | src/librustdoc/doctest.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 466d1b65406..69a47c5b67a 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -1095,7 +1095,7 @@ impl<'a, 'hir, 'tcx> HirCollector<'a, 'hir, 'tcx> { let ast_attrs = self.tcx.hir().attrs(hir_id); let mut attrs = Attributes::from_ast(ast_attrs, None); - if let Some(ref cfg) = ast_attrs.cfg(self.sess.diagnostic()) { + if let Some(ref cfg) = ast_attrs.cfg(self.sess) { if !cfg.matches(&self.sess.parse_sess, Some(&self.sess.features_untracked())) { return; } |
