Skip to content

Conversation

@Ddystopia
Copy link

  1. When you are not using generated project() method, compiler warns about fields of the projection struct being never read.
  2. If you have methods that start with underscore like _marker: PhantomData<T>, rust analyzer (not rustc) gives me non_snake_casewarning. This is because of this internal method:$fvis unsafe fn [<_project $field>]<'__slot>. It uses _as a separator but$field` may have it too.

@Ddystopia
Copy link
Author

I'm running tests and they pass, so I can't use this:

note: If the actual output is the correct output you can bless it by rerunning
your test with the environment variable TRYBUILD=overwrite

Can you please suggest how to run tests correctly from my machine?

@BennoLossin
Copy link
Member

BennoLossin commented Oct 31, 2025

The test that fails verifies that the generated output hasn't changed. But since you changed it, you should also adjust the test (by using TRYBUILD=overwrite).

Edit: Ah I forgot to mention that you need to specify RUSTFLAGS="--cfg UI_TESTS" to enable the ui tests (they only have a stable output with the latest nightly version)

@Ddystopia
Copy link
Author

Do you need me to change the commit message or something like that?

@BennoLossin
Copy link
Member

Yes please :) sorry, I'm pretty busy at the moment.

1. Macro generates a projection structure and if user will not use it,
   unused warnings for each field are emitted.
2. If a field of a struct has underscore prefix (e.g. `_marker`),
   a method `_project__marker` will be generated. This is because
   `_` is unconditionally placed between `project` and a field name.
   It generates a `non_snake_case` warning due to two underscores.
   Changing the name itself would be a breaking change and require more
   powerful macros.

Signed-off-by: Oleksandr Babak <alexanderbabak@proton.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants