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

Rust Contracts syntax #137134

Open
codeOverFlow opened this issue Feb 16, 2025 · 1 comment
Open

Rust Contracts syntax #137134

codeOverFlow opened this issue Feb 16, 2025 · 1 comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. F-contracts `#![feature(contracts)]` T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@codeOverFlow
Copy link

Hello, maybe a newbie question, but why use attributes instead of language syntax similar to where clause, and similar to what Ada does ?

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 16, 2025
@fmease fmease added C-discussion Category: Discussion or questions that doesn't represent real issues. F-contracts `#![feature(contracts)]` T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Feb 16, 2025
@fmease
Copy link
Member

fmease commented Feb 16, 2025

Without speaking for the parties involved in designing and implementing this feature, #![feature(contracts)] is a highly experimental feature that's not backed by an RFC (yet). The syntax is likely temporary. CC this paragraph from compiler MCP 759:

My example above has leveraged an attribute-based surface syntax. It is possible that we will find that other non-attribute construct are more appropriate for some situations. (For example, I have seen suggestions that type invariants would be better off framed as an instance of a trait that a type implements.)

See also

@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. F-contracts `#![feature(contracts)]` T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants