Skip to content

Commit ae28c90

Browse files
Update wasm-tools to v1.224.0
Co-authored-by: Kate Goldenring <kate.goldenring@fermyon.com> Signed-off-by: karthik2804 <karthik.ganeshram@fermyon.com>
1 parent ad62e69 commit ae28c90

File tree

17 files changed

+362
-142
lines changed

17 files changed

+362
-142
lines changed

Cargo.lock

Lines changed: 87 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ wit-component = { workspace = true }
4747
default = ["wit", "registry"]
4848
wat = ["wac-resolver/wat"]
4949
wit = ["wac-resolver/wit"]
50-
registry = ["wac-resolver/registry", "dep:indicatif", "dep:warg-client", "dep:warg-protocol"]
50+
registry = [
51+
"wac-resolver/registry",
52+
"dep:indicatif",
53+
"dep:warg-client",
54+
"dep:warg-protocol",
55+
]
5156
native-tls-vendored = ["warg-client?/native-tls-vendored"]
5257

5358
[workspace]
@@ -58,12 +63,12 @@ wac-parser = { path = "crates/wac-parser", version = "0.7.0-dev", default-featur
5863
wac-resolver = { path = "crates/wac-resolver", version = "0.7.0-dev", default-features = false }
5964
wac-graph = { path = "crates/wac-graph", version = "0.7.0-dev" }
6065
wac-types = { path = "crates/wac-types", version = "0.7.0-dev" }
61-
wit-parser = "0.202.0"
62-
wasmparser = "0.202.0"
63-
wit-component = "0.202.0"
64-
wasm-encoder = "0.202.0"
65-
wasmprinter = "0.202.0"
66-
wasm-metadata = "0.202.0"
66+
wit-parser = "0.224.0"
67+
wasmparser = "0.224.0"
68+
wit-component = "0.224.0"
69+
wasm-encoder = "0.224.0"
70+
wasmprinter = "0.224.0"
71+
wasm-metadata = "0.224.0"
6772
anyhow = "1.0.81"
6873
clap = { version = "4.5.4", features = ["derive"] }
6974
semver = { version = "1.0.22", features = ["serde"] }
@@ -78,7 +83,7 @@ indexmap = { version = "2.2.6", features = ["serde"] }
7883
id-arena = "2.2.1"
7984
serde = { version = "1.0.197", features = ["derive"] }
8085
serde_json = "1.0.115"
81-
wat = "1.202.0"
86+
wat = "1.224.0"
8287
logos = "0.14.0"
8388
miette = "7.2.0"
8489
thiserror = "1.0.58"

crates/wac-graph/src/encoding.rs

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ use wac_types::{
88
Variant, WorldId,
99
};
1010
use wasm_encoder::{
11-
Alias, ComponentBuilder, ComponentExportKind, ComponentOuterAliasKind, ComponentType,
12-
ComponentTypeEncoder, ComponentTypeRef, ComponentValType, CoreTypeEncoder, EntityType,
13-
GlobalType, InstanceType, MemoryType, ModuleType, TableType, TagKind, TagType, TypeBounds,
11+
Alias, ComponentBuilder, ComponentCoreTypeEncoder, ComponentExportKind,
12+
ComponentOuterAliasKind, ComponentType, ComponentTypeEncoder, ComponentTypeRef,
13+
ComponentValType, EntityType, GlobalType, InstanceType, MemoryType, ModuleType, TableType,
14+
TagKind, TagType, TypeBounds,
1415
};
1516

1617
/// A type used to abstract the API differences between a component builder,
@@ -55,7 +56,7 @@ impl Encodable {
5556
}
5657
}
5758

58-
fn core_type(&mut self) -> CoreTypeEncoder {
59+
fn core_type(&mut self) -> ComponentCoreTypeEncoder {
5960
match self {
6061
Encodable::Builder(t) => t.core_type().1,
6162
Encodable::Instance(t) => t.core_type(),
@@ -268,6 +269,9 @@ impl<'a> TypeEncoder<'a> {
268269
DefinedType::Alias(ValueType::Borrow(id)) => self.borrow(state, *id),
269270
DefinedType::Alias(ValueType::Own(id)) => self.own(state, *id),
270271
DefinedType::Alias(ValueType::Defined(id)) => self.defined(state, *id),
272+
DefinedType::Stream(ty) => self.stream(state, *ty),
273+
DefinedType::Future(ty) => self.future(state, *ty),
274+
DefinedType::ErrorContext => self.error_context(state),
271275
};
272276

273277
log::debug!("defined type encoded to type index {index}");
@@ -476,25 +480,36 @@ impl<'a> TypeEncoder<'a> {
476480
element_type,
477481
initial,
478482
maximum,
483+
table64,
484+
shared,
479485
} => EntityType::Table(TableType {
480486
element_type: (*element_type).into(),
481487
minimum: *initial,
482488
maximum: *maximum,
489+
table64: *table64,
490+
shared: *shared,
483491
}),
484492
CoreExtern::Memory {
485493
memory64,
486494
shared,
487495
initial,
488496
maximum,
497+
page_size_log2,
489498
} => EntityType::Memory(MemoryType {
490499
minimum: *initial,
491500
maximum: *maximum,
492501
memory64: *memory64,
493502
shared: *shared,
503+
page_size_log2: *page_size_log2,
494504
}),
495-
CoreExtern::Global { val_type, mutable } => EntityType::Global(GlobalType {
505+
CoreExtern::Global {
506+
val_type,
507+
mutable,
508+
shared,
509+
} => EntityType::Global(GlobalType {
496510
val_type: (*val_type).into(),
497511
mutable: *mutable,
512+
shared: *shared,
498513
}),
499514
CoreExtern::Tag(func) => {
500515
let index = encodable.type_count();
@@ -554,6 +569,26 @@ impl<'a> TypeEncoder<'a> {
554569
index
555570
}
556571

572+
fn stream(&self, state: &mut State, ty: Option<ValueType>) -> u32 {
573+
let ty = ty.map(|ty| self.value_type(state, ty));
574+
let index = state.current.encodable.type_count();
575+
state.current.encodable.ty().defined_type().stream(ty);
576+
index
577+
}
578+
579+
fn future(&self, state: &mut State, ty: Option<ValueType>) -> u32 {
580+
let ty = ty.map(|ty| self.value_type(state, ty));
581+
let index = state.current.encodable.type_count();
582+
state.current.encodable.ty().defined_type().future(ty);
583+
index
584+
}
585+
586+
fn error_context(&self, state: &mut State) -> u32 {
587+
let index = state.current.encodable.type_count();
588+
state.current.encodable.ty().defined_type().error_context();
589+
index
590+
}
591+
557592
fn option(&self, state: &mut State, ty: ValueType) -> u32 {
558593
let ty = self.value_type(state, ty);
559594
let index = state.current.encodable.type_count();

crates/wac-graph/tests/encoding.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ impl GraphFile {
133133
)
134134
})?;
135135

136-
let mut module = wit_component::dummy_module(&resolve, world);
136+
let mut module = wit_component::dummy_module(
137+
&resolve,
138+
world,
139+
wit_parser::ManglingAndAbi::Legacy(wit_parser::LiftLowerAbi::Sync),
140+
);
137141
wit_component::embed_component_metadata(
138142
&mut module,
139143
&resolve,
@@ -147,7 +151,7 @@ impl GraphFile {
147151
)
148152
})?;
149153

150-
let encoder = ComponentEncoder::default().validate(true).module(&module)?;
154+
let mut encoder = ComponentEncoder::default().validate(true).module(&module)?;
151155
encoder
152156
.encode()
153157
.with_context(|| format!("failed to encode a component from module derived from package `{path}` for test case `{test_case}`", path = path.display()))

crates/wac-parser/src/ast/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl Peek for InstantiationArgumentName<'_> {
237237
}
238238
}
239239

240-
impl<'a> InstantiationArgumentName<'a> {
240+
impl InstantiationArgumentName<'_> {
241241
/// Gets the span of the instantiation argument name.
242242
pub fn span(&self) -> SourceSpan {
243243
match self {
@@ -288,7 +288,7 @@ pub enum PostfixExpr<'a> {
288288
NamedAccess(NamedAccessExpr<'a>),
289289
}
290290

291-
impl<'a> PostfixExpr<'a> {
291+
impl PostfixExpr<'_> {
292292
/// Gets the span of the postfix expression.
293293
pub fn span(&self) -> SourceSpan {
294294
match self {

crates/wac-parser/src/ast/type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ pub enum Type<'a> {
672672
Ident(Ident<'a>),
673673
}
674674

675-
impl<'a> Type<'a> {
675+
impl Type<'_> {
676676
/// Gets the span of the type.
677677
pub fn span(&self) -> SourceSpan {
678678
match self {

crates/wac-parser/src/lexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ impl<'a> Lexer<'a> {
516516
}
517517
}
518518

519-
impl<'a> Iterator for Lexer<'a> {
519+
impl Iterator for Lexer<'_> {
520520
type Item = (LexerResult<Token>, SourceSpan);
521521

522522
fn next(&mut self) -> Option<Self::Item> {

crates/wac-parser/src/resolution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ pub struct Resolution<'a> {
664664
instantiation_spans: HashMap<NodeId, SourceSpan>,
665665
}
666666

667-
impl<'a> Resolution<'a> {
667+
impl Resolution<'_> {
668668
/// Gets the document that was resolved.
669669
pub fn document(&self) -> &Document {
670670
self.document

crates/wac-resolver/Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,16 @@ warg-server = { workspace = true }
3434
pretty_assertions = { workspace = true }
3535
tokio-util = "0.7.10"
3636
tempdir = "0.3.7"
37+
tempfile = "3.2.0"
3738

3839
[features]
3940
default = ["registry"]
4041
wat = ["dep:wat"]
4142
wit = ["dep:wit-parser"]
42-
registry = ["dep:warg-client", "dep:warg-protocol", "dep:warg-crypto", "dep:tokio", "dep:futures"]
43+
registry = [
44+
"dep:warg-client",
45+
"dep:warg-protocol",
46+
"dep:warg-crypto",
47+
"dep:tokio",
48+
"dep:futures",
49+
]

crates/wac-resolver/src/fs.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,15 @@ impl FileSystemPackageResolver {
9595
let (pkg, _) = resolve.push_dir(&path).map_err(pkg_res_failure)?;
9696
Some(pkg)
9797
} else if path.extension().and_then(std::ffi::OsStr::to_str) == Some("wit") {
98-
let unresolved = wit_parser::UnresolvedPackage::parse_file(&path)
99-
.map_err(pkg_res_failure)?;
100-
let pkg = resolve.push(unresolved).map_err(pkg_res_failure)?;
98+
let pkg = resolve.push_file(&path).map_err(pkg_res_failure)?;
10199
Some(pkg)
102100
} else {
103101
None
104102
};
105103
if let Some(pkg) = pkg {
106104
packages.insert(
107105
*key,
108-
wit_component::encode(Some(true), &resolve, pkg)
106+
wit_component::encode(&resolve, pkg)
109107
.with_context(|| {
110108
format!(
111109
"failed to encode WIT package from `{path}`",

0 commit comments

Comments
 (0)