Skip to content

Commit

Permalink
Remove potential cfgs duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Dec 4, 2019
1 parent 8f1bbd6 commit a8ec620
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
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;
}

0 comments on commit a8ec620

Please sign in to comment.