Skip to content

Commit 8c4bcac

Browse files
authored
hide internal types from rustdoc (#1432)
1 parent 5333196 commit 8c4bcac

File tree

14 files changed

+43
-65
lines changed

14 files changed

+43
-65
lines changed

crates/codegen/runtime/cargo/crate/src/runtime/bindings/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub type UserFileLocation = metaslang_bindings::UserFileLocation<KindTypes>;
5252
pub type BuiltInLocation = metaslang_bindings::BuiltInLocation;
5353

5454
#[cfg(feature = "__private_testing_utils")]
55-
#[allow(missing_docs)]
55+
#[doc(hidden)]
5656
// Create a new `BindingGraphBuilder` with the specified language version and resolver.
5757
// Exposed to test the functionality, but users should use the `CompilationBuilder` instead.
5858
pub fn create_with_resolver(
@@ -78,7 +78,7 @@ pub(crate) fn create_with_resolver_internal(
7878
}
7979

8080
#[cfg(feature = "__private_testing_utils")]
81-
#[allow(missing_docs)]
81+
#[doc(hidden)]
8282
pub fn get_binding_rules() -> &'static str {
8383
binding_rules::BINDING_RULES_SOURCE
8484
}

crates/codegen/runtime/cargo/crate/src/runtime/cst/mod.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@ pub use nonterminal_kind::NonterminalKind;
2121
pub use rewriter::BaseRewriter;
2222
pub use terminal_kind::TerminalKind;
2323

24-
// These derives are because default #[derive(...)] on a generic type implements only the trait
25-
// with default bounds also implied for the generic types as well, i.e.
26-
//
27-
// #[derive(Clone)] // expands to `impl<T: Clone> Clone for MyOption<T> { ... }` (notice the `T: Clone`)
28-
// struct MyOption<T>(Option<T>);
29-
//
30-
// This assumes that the underlying data type uses this internally, however it's only used as a
31-
// type container/marker.
32-
//
33-
// A slightly more "correct" approach would be to implement the traits while skipping the bounds for
34-
// the type marker, however this can be more noisy
35-
#[allow(missing_docs)]
24+
/// The base type of all nonterminals, terminals, and edges.
3625
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize)]
37-
pub enum KindTypes {}
26+
pub enum KindTypes {
27+
// These derives are because default #[derive(...)] on a generic type implements only the trait
28+
// with default bounds also implied for the generic types as well, i.e.
29+
//
30+
// #[derive(Clone)] // expands to `impl<T: Clone> Clone for MyOption<T> { ... }` (notice the `T: Clone`)
31+
// struct MyOption<T>(Option<T>);
32+
//
33+
// This assumes that the underlying data type uses this internally, however it's only used as a
34+
// type container/marker.
35+
//
36+
// A slightly more "correct" approach would be to implement the traits while skipping the bounds for
37+
// the type marker, however this can be more noisy
38+
}
3839

3940
impl metaslang_cst::kinds::KindTypes for KindTypes {
4041
type NonterminalKind = NonterminalKind;

crates/codegen/runtime/cargo/crate/src/runtime/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub mod bindings;
22
pub mod compilation;
33
pub mod cst;
44
#[cfg(feature = "__private_ariadne_errors")]
5-
#[allow(missing_docs)]
5+
#[doc(hidden)]
66
pub mod diagnostic;
77
pub mod parser;
88
pub mod utils;

crates/metaslang/bindings/generated/public_api.txt

Lines changed: 0 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/metaslang/bindings/src/graph/definition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<KT: KindTypes + 'static> Definition<KT> {
7474
}
7575

7676
#[cfg(feature = "__private_testing_utils")]
77-
#[allow(missing_docs)]
77+
#[doc(hidden)]
7878
impl<KT: KindTypes + 'static> Definition<KT> {
7979
pub fn get_cursor(&self) -> &Cursor<KT> {
8080
self.internal_get_cursor()

crates/metaslang/bindings/src/graph/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl<KT: KindTypes + 'static> BindingGraph<KT> {
8787
}
8888

8989
#[cfg(feature = "__private_testing_utils")]
90-
#[allow(missing_docs)]
90+
#[doc(hidden)]
9191
impl<KT: KindTypes + 'static> BindingGraph<KT> {
9292
pub fn all_definitions(self: &Rc<Self>) -> impl Iterator<Item = Definition<KT>> + '_ {
9393
self.graph.iter_definitions().map(|handle| Definition {

crates/metaslang/bindings/src/graph/reference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<KT: KindTypes + 'static> Reference<KT> {
5858
}
5959

6060
#[cfg(feature = "__private_testing_utils")]
61-
#[allow(missing_docs)]
61+
#[doc(hidden)]
6262
impl<KT: KindTypes + 'static> Reference<KT> {
6363
pub fn get_cursor(&self) -> &Cursor<KT> {
6464
self.internal_get_cursor()

crates/metaslang/bindings/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
//!
55
//! It's based on the [stack graph library](https://docs.rs/stack-graphs/latest/stack_graphs/index.html).
66
7-
// This module is not part of the public API.
8-
#[allow(missing_docs)]
7+
#[doc(hidden)]
98
mod builder;
109
mod graph;
1110

11+
#[doc(hidden)]
1212
pub use builder::{
1313
BindingGraphBuilder, FileGraphBuilder, GraphHandle, PathResolver, ScopeGraphBuilder,
1414
};

crates/metaslang/cst/src/kinds.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ pub trait EdgeLabelExtensions: BaseKind + Default {}
5959

6060
/// The base type of all nonterminals, terminals, and edges.
6161
pub trait KindTypes: std::fmt::Debug + Clone + PartialEq {
62-
#[allow(missing_docs)]
62+
/// The enum type representing nonterminal kinds.
6363
type NonterminalKind: NonterminalKindExtensions;
64-
#[allow(missing_docs)]
64+
/// The enum type representing terminal kinds.
6565
type TerminalKind: TerminalKindExtensions;
66-
#[allow(missing_docs)]
66+
/// The enum type representing edge labels.
6767
type EdgeLabel: EdgeLabelExtensions;
6868
}
6969

crates/solidity/outputs/cargo/crate/src/backend/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(missing_docs)]
2-
31
pub mod l1_structured_ast;
42
pub mod l2_flat_contracts;
53

0 commit comments

Comments
 (0)