Skip to content

Commit

Permalink
Rollup merge of rust-lang#66959 - GuillaumeGomez:cfg-duplicates, r=eddyb
Browse files Browse the repository at this point in the history
Remove potential cfgs duplicates

Fixes rust-lang#66921.

Before going any further (the issue seems to be linked to metadata as far as I can tell). Do you think this is the good place to do it or should it be done before?

r? @eddyb
  • Loading branch information
JohnTitor authored Dec 6, 2019
2 parents 2a4f638 + a8ec620 commit afd9e95
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 afd9e95

Please sign in to comment.