Skip to content

Automatically check_for_backend when not in release#5

Open
acksly wants to merge 11 commits into
Ten0:for_stockly_mainfrom
acksly:for_stockly_main
Open

Automatically check_for_backend when not in release#5
acksly wants to merge 11 commits into
Ten0:for_stockly_mainfrom
acksly:for_stockly_main

Conversation

@acksly
Copy link
Copy Markdown

@acksly acksly commented Jun 11, 2025

No description provided.

Comment thread diesel_derives/src/selectable.rs Outdated
Comment thread diesel_derives/src/selectable.rs Outdated
let check_function = if let Some(backends) = if cfg!(debug_assertions) {
Some(Cow::Owned(syn::parse::Parser::parse2(
syn::punctuated::Punctuated::parse_terminated,
quote!(diesel::pg::Pg).into(),
Copy link
Copy Markdown
Owner

@Ten0 Ten0 Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please benchmark the impact of this on compilation time?

Testing process:

  • Disable RA
  • Clean build
  • Add a new field to a Selectable impl (rust-analyzer disabled)
  • Time cargo check
  • Change diesel revision to this fork
  • Remove new field
  • Clean build
  • Add new field again
  • Time cargo check

@acksly acksly force-pushed the for_stockly_main branch from 58973e3 to bd8e926 Compare July 7, 2025 12:18
Comment on lines +53 to +56
Some(Cow::Owned(syn::parse::Parser::parse2(
syn::punctuated::Punctuated::parse_terminated,
quote!(diesel::pg::Pg).into(),
)?))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like this can use the parse_quote! macro.

#[cfg(not(feature = "automatic-check-for-backend"))]
let backend = model.check_for_backend.as_ref();

let check_function = if let Some(ref backends) = backend {
Copy link
Copy Markdown
Owner

@Ten0 Ten0 Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming: at this line it seems a single backend turns into multiple backends

It's either "a check_for_backend statement" or "several backends".

backend => check_for_backend

.collect::<Result<Vec<_>>>()?;

let check_function = if let Some(ref backends) = model.check_for_backend {
#[cfg(feature = "automatic-check-for-backend")]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr title doesn't seem to match with the change anymore



[dependencies]
diesel = { path = "../diesel/", features = ["postgres"] }
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this using the feature so probably it's supposed to get removed?

Copy link
Copy Markdown
Owner

@Ten0 Ten0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm apart from this

@Ten0 Ten0 force-pushed the for_stockly_main branch from 98b051f to 07230ef Compare May 5, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants