Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove potential cfgs duplicates #66959

Merged
merged 1 commit into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/librustdoc/clean/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ impl ops::Not for Cfg {

impl ops::BitAndAssign for Cfg {
fn bitand_assign(&mut self, other: Cfg) {
if *self == other {
return;
}
match (self, other) {
(&mut Cfg::False, _) | (_, Cfg::True) => {},
(s, Cfg::False) => *s = Cfg::False,
Expand Down Expand Up @@ -238,6 +241,9 @@ impl ops::BitAnd for Cfg {

impl ops::BitOrAssign for Cfg {
fn bitor_assign(&mut self, other: Cfg) {
if *self == other {
return;
}
match (self, other) {
(&mut Cfg::True, _) | (_, Cfg::False) => {},
(s, Cfg::True) => *s = Cfg::True,
Expand Down
15 changes: 15 additions & 0 deletions src/test/rustdoc/duplicate-cfg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![crate_name = "foo"]
#![feature(doc_cfg)]

// @has 'foo/index.html'
// @!has '-' '//*[@class="stab portability"]' 'feature="sync" and'
// @has '-' '//*[@class="stab portability"]' 'feature="sync"'
#[doc(cfg(feature = "sync"))]
#[doc(cfg(feature = "sync"))]
pub struct Foo;

#[doc(cfg(feature = "sync"))]
pub mod bar {
#[doc(cfg(feature = "sync"))]
pub struct Bar;
}