Skip to content

Commit 00a32b2

Browse files
committed
Omit pub for inlined variant-struct fields
1 parent 0215681 commit 00a32b2

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

src/librustdoc/clean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,7 @@ impl<'tcx> Clean<Item> for ty::VariantDefData<'tcx, 'static> {
18851885
source: Span::empty(),
18861886
name: Some(field.name.clean(cx)),
18871887
attrs: Vec::new(),
1888-
visibility: Some(hir::Public),
1888+
visibility: Some(field.vis),
18891889
// FIXME: this is not accurate, we need an id for
18901890
// the specific field but we're using the id
18911891
// for the whole variant. Thus we read the

src/test/auxiliary/variant-struct.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub enum Foo {
12+
Bar {
13+
qux: (),
14+
}
15+
}

src/test/rustdoc/issue-32395.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:variant-struct.rs
12+
// build-aux-docs
13+
// ignore-cross-compile
14+
15+
// @has variant_struct/enum.Foo.html
16+
// @!has - 'pub qux'
17+
extern crate variant_struct;
18+
19+
// @has issue_32395/enum.Foo.html
20+
// @!has - 'pub qux'
21+
pub use variant_struct::Foo;

0 commit comments

Comments
 (0)