Skip to content
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

Do not merge: check if we sometimes fail to get snippets #13941

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

samueltardieu
Copy link
Contributor

@samueltardieu samueltardieu commented Jan 4, 2025

I am looking at snippets and placeholders, and was wondering in which case a snippet could fail. This is to run a lintcheck in CI conditions. Not obtaining a snippet will result into an ICE.

changelog: none

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 4, 2025
@samueltardieu samueltardieu marked this pull request as draft January 4, 2025 17:25
@samueltardieu samueltardieu force-pushed the push-zlrztsxvwkmx branch 2 times, most recently from 4b9a44e to 478a59c Compare January 4, 2025 18:25
@samueltardieu samueltardieu force-pushed the push-zlrztsxvwkmx branch 3 times, most recently from 182d959 to 421485d Compare January 4, 2025 18:39
@matthiaskrgr
Copy link
Member

@samueltardieu
Copy link
Contributor Author

Indeed. Another thing I realized when exchanging with @GuillaumeGomez is that we appear to use snippet_opt() on dummy spans quite a lot (and it returns Some("")), which deserves to be investigated.

@GuillaumeGomez
Copy link
Member

Sounds like a case where we should return None instead of an empty string.

@samueltardieu
Copy link
Contributor Author

Sounds like a case where we should return None instead of an empty string.

Yes, but we return Some("") because the underlying call (from the compiler libs) returns Ok("")

@GuillaumeGomez
Copy link
Member

Adding a .is_dummy() check on the span would allow to return early and not have to check this case.

The code should not attempt to obtain a snippet by capping the
function signature span with its identifier span without checking that
they are in the same context.
github-merge-queue bot pushed a commit that referenced this pull request Jan 10, 2025
The code should not attempt to obtain a snippet by capping the function
signature span with its identifier span without checking that they are
in the same context.

This is the only instance I could identify where placeholders were used
instead of the real snippet when running the CI lintcheck. Moreover, the
placeholders were not even used, as they snippet was obtained
prematurely.

Found in the context of #13941

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants