Skip to content

Commit

Permalink
Remove support for relative-url=<...> (#1567)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton authored May 20, 2024
1 parent 28132cc commit 6797729
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
14 changes: 1 addition & 13 deletions crates/wasmparser/src/validator/names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,7 @@ impl<'a> DependencyName<'a> {
}
}

/// A dependency on an implementation either as `url=...` or
/// `relative-url=...`
/// A dependency on an implementation either as `url=...`
#[derive(Debug, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub struct UrlName<'a>(&'a str);

Expand Down Expand Up @@ -649,17 +648,6 @@ impl<'a> ComponentNameParser<'a> {
self.eat_optional_hash()?;
return Ok(ParsedComponentNameKind::Url);
}
// 'relative-url=<' <nonbrackets> '>' (',' <hashname>)?
if self.eat_str("relative-url=") {
self.expect_str("<")?;
let url = self.take_up_to('>')?;
if url.contains('<') {
bail!(self.offset, "relative-url cannot contain `<`");
}
self.expect_str(">")?;
self.eat_optional_hash()?;
return Ok(ParsedComponentNameKind::Url);
}

// 'integrity=<' <integrity-metadata> '>'
if self.eat_str("integrity=") {
Expand Down
2 changes: 1 addition & 1 deletion tests/local/component-model/export.wast
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"not a valid export name")
(assert_invalid
(component (type (component (export "relative-url=<x>" (func)))))
"not a valid export name")
"not a valid extern name")
(assert_invalid
(component (type (component (export "locked-dep=<a:b>" (func)))))
"not a valid export name")
Expand Down
18 changes: 10 additions & 8 deletions tests/local/component-model/import.wast
Original file line number Diff line number Diff line change
Expand Up @@ -287,21 +287,23 @@
(component (import "url=<<>" (func)))
"url cannot contain `<`")

(component
(import "relative-url=<>" (func))
(import "relative-url=<a>" (func))
(import "relative-url=<a>,integrity=<sha256-a>" (func))
)
(assert_invalid
(component
(import "relative-url=<>" (func))
(import "relative-url=<a>" (func))
(import "relative-url=<a>,integrity=<sha256-a>" (func))
)
"not a valid extern name")

(assert_invalid
(component (import "relative-url=" (func)))
"expected `<` at ``")
"not a valid extern name")
(assert_invalid
(component (import "relative-url=<" (func)))
"failed to find `>`")
"not a valid extern name")
(assert_invalid
(component (import "relative-url=<<>" (func)))
"relative-url cannot contain `<`")
"not a valid extern name")

(component
(import "integrity=<sha256-a>" (func))
Expand Down

0 comments on commit 6797729

Please sign in to comment.