const fn support, #[selector = sol("foo()")] attribute#1216
const fn support, #[selector = sol("foo()")] attribute#1216cburgdorf merged 29 commits intoargotorg:masterfrom
#[selector = sol("foo()")] attribute#1216Conversation
|
Could this be relevant to the optimization stuff happening in #1211 ? |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52584dc36d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
56972dd to
3fcbdd2
Compare
#[selector = sol("foo()")] attribute
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48c71fce9d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a71e322001
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| match name.data(self.db).as_str() { | ||
| "__as_bytes" => Ok(Some(self.eval_intrinsic_as_bytes(expr, ret_ty, args)?)), | ||
| "__keccak256" => Ok(Some(self.eval_intrinsic_keccak(expr, ret_ty, args)?)), | ||
| _ => Ok(None), |
There was a problem hiding this comment.
Evaluate const size_of calls in CTFE
core::intrinsic::size_of was made a const fn, but eval_extern_const_fn only handles __as_bytes/__keccak256, so a const item like const N: u256 = core::size_of<u256>() (or a const generic/array length) now type-checks yet fails CTFE and gets reported as “const value must be known.” Since size-of is always computable at compile time, this is a regression for const contexts; consider adding a size_of case here that returns the layout size (similar to the MIR lowering) so CTFE can resolve it.
Useful? React with 👍 / 👎.
#[selector = sol("foo()")] attribute#[selector = sol("foo()")] attribute
cburgdorf
left a comment
There was a problem hiding this comment.
Looks good! Let's merge that thang!
This adds support for
externand fe-definedconst fns, with support for basic code.For example:
The rhs of attributes can now be a const expr, so we can do this:
Limitations (for now):