-
Notifications
You must be signed in to change notification settings - Fork 604
No std support #3297
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
No std support #3297
Conversation
bf40b17
to
ff9a60e
Compare
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.
Reviewable status: 0 of 42 files reviewed, 1 unresolved discussion (waiting on @tdelabro)
crates/cairo-lang-project/Cargo.toml
line 11 at r2 (raw file):
[dependencies] cairo-lang-filesystem = { path = "../cairo-lang-filesystem", version = "1.1.0" } cairo-lang-utils = { path = "../cairo-lang-utils", default-features = false }
Why did u remove the version?
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.
Reviewable status: 0 of 42 files reviewed, 3 unresolved discussions (waiting on @tdelabro)
Cargo.toml
line 73 at r2 (raw file):
id-arena = "2.2.1" ignore = "0.4.20" indexmap = { git = "https://github.com/bluss/indexmap.git", rev = "ca5f848e10c31e80aeaad0720d14aa2f6dd6cfb1", features = [
Depending on git commits is probelamtci, and messes with resolution a lot of times. Why isn't a version enough?
Cargo.toml
line 77 at r2 (raw file):
], default-features = false } indoc = { version = "2.0.1", default-features = false } itertools = { version = "0.10.5", default-features = false, features = [
Format this better?
This answer describes what happens if you combine
Yes my toml formating tool does this. Which is not the case of most people. I have to change it |
The issue is that using git-based dependencies makes the compiler unpublishable to crates.io which many projects depend on :( |
The only solution I see is for |
508d15b
to
2d5c401
Compare
@mkaput On my demand indexmap released the 2.0.0 version |
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.
@tdelabro great! Then this unblocks this PR from my perspective :)
Reviewable status: 0 of 59 files reviewed, 3 unresolved discussions (waiting on @spapinistarkware and @tdelabro)
@spapinistarkware wdyt? |
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.
Reviewed 5 of 57 files at r3, all commit messages.
Reviewable status: 5 of 59 files reviewed, 4 unresolved discussions (waiting on @tdelabro)
crates/cairo-lang-casm-contract-class/Cargo.toml
line 22 at r4 (raw file):
"num-bigint/std", "serde/std", ]
Add newlines at the end of files
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.
Reviewable status: 5 of 59 files reviewed, 5 unresolved discussions (waiting on @tdelabro)
crates/cairo-lang-casm-contract-class/Cargo.toml
line 2 at r4 (raw file):
[package] name = "cairo-lang-casm-contract-class"
I wonder if this is the right name for this package.
We might want to add things in the future here, right? Ant iot won't be just for the contract class
@spapinistarkware Yes I wasn't sure about the naming, but I don't know what will happen in the future for those crates. |
e8b57b6
to
f619d88
Compare
add ensure_no_std crate move Felt252 as_short_string fn to cairo-lang-utils remove unused deps from cario-lang-runner add crate cairo-lang-vm-utils add crate cairo-lang-casm-contract-class upgrade cairo-rs dependencies to 0.6.0 build: bump indexmap to 2.0.0 format: ran cargo fmt
This PR aims to make as much as the cairo-lang libs no_std compatible.
In order to keep coherence across the crates, I opted for the
cairo-lang-std
approach.I added a crate that will export a custom "std" lib, either from the rust "std" one or from the "core" one (+ hashbrown).
This approach reduces the amount of conditional compilation (
#[cfg(feature = "std")]
vs#[cfg(not(feature = "std"))]
) to be expressed in the subsequent crates.The drawback is that we have to import all our basics from this
cairo-lang-std
crate, rather than usingcore
. Regardless, I think that it's the best option for such a diverse workspace.I also added an
ensure_no_std
crate. It imports the different libs that support no-std and compiles, with them as dependencies. If even a single symbol across the dependencies is provided by thestd
lib, the compilation will fail. It is to be used in the CI in order to make sure no regressions are introduced.It has to be compile with:
meaning it cannot be part of the
workspace
. I added a.cargo/config.toml
and arust-toolchain.toml
so runningcargo build
will be enough.In it's current state
cairo-lang-std
,cairo-lang-utils
andcairo-lang-casm
are compilable in no-std.This change is