Skip to content

Commit b305f25

Browse files
authored
Update the wasm-tools family of crates (#5310)
Most of the changes here are the updates to the component model which includes optional URL fields in imports/exports.
1 parent c74706a commit b305f25

File tree

21 files changed

+331
-127
lines changed

21 files changed

+331
-127
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ winch-codegen = { path = "winch/codegen", version = "=0.2.0" }
155155

156156
target-lexicon = { version = "0.12.3", default-features = false }
157157
anyhow = "1.0.22"
158-
wasmparser = "0.94.0"
159-
wat = "1.0.51"
160-
wast = "49.0.0"
161-
wasmprinter = "0.2.43"
162-
wasm-encoder = "0.19.1"
163-
wasm-smith = "0.11.8"
164-
wasm-mutate = "0.2.11"
158+
wasmparser = "0.95.0"
159+
wat = "1.0.52"
160+
wast = "50.0.0"
161+
wasmprinter = "0.2.44"
162+
wasm-encoder = "0.20.0"
163+
wasm-smith = "0.11.9"
164+
wasm-mutate = "0.2.12"
165165
windows-sys = "0.36.0"
166166
env_logger = "0.9"
167167
rustix = "0.35.10"

crates/environ/src/component/translate.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,14 +840,16 @@ impl<'a, 'data> Translator<'a, 'data> {
840840
// An imported component instance is being aliased, so the type of
841841
// the aliased item is directly available from the instance type.
842842
ComponentInstanceType::Index(ty) => {
843-
self.result.push_typedef(self.types[ty].exports[name])
843+
let (_url, ty) = &self.types[ty].exports[name];
844+
self.result.push_typedef(*ty);
844845
}
845846

846847
// An imported component was instantiated so the type of the aliased
847848
// export is available through the type of the export on the
848849
// original component.
849850
ComponentInstanceType::InstantiatedIndex(ty) => {
850-
self.result.push_typedef(self.types[ty].exports[name])
851+
let (_, ty) = self.types[ty].exports[name];
852+
self.result.push_typedef(ty);
851853
}
852854

853855
// A static nested component was instantiated which means that the

crates/environ/src/component/translate/inline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ impl<'a> Inliner<'a> {
668668
ComponentInstanceDef::Import(path, ty) => {
669669
let mut path = path.clone();
670670
path.path.push(name);
671-
match self.types[*ty].exports[*name] {
671+
match self.types[*ty].exports[*name].1 {
672672
TypeDef::ComponentFunc(_) => {
673673
frame.component_funcs.push(ComponentFuncDef::Import(path));
674674
}
@@ -909,7 +909,7 @@ impl<'a> Inliner<'a> {
909909
// Note that for now this would only work with
910910
// module-exporting instances.
911911
ComponentInstanceDef::Import(path, ty) => {
912-
for (name, ty) in self.types[ty].exports.iter() {
912+
for (name, (_url, ty)) in self.types[ty].exports.iter() {
913913
let mut path = path.clone();
914914
path.path.push(name);
915915
let def = ComponentItemDef::from_import(path, *ty)?;

crates/environ/src/component/types.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -553,13 +553,17 @@ impl ComponentTypesBuilder {
553553
ComponentTypeDeclaration::Type(ty) => self.type_declaration_type(ty)?,
554554
ComponentTypeDeclaration::CoreType(ty) => self.type_declaration_core_type(ty)?,
555555
ComponentTypeDeclaration::Alias(alias) => self.type_declaration_alias(alias)?,
556-
ComponentTypeDeclaration::Export { name, ty } => {
556+
ComponentTypeDeclaration::Export { name, url, ty } => {
557557
let ty = self.component_type_ref(ty);
558-
result.exports.insert(name.to_string(), ty);
558+
result
559+
.exports
560+
.insert(name.to_string(), (url.to_string(), ty));
559561
}
560562
ComponentTypeDeclaration::Import(import) => {
561563
let ty = self.component_type_ref(&import.ty);
562-
result.imports.insert(import.name.to_string(), ty);
564+
result
565+
.imports
566+
.insert(import.name.to_string(), (import.url.to_string(), ty));
563567
}
564568
}
565569
}
@@ -581,9 +585,11 @@ impl ComponentTypesBuilder {
581585
InstanceTypeDeclaration::Type(ty) => self.type_declaration_type(ty)?,
582586
InstanceTypeDeclaration::CoreType(ty) => self.type_declaration_core_type(ty)?,
583587
InstanceTypeDeclaration::Alias(alias) => self.type_declaration_alias(alias)?,
584-
InstanceTypeDeclaration::Export { name, ty } => {
588+
InstanceTypeDeclaration::Export { name, url, ty } => {
585589
let ty = self.component_type_ref(ty);
586-
result.exports.insert(name.to_string(), ty);
590+
result
591+
.exports
592+
.insert(name.to_string(), (url.to_string(), ty));
587593
}
588594
}
589595
}
@@ -971,9 +977,9 @@ pub struct TypeModule {
971977
#[derive(Serialize, Deserialize, Default)]
972978
pub struct TypeComponent {
973979
/// The named values that this component imports.
974-
pub imports: IndexMap<String, TypeDef>,
980+
pub imports: IndexMap<String, (String, TypeDef)>,
975981
/// The named values that this component exports.
976-
pub exports: IndexMap<String, TypeDef>,
982+
pub exports: IndexMap<String, (String, TypeDef)>,
977983
}
978984

979985
/// The type of a component instance in the component model, or an instantiated
@@ -983,7 +989,7 @@ pub struct TypeComponent {
983989
#[derive(Serialize, Deserialize, Default)]
984990
pub struct TypeComponentInstance {
985991
/// The list of exports that this component has along with their types.
986-
pub exports: IndexMap<String, TypeDef>,
992+
pub exports: IndexMap<String, (String, TypeDef)>,
987993
}
988994

989995
/// A component function type in the component model.

crates/wasmtime/src/component/matching.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl TypeChecker<'_> {
7171
// Like modules, every export in the expected type must be present in
7272
// the actual type. It's ok, though, to have extra exports in the actual
7373
// type.
74-
for (name, expected) in expected.exports.iter() {
74+
for (name, (_url, expected)) in expected.exports.iter() {
7575
// Interface types may be exported from a component in order to give them a name, but
7676
// they don't have a definition in the sense that this search is interested in, so
7777
// ignore them.

0 commit comments

Comments
 (0)