obi1kenobi / cargo-semver-checks

Scan your Rust crate for semver violations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New lints: item that was previously public API is now `#[doc(hidden)]` i.e. no longer public API

obi1kenobi opened this issue · comments

For example, uncommenting the #[doc(hidden)] line is a breaking change since the struct is no longer considered public API, even though it is public. This is because some non-public API may need to be accessible from outside its crate, for example in macro-heavy crates like pyo3.

// #[doc(hidden)]
pub struct Example;

We need lints for this kind of situation for:

  • structs: #587
  • enums: #593
  • unions: #679
  • functions: #594
  • traits: #595
  • statics: #712
  • module-level constants: #690, #703
  • ImplOwner (struct/enum/union) inherent associated functions / methods: #821
  • ImplOwner associated constants: #820
  • struct fields (#649)
  • #596
  • enum tuple variant fields: #685
  • enum struct variant fields: #687
  • trait associated functions / methods: #684
  • trait associated types: #776
  • trait associated constants: #779

Remaining work item

We should figure out what are the appropriate semantics of marking an impl block #[doc(hidden)] with respect to the block's contents. Are the contents considered not public API anymore? Is #[doc(hidden)] simply ignored on that impl block?

The action items here are:

  • Figure out how rustdoc itself treats items defined inside a #[doc(hidden)] impl block. Does it think they are hidden, or no?
  • Adjust all affected lints accordingly (e.g. #820, #821)

Four lints to go here, and we can close this issue! 🚀