Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

Make crate no_std compatible#389

Open
olanod wants to merge 5 commits intoservo:main from
olanod:no-std-support
Open

Make crate no_std compatible #389
olanod wants to merge 5 commits intoservo:main from
olanod:no-std-support

Conversation

@olanod
Copy link

@olanod olanod commented May 31, 2024

Make crate no_std while keeping it backwards compatible with a default std feature enabled(only used to impl Error for ParseError).

LastLeaf and theoparis reacted with thumbs up emoji
Copy link

LastLeaf commented Jun 7, 2024

It seems that the changes are not complete. I still find some deps need changes or default-features = false .

Copy link
Author

olanod commented Jun 7, 2024

I tested it with cargo build --no-default-features and cargo test with default features on purpose to use std. Is that what you tried?

Copy link

LastLeaf commented Jun 7, 2024

I tested it with cargo build --no-default-features and cargo test with default features on purpose to use std. Is that what you tried?

I built with --target armv7a-none-eabi (which does not have a std) and fixed some of the compilation errors. You can take a look at my branch. It also requires a dep change.

olanod reacted with thumbs up emoji

Copy link
Author

olanod commented Jun 10, 2024

Merged your branch as your PR for the dependency was merged and released.

Copy link

More changes are needed in the cssparser-color crate. My branch has been updated.

olanod and theoparis reacted with thumbs up emoji

Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok, but can you rebase and add the license headers? Thanks

@emilio emilio changed the title (削除) Make create no_std compatible (削除ここまで) (追記) Make crate no_std compatible (追記ここまで) Nov 7, 2024
serde = { version = "1.0", features = ["derive"], optional = true }
cssparser = { path = "..", default-features = false }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
libm = "0.2.8"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed this. It seems this dependency should be optional, and only enabled if std is disabled?

[dependencies]
cssparser-macros = { path = "./macros", version = "0.6.1" }
dtoa-short = "0.3"
dtoa-short = "0.3.5"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change needed?

Comment on lines +6 to +11
pub(crate) fn f32_trunc(val: f32) -> f32 {
#[cfg(feature = "std")]
{ val.round() }
#[cfg(not(feature = "std"))]
{ libm::roundf(val) }
}
Copy link
Contributor

@nicoburns nicoburns May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a typo. Should call into trunc function not round functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@nicoburns nicoburns nicoburns left review comments

@emilio emilio emilio approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /