Skip to content

[3/n] [daft-derive] attempt to better annotate semantic errors #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

sunshowers
Copy link
Collaborator

Add some span info to try and annotate semantic errors better (such as
highlighting the name of the field that's not diffable).

This isn't perfect for now because we still produce some call-site errors, but
at least we produce one error that's attributed directly to the field name so
rust-analyzer should be happy. I tried adding more bounds but ran into
rust-lang/rust#48214.

Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1

[skip ci]
@sunshowers sunshowers requested a review from andrewjstone March 7, 2025 23:57
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
Comment on lines +93 to +94
- name: Test without ui_test
run: just powerset nextest run -E 'not binary(ui_test)'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Had to use nextest for this because cargo test doesn't provide a way to exclude a binary.

Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
# The intent is to keep this updated as new stable versions are relased.

[toolchain]
channel = "1.85.0"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Had to check this in because the new file that got added produces slightly different output on 1.81.

Comment on lines +18 to +22
error[E0277]: the trait bound `NonDiffable: Diffable` is not satisfied
--> tests/fixtures/invalid/struct-field-not-diffable.rs:5:10
|
5 | #[derive(Diffable)]
| ^^^^^^^^ the trait `Diffable` is not implemented for `NonDiffable`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Wish I could squelch these errors -- sadly not possible at the moment due to rust-lang/rust#48214.

Copy link
Collaborator

@andrewjstone andrewjstone left a comment

Choose a reason for hiding this comment

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

Love it.

error[E0277]: the trait bound `NonDiffable: Diffable` is not satisfied
--> tests/fixtures/invalid/struct-field-not-diffable.rs:8:5
|
8 | b: NonDiffable,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is awesome :)

Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
@sunshowers sunshowers changed the base branch from sunshowers/spr/main.3n-daft-derive-attempt-to-better-annotate-semantic-errors to main March 10, 2025 21:04
@sunshowers sunshowers merged commit 7cb7e7a into main Mar 10, 2025
6 checks passed
@sunshowers sunshowers deleted the sunshowers/spr/3n-daft-derive-attempt-to-better-annotate-semantic-errors branch March 10, 2025 21:04
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