-
Notifications
You must be signed in to change notification settings - Fork 219
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
feat: Add deprecated
attribute
#2041
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.
Can you add tests showing that we can display custom deprecation messages which should be defined inside the #[deprecated]
tag? We should check that these are usable on foreign/oracle/builtin functions as well.
deprecated
attributedeprecated
attribute
Agree that we should add tests to see how this plays with other attributes. Also agree, it would be good to have the reason for deprecation, seems to be quite easy to add it like we have with Oracle attribute for example and retain that information until we need to emit a warming. It is not hard blocking for this PR though (wasn't in the issue that it resolves) |
As of now, only one attribute per function is currently supported. noir/crates/noirc_frontend/src/ast/expression.rs Lines 335 to 336 in ce37718
I'm not sure how to implement it correctly, but I'll give it a try. |
We can open up another issue for multiple attributes, as that may introduce scope creap. Can you just look into adding the message? |
Can you add a test which shows that this warning gets created correctly when parsing a program? |
@TomAFrench pending re-review |
Head branch was pushed to by a user without write access
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.
To match Rust, we should do #[deprecated = "message"]
rather than #[deprecated("message")]
https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
We'd probably want to adjust this for the other attributes as well though I think so this can be pushed into a diff PR.
* master: (53 commits) chore: Update `noir-source-resolver` to v1.1.3 (#1912) chore: Document `GeneratedAcir::more_than_eq_comparison` (#2085) chore: refresh ACIR test artifacts (#2091) feat: Add `deprecated` attribute (#2041) chore(ssa refactor): Implement `acir_gen` errors (#2071) chore: use witnesses from the generated acir in the ABI (#2095) fix: Fix methods not mutating fields (#2087) chore(nargo): Use Display impl for InputValue (#1990) feat: Make arrays and slices polymorphic over each other (#2070) feat: Remove an unnecessary witness in `mul_with_witness` (#2078) chore: document truncate (#2082) fix: avoid potential panic in `two_complement` (#2081) chore: Cleanup integration tests (#2074) chore: replace `Type::TypeVariable`, `Type::PolymorphicInteger`, and … (#2065) chore!: Require package names in `Nargo.toml` files (#2056) fix: Avoid non-determinism in defunctionalization (#2069) chore: change 'unnecessary pub' error to a warning (#2064) feat!: Update to ACVM 0.21.0 (#2051) chore: Rename execute tests for an accurate description (#2063) chore: Restore lost integration test (#2062) ...
* master: (75 commits) fix: Mutating a variable no longer mutates its copy (#2057) fix: Implement `.len()` in Acir-Gen (#2077) chore: clippy fixes (#2101) chore: Update `noir-source-resolver` to v1.1.3 (#1912) chore: Document `GeneratedAcir::more_than_eq_comparison` (#2085) chore: refresh ACIR test artifacts (#2091) feat: Add `deprecated` attribute (#2041) chore(ssa refactor): Implement `acir_gen` errors (#2071) chore: use witnesses from the generated acir in the ABI (#2095) fix: Fix methods not mutating fields (#2087) chore(nargo): Use Display impl for InputValue (#1990) feat: Make arrays and slices polymorphic over each other (#2070) feat: Remove an unnecessary witness in `mul_with_witness` (#2078) chore: document truncate (#2082) fix: avoid potential panic in `two_complement` (#2081) chore: Cleanup integration tests (#2074) chore: replace `Type::TypeVariable`, `Type::PolymorphicInteger`, and … (#2065) chore!: Require package names in `Nargo.toml` files (#2056) fix: Avoid non-determinism in defunctionalization (#2069) chore: change 'unnecessary pub' error to a warning (#2064) ...
* master: (75 commits) fix: Mutating a variable no longer mutates its copy (#2057) fix: Implement `.len()` in Acir-Gen (#2077) chore: clippy fixes (#2101) chore: Update `noir-source-resolver` to v1.1.3 (#1912) chore: Document `GeneratedAcir::more_than_eq_comparison` (#2085) chore: refresh ACIR test artifacts (#2091) feat: Add `deprecated` attribute (#2041) chore(ssa refactor): Implement `acir_gen` errors (#2071) chore: use witnesses from the generated acir in the ABI (#2095) fix: Fix methods not mutating fields (#2087) chore(nargo): Use Display impl for InputValue (#1990) feat: Make arrays and slices polymorphic over each other (#2070) feat: Remove an unnecessary witness in `mul_with_witness` (#2078) chore: document truncate (#2082) fix: avoid potential panic in `two_complement` (#2081) chore: Cleanup integration tests (#2074) chore: replace `Type::TypeVariable`, `Type::PolymorphicInteger`, and … (#2065) chore!: Require package names in `Nargo.toml` files (#2056) fix: Avoid non-determinism in defunctionalization (#2069) chore: change 'unnecessary pub' error to a warning (#2064) ...
Description
Problem
Resolves #879
PR Checklist
cargo fmt
on default settings.