Skip to content

Commit afd9e95

Browse files
authored
Rollup merge of #66959 - GuillaumeGomez:cfg-duplicates, r=eddyb
Remove potential cfgs duplicates Fixes #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
2 parents 2a4f638 + a8ec620 commit afd9e95

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/librustdoc/clean/cfg.rs

+6
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ impl ops::Not for Cfg {
209209

210210
impl ops::BitAndAssign for Cfg {
211211
fn bitand_assign(&mut self, other: Cfg) {
212+
if *self == other {
213+
return;
214+
}
212215
match (self, other) {
213216
(&mut Cfg::False, _) | (_, Cfg::True) => {},
214217
(s, Cfg::False) => *s = Cfg::False,
@@ -238,6 +241,9 @@ impl ops::BitAnd for Cfg {
238241

239242
impl ops::BitOrAssign for Cfg {
240243
fn bitor_assign(&mut self, other: Cfg) {
244+
if *self == other {
245+
return;
246+
}
241247
match (self, other) {
242248
(&mut Cfg::True, _) | (_, Cfg::False) => {},
243249
(s, Cfg::True) => *s = Cfg::True,

src/test/rustdoc/duplicate-cfg.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![crate_name = "foo"]
2+
#![feature(doc_cfg)]
3+
4+
// @has 'foo/index.html'
5+
// @!has '-' '//*[@class="stab portability"]' 'feature="sync" and'
6+
// @has '-' '//*[@class="stab portability"]' 'feature="sync"'
7+
#[doc(cfg(feature = "sync"))]
8+
#[doc(cfg(feature = "sync"))]
9+
pub struct Foo;
10+
11+
#[doc(cfg(feature = "sync"))]
12+
pub mod bar {
13+
#[doc(cfg(feature = "sync"))]
14+
pub struct Bar;
15+
}

0 commit comments

Comments
 (0)