-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(vrl): mark set_semantic_meaning impure #21896
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sfackler! Did you have a chance to test that the warning went away?
I have not - what's the easiest way to do that? |
You can build Vector from this PR and use a Remap with
|
Huh - it seems like this change doesn't actually fix the warning? I had to add a second statement to the VRL script (does it treat the last expression as an implicit return to the caller?) for the warning to trigger at all, but with that setup it warns both on master and this branch:
|
Oh - looks like the lint doesn't actually check if the function is pure or not: https://github.com/vectordotdev/vrl/blob/e3852056d7f2f52a6127c5407ab840f52e545a88/src/compiler/unused_expression_checker.rs#L354-L372 |
Yes, the result of the last expression is considered "used". I think we need to add But we should also merge this PR, since this a 'strange' function which modifies internal state. |
config.yaml
Outdated
@@ -0,0 +1,17 @@ | |||
sources: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also git rm
this one. Probably was committed by accident.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, fixed
116e28c
to
992428d
Compare
Summary
The VRL compiler previously warned about the unused result of
set_semantic_meaning
, even though it doesn't return anything due to it being incorrectly considered a pure function.Change Type
Is this a breaking change?
How did you test this PR?
Does this PR include user facing changes?
Checklist
Cargo.lock
), pleaserun
dd-rust-license-tool write
to regenerate the license inventory and commit the changes (if any). More details here.References
Closes #21887