-
Notifications
You must be signed in to change notification settings - Fork 326
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 for the url
crate
#831
base: main
Are you sure you want to change the base?
Changes from 12 commits
35653b0
194122c
422a260
81ee074
67d2a4c
db92dd2
bb7955a
a98aef8
0d14d5a
315eb43
6d622ab
3efe254
36bc5b3
29bfcf7
e16eb2b
3dd87d8
af1d5d5
b908f7f
fd98554
b0bb942
047d334
028424a
7073957
be123af
c145584
be73851
96e2a04
268c17e
0c02cd9
316c868
43c7d41
74c0910
a544730
619de8e
00efb8f
fc0778f
027e1c7
d367346
7377a57
d43506b
c8d8e6d
3bf9eac
a73e755
a4422a9
93c4871
c79a0d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,18 +28,27 @@ debugger_test = "0.1" | |
debugger_test_parser = "0.1" | ||
|
||
[dependencies] | ||
form_urlencoded = { version = "1.1.0", path = "../form_urlencoded" } | ||
idna = { version = "0.3.0", path = "../idna" } | ||
percent-encoding = { version = "2.2.0", path = "../percent_encoding" } | ||
serde = {version = "1.0", optional = true, features = ["derive"]} | ||
form_urlencoded = { version = "1.1.0", path = "../form_urlencoded", default-features = false, features = ["alloc"] } | ||
idna = { version = "0.3.0", path = "../idna", default-features = false, features = ["alloc"] } | ||
percent-encoding = { version = "2.2.0", path = "../percent_encoding", default-features = false, features = ["alloc"] } | ||
data-url = { version = "0.2.0", path = "../data-url", default-features = false, features = ["alloc"] } | ||
serde = {version = "1.0", optional = true, default-features = false, features = ["alloc", "derive"]} | ||
no-std-net = { version = "0.6.0", default-features = false, optional = true } | ||
|
||
[features] | ||
default = [] | ||
default = ["std"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fear this might be a fairly big breaking change? When I added Python script for finding crates using `default-features = false`.import json
import requests
import sys
API_URL = "https://crates.io/api/v1/crates"
crate_name = sys.argv[1]
page = 1
while True:
# print(f"page {page}")
data = json.loads(requests.get(f"{API_URL}/{crate_name}/reverse_dependencies?per_page=100&page={page}").content)
page += 1
if len(data['versions']) == 0:
break
versions = {x['id']: x for x in data['versions']}
for dep in data['dependencies']:
if not dep['default_features']:
crate = versions[dep['version_id']]
print(f"{crate['crate']} had `default-features = false`") There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any other way? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well... I see two:
|
||
std = ["idna/std", "percent-encoding/std", "form_urlencoded/std", "alloc"] | ||
alloc = [] | ||
# UNSTABLE FEATURES (requires Rust nightly) | ||
# Enable to use the #[debugger_visualizer] attribute. | ||
debugger_visualizer = [] | ||
# Expose internal offsets of the URL. | ||
expose_internals = [] | ||
serde = ["dep:serde", "no-std-net/serde"] | ||
# For no_std: Allow the use of no_std_net instead of nightly | ||
no_std_net = ["no-std-net"] | ||
# For no_std: Use errors_in_core and net_in_core | ||
unstable = ["idna/unstable"] | ||
domenukk marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rust-lang/rust#108443 is FCP-ing now, so it'll probably land in a few months - perhaps we should wait with this feature until then? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now this PR also uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The value in that feature is that this could become a non-breaking change (other than bumping MSRV, which is probably acceptable). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update: |
||
|
||
[[bench]] | ||
name = "parse_url" | ||
|
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.
FYI, this fixes a bug in the current
idna
no_std support. Why is it not caught in CI, and should I open an extra PR for it?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.
I recently dabbled with
no_std
stuff as well and I think the sure-fire way to testno_std
compatibility is to:std
(certain ARM platforms) ORno_std
binary crate which uses the librariesThere 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.
Yes I'm trying it with
cargo +nightly build -Zbuild-std=core,alloc --target aarch64-unknown-none -v --release --no-default-features
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.
Could you split this off into a separate PR?