Skip to content

Commit

Permalink
Merge branch 'master' into no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
domenukk committed Jul 16, 2023
2 parents 047d334 + 1158370 commit 028424a
Show file tree
Hide file tree
Showing 7 changed files with 1,673 additions and 556 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ jobs:
# Run tests enabling the serde feature
- name: Run tests with the serde feature
run: cargo test --features "url/serde,url/expose_internals"
# The #[debugger_visualizer] attribute is currently gated behind an unstable feature flag.
# In order to test the visualizers for the url crate, they have to be tested on a nightly build.
# The #[debugger_visualizer] attribute is currently gated behind a feature flag until #[debugger_visualizer]
# is available in all rustc versions past our MSRV. As such, we only run the tests on newer rustc versions.
- name: Run debugger_visualizer tests
if: |
matrix.os == 'windows-latest' &&
matrix.rust == 'nightly'
matrix.rust != '1.56.0'
run: cargo test --test debugger_visualizer --features "url/debugger_visualizer,url_debug_tests/debugger_visualizer" -- --test-threads=1
- name: Test `no_std` support
run: cargo test --no-default-features --features=alloc,no_std_net
Expand Down
4 changes: 2 additions & 2 deletions debug_metadata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ types, descibe how to display those types. (For writing a pretty printer, see: h

### Embedding Visualizers

Through the use of the currently unstable `#[debugger_visualizer]` attribute, the `url`
crate can embed debugger visualizers into the crate metadata.
Through the use of the `#[debugger_visualizer]` attribute, the `url` crate can embed
debugger visualizers into the crate metadata.

Currently the two types of visualizers supported are Natvis and Pretty printers.

Expand Down
4 changes: 2 additions & 2 deletions url/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ no-std-net = { version = "0.6.0", default-features = false, optional = true }
default = ["std"]
std = ["idna/std", "percent-encoding/std", "form_urlencoded/std", "alloc"]
alloc = []
# UNSTABLE FEATURES (requires Rust nightly)
# Enable to use the #[debugger_visualizer] attribute.
# Enable to use the #[debugger_visualizer] attribute. This feature requires Rust >= 1.71.
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"]
# UNSTABLE FEATURES (requires Rust nightly)
# For no_std: Use errors_in_core and net_in_core
unstable = ["idna/unstable"]

Expand Down
14 changes: 13 additions & 1 deletion url/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,25 @@ See [serde documentation](https://serde.rs) for more information.
url = { version = "2", features = ["serde"] }
```
# Feature: `debugger_visualizer`
If you enable the `debugger_visualizer` feature, the `url` crate will include
a [natvis file](https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects)
for [Visual Studio](https://www.visualstudio.com/) that allows you to view
[`Url`](struct.Url.html) objects in the debugger.
This feature requires Rust 1.71 or later.
```toml
url = { version = "2", features = ["debugger_visualizer"] }
```
*/

#![no_std]
#![doc(html_root_url = "https://docs.rs/url/2.4.0")]
#![cfg_attr(
feature = "debugger_visualizer",
feature(debugger_visualizer),
debugger_visualizer(natvis_file = "../../debug_metadata/url.natvis")
)]
#![cfg_attr(
Expand Down
50 changes: 33 additions & 17 deletions url/tests/expected_failures.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
</> against <file://h/C:/a/b>
<file:\\\\//> against <about:blank>
<file:\\\\\\\\> against <about:blank>
<file:\\\\\\\\?fox> against <about:blank>
<file:\\\\\\\\#guppy> against <about:blank>
<file://spider///> against <about:blank>
<file:\\\\localhost//> against <about:blank>
<file://\\/localhost//cat> against <about:blank>
<file://localhost//a//../..//> against <about:blank>
<file:\\\\//>
<file:\\\\\\\\>
<file:\\\\\\\\?fox>
<file:\\\\\\\\#guppy>
<file://spider///>
<file:\\\\localhost//>
<file://\\/localhost//cat>
<file://localhost//a//../..//>
</////mouse> against <file:///elephant>
<\\/localhost//pig> against <file://lion/>
<//localhost//pig> against <file://lion/>
Expand All @@ -19,19 +19,35 @@
<C|\n/> against <file://host/dir/file>
<C|\\> against <file://host/dir/file>
</c:/foo/bar> against <file://host/path>
<file://example.net/C:/> against <about:blank>
<file://1.2.3.4/C:/> against <about:blank>
<file://[1::8]/C:/> against <about:blank>
<file://example.net/C:/>
<file://1.2.3.4/C:/>
<file://[1::8]/C:/>
<C|/> against <file://host/>
</C:/> against <file://host/>
<file:C:/> against <file://host/>
<file:/C:/> against <file://host/>
<file://localhost//a//../..//foo> against <about:blank>
<file://localhost////foo> against <about:blank>
<file:////foo> against <about:blank>
<file://localhost//a//../..//foo>
<file://localhost////foo>
<file:////foo>
<file:////one/two> against <file:///>
<////one/two> against <file:///>
<file:///.//> against <file:////>
<file:.//p> against <about:blank>
<file:/.//p> against <about:blank>
<https://x/?#\u{0}y> against <about:blank>
<file:.//p>
<file:/.//p>
<http://example.net/path> set hostname to <example.com:8080>
<http://example.net:8080/path> set hostname to <example.com:>
<non-spec:/.//p> set hostname to <h>
<non-spec:/.//p> set hostname to <>
<foo://somehost/some/path> set pathname to <>
<foo:///some/path> set pathname to <>
<http://example.net:8080/path> set port to <randomstring>
<file:///var/log/system.log> set href to <http://0300.168.0xF0>
<data:space ?query#fragment> set search to <>
<sc:space ?query#fragment> set search to <>
<file://monkey/> set pathname to <\\\\>
<file:///unicorn> set pathname to <//\\/>
<file:///unicorn> set pathname to <//monkey/..//>
<non-spec:/> set pathname to </.//p>
<non-spec:/> set pathname to </..//p>
<non-spec:/> set pathname to <//p>
<non-spec:/.//> set pathname to <p>
Loading

0 comments on commit 028424a

Please sign in to comment.