rust/src/test/rustdoc/issue-32395.rs
Joshua Nelson fc4ca55291 Add from_def_id_and_kind reducing duplication in rustdoc
- Add `Item::from_hir_id_and_kind` convenience wrapper
- Make name parameter mandatory

  `tcx.opt_item_name` doesn't handle renames, so this is necessary
  for any item that could be renamed, which is almost all of them.

- Override visibilities to be `Inherited` for enum variants

  `tcx.visibility` returns the effective visibility, not the visibility
  that was written in the source code. `pub enum E { A, B }` always has
  public variants `A` and `B`, so there's no sense printing `pub` again.

- Don't duplicate handling of `Visibility::Crate`

  Instead, represent it as just another `Restricted` path.
2020-11-17 15:16:03 -05:00

15 lines
344 B
Rust

// aux-build:variant-struct.rs
// build-aux-docs
// ignore-cross-compile
// @has variant_struct/enum.Foo.html
// @!has - 'pub qux'
// @!has - 'pub(crate) qux'
// @!has - 'pub Bar'
extern crate variant_struct;
// @has issue_32395/enum.Foo.html
// @!has - 'pub qux'
// @!has - 'pub(crate) qux'
// @!has - 'pub Bar'
pub use variant_struct::Foo;