Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bon-macros/src/builder/builder_gen/builder_derives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl BuilderGenCtx {
let ty = member.underlying_norm_ty();

quote! {
#bon::__private::derives::clone_member::<#ty>(
#bon::__::derives::clone_member::<#ty>(
&self.#named_members_field.#member_index
)
}
Expand Down Expand Up @@ -170,7 +170,7 @@ impl BuilderGenCtx {
if let Some(value) = &self.#named_members_field.#member_index {
output.field(
#member_ident_str,
#bon::__private::derives::as_dyn_debug::<#member_ty>(value)
#bon::__::derives::as_dyn_debug::<#member_ty>(value)
);
}
})
Expand All @@ -182,7 +182,7 @@ impl BuilderGenCtx {
Some(quote! {
output.field(
#member_ident_str,
#bon::__private::derives::as_dyn_debug::<#member_ty>(
#bon::__::derives::as_dyn_debug::<#member_ty>(
&self.#start_fn_args_field.#member_index
)
);
Expand All @@ -201,7 +201,7 @@ impl BuilderGenCtx {
quote! {
output.field(
"self",
#bon::__private::derives::as_dyn_debug::<#ty>(
#bon::__::derives::as_dyn_debug::<#ty>(
&self.#receiver_field
)
);
Expand Down
2 changes: 1 addition & 1 deletion bon-macros/src/builder/builder_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl BuilderGenCtx {
let builder_derives = self.builder_derives();

let default_allows = syn::parse_quote!(#[allow(
// We have a `deprecated` lint on all `bon::__private` items which we
// We have a `deprecated` lint on all `bon::__` items which we
// use in the generated code extensively
deprecated
)]);
Expand Down
4 changes: 2 additions & 2 deletions bon-macros/src/builder/builder_gen/state_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ impl<'a> StateModGenCtx<'a> {
#( #state_mod_docs )*
#vis mod #state_mod_ident {
#[doc(inline)]
#vis_child use #bon::__private::{IsSet, IsUnset};
use #bon::__private::{Set, Unset};
#vis_child use #bon::__::{IsSet, IsUnset};
use #bon::__::{Set, Unset};

mod sealed {
#vis_child_child struct Sealed;
Expand Down
2 changes: 1 addition & 1 deletion bon-macros/src/util/ide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl CompletionsSchema {
// to avoid Rust Analyzer from providing completions for the
// `self` keyword in the `use` statement. It works because
// `use self::self` is not a valid syntax.
use #bon::__private::ide #(::#module_name)* ::*;
use #bon::__::ide #(::#module_name)* ::*;
use self::{ #( #paths as _, )* };
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion bon/src/__private/mod.rs → bon/src/__/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod cfg_eval;
// This reexport is a private implementation detail and should not be used
// directly! This reexport may change or be removed at any time between
// patch releases. Use the export from your generated builder's state module
// directly instead of using this reexport from `bon::__private`.
// directly instead of using this reexport from `bon::__`.
pub use crate::builder_state::{IsSet, IsUnset};
pub use rustversion;

Expand Down
4 changes: 2 additions & 2 deletions bon/src/builder_state.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//! The items here are intentionally defined in a private module not inside of the
//! [`crate::__private`] module. This is because that module is marked with `#[deprecated]`
//! [`crate::__`] module. This is because that module is marked with `#[deprecated]`
//! which makes all items defined in that module also deprecated.
//!
//! This is not the desired behavior for the items defined here. They are not deprecated,
//! and they are expected to be exposed to the users. However, the users must not reference
//! them through the `bon` crate. Instead, they should use the re-exports from the state
//! module generated for the builder.

use crate::__private::{Sealed, Set, Unset};
use crate::__::{Sealed, Set, Unset};

/// Marker trait that indicates that the member is set, i.e. at least
/// one of its setters was called.
Expand Down
6 changes: 3 additions & 3 deletions bon/src/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
#[allow(edition_2024_expr_fragment_specifier)]
macro_rules! vec {
() => ($crate::__private::alloc::vec::Vec::new());
($($item:expr),+ $(,)?) => ($crate::__private::alloc::vec![$(::core::convert::Into::into($item)),+ ]);
() => ($crate::__::alloc::vec::Vec::new());
($($item:expr),+ $(,)?) => ($crate::__::alloc::vec![$(::core::convert::Into::into($item)),+ ]);
}

/// Creates a fixed-size array literal with each element converted with [`Into`].
Expand Down Expand Up @@ -74,7 +74,7 @@ macro_rules! arr {
#[cfg(test)]
mod tests {
#[cfg(feature = "alloc")]
use crate::__private::alloc::{string::String, vec::Vec};
use crate::__::alloc::{string::String, vec::Vec};
use core::num::NonZeroU8;

#[cfg(feature = "alloc")]
Expand Down
4 changes: 2 additions & 2 deletions bon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ pub use bon_macros::{bon, builder, map, set, Builder};
mod collections;

#[doc(hidden)]
#[deprecated = "the items from the `bon::__private` module are an implementation detail; \
#[deprecated = "the items from the `bon::__` module are an implementation detail; \
they should not be used directly; if you found a need for this, then you are probably \
doing something wrong; feel free to open an issue/discussion in our GitHub repository \
(https://github.com/elastio/bon) or ask for help in our Discord server \
(https://discord.gg/QcBYSamw4c)"]
pub mod __private;
pub mod __;

mod builder_state;
44 changes: 22 additions & 22 deletions bon/tests/integration/ui/compile_fail/attr_derive.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ error[E0277]: the trait bound `NoTraitImpls: Clone` is not satisfied
| ^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoTraitImpls`
|
note: required by a bound in `clone_member`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn clone_member<T: Clone>(member: &Option<T>) -> Option<T> {
| ^^^^^ required by this bound in `clone_member`
Expand All @@ -52,7 +52,7 @@ error[E0277]: the trait bound `NoTraitImpls: Clone` is not satisfied
| ^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoTraitImpls`
|
note: required by a bound in `clone_member`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn clone_member<T: Clone>(member: &Option<T>) -> Option<T> {
| ^^^^^ required by this bound in `clone_member`
Expand All @@ -69,7 +69,7 @@ error[E0277]: the trait bound `NoTraitImpls: Clone` is not satisfied
| ^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoTraitImpls`
|
note: required by a bound in `clone_member`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn clone_member<T: Clone>(member: &Option<T>) -> Option<T> {
| ^^^^^ required by this bound in `clone_member`
Expand All @@ -88,7 +88,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand All @@ -107,7 +107,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand All @@ -126,7 +126,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand All @@ -145,7 +145,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand Down Expand Up @@ -174,7 +174,7 @@ error[E0277]: the trait bound `NoTraitImpls: Clone` is not satisfied
| ^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoTraitImpls`
|
note: required by a bound in `clone_member`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn clone_member<T: Clone>(member: &Option<T>) -> Option<T> {
| ^^^^^ required by this bound in `clone_member`
Expand All @@ -191,7 +191,7 @@ error[E0277]: the trait bound `NoTraitImpls: Clone` is not satisfied
| ^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoTraitImpls`
|
note: required by a bound in `clone_member`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn clone_member<T: Clone>(member: &Option<T>) -> Option<T> {
| ^^^^^ required by this bound in `clone_member`
Expand All @@ -208,7 +208,7 @@ error[E0277]: the trait bound `NoTraitImpls: Clone` is not satisfied
| ^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoTraitImpls`
|
note: required by a bound in `clone_member`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn clone_member<T: Clone>(member: &Option<T>) -> Option<T> {
| ^^^^^ required by this bound in `clone_member`
Expand All @@ -227,7 +227,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand All @@ -246,7 +246,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand All @@ -265,7 +265,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand All @@ -284,7 +284,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand Down Expand Up @@ -319,7 +319,7 @@ error[E0277]: the trait bound `NoTraitImpls: Clone` is not satisfied
| ^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoTraitImpls`
|
note: required by a bound in `clone_member`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn clone_member<T: Clone>(member: &Option<T>) -> Option<T> {
| ^^^^^ required by this bound in `clone_member`
Expand All @@ -336,7 +336,7 @@ error[E0277]: the trait bound `NoTraitImpls: Clone` is not satisfied
| ^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoTraitImpls`
|
note: required by a bound in `clone_member`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn clone_member<T: Clone>(member: &Option<T>) -> Option<T> {
| ^^^^^ required by this bound in `clone_member`
Expand All @@ -353,7 +353,7 @@ error[E0277]: the trait bound `NoTraitImpls: Clone` is not satisfied
| ^^^^^^^^^^^^ the trait `Clone` is not implemented for `NoTraitImpls`
|
note: required by a bound in `clone_member`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn clone_member<T: Clone>(member: &Option<T>) -> Option<T> {
| ^^^^^ required by this bound in `clone_member`
Expand All @@ -372,7 +372,7 @@ error[E0277]: `StructContainsNonTrait` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `StructContainsNonTrait`
= note: add `#[derive(Debug)]` to `StructContainsNonTrait` or manually `impl Debug for StructContainsNonTrait`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand All @@ -386,7 +386,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand All @@ -405,7 +405,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand All @@ -424,7 +424,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand All @@ -443,7 +443,7 @@ error[E0277]: `NoTraitImpls` doesn't implement `Debug`
= help: the trait `Debug` is not implemented for `NoTraitImpls`
= note: add `#[derive(Debug)]` to `NoTraitImpls` or manually `impl Debug for NoTraitImpls`
note: required by a bound in `as_dyn_debug`
--> src/__private/derives.rs
--> src/__/derives.rs
|
| pub fn as_dyn_debug<T: Debug>(member: &T) -> &dyn Debug {
| ^^^^^ required by this bound in `as_dyn_debug`
Expand Down