-
Notifications
You must be signed in to change notification settings - Fork 308
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 21 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
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 |
---|---|---|
|
@@ -453,7 +453,7 @@ impl Idna { | |
return Errors::default(); | ||
} | ||
let mut errors = processing(domain, self.config, &mut self.normalized, out); | ||
self.output = std::mem::replace(out, String::with_capacity(out.len())); | ||
self.output = core::mem::replace(out, String::with_capacity(out.len())); | ||
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. FYI, this fixes a bug in the current 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 recently dabbled with
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. Yes I'm trying it with 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. Could you split this off into a separate PR? |
||
let mut first = true; | ||
for label in self.output.split('.') { | ||
if !first { | ||
|
@@ -713,6 +713,9 @@ impl From<Errors> for Result<(), Errors> { | |
#[cfg(feature = "std")] | ||
impl std::error::Error for Errors {} | ||
|
||
#[cfg(feature = "nightly")] | ||
impl core::error::Error for Errors {} | ||
|
||
impl fmt::Display for Errors { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
fmt::Debug::fmt(self, f) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,18 +22,25 @@ serde_json = "1.0" | |
bencher = "0.1" | ||
|
||
[dependencies] | ||
form_urlencoded = { version = "1.2.0", path = "../form_urlencoded" } | ||
idna = { version = "0.4.0", path = "../idna" } | ||
percent-encoding = { version = "2.3.0", path = "../percent_encoding" } | ||
serde = { version = "1.0", optional = true, features = ["derive"] } | ||
form_urlencoded = { version = "1.2.0", path = "../form_urlencoded", default-features = false, features = ["alloc"] } | ||
idna = { version = "0.4.0", path = "../idna", default-features = false, features = ["alloc"] } | ||
percent-encoding = { version = "2.3.0", path = "../percent_encoding", default-features = false, features = ["alloc"] } | ||
serde = {version = "1.0", optional = true, features = ["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 = [] | ||
# 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: |
||
|
||
[[test]] | ||
name = "url_wpt" | ||
|
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.
@lucacasonato you could take over this check to the
idna
create