@@ -1234,7 +1234,7 @@ impl ComponentState {
12341234 self . future_read ( ty, & options, types, offset)
12351235 }
12361236 CanonicalFunction :: FutureWrite { ty, options } => {
1237- self . future_write ( ty, options. into_vec ( ) , types, offset)
1237+ self . future_write ( ty, & options, types, offset)
12381238 }
12391239 CanonicalFunction :: FutureCancelRead { ty, async_ } => {
12401240 self . future_cancel_read ( ty, async_, types, offset)
@@ -1386,10 +1386,10 @@ impl ComponentState {
13861386 types : & mut TypeAlloc ,
13871387 offset : usize ,
13881388 ) -> Result < ( ) > {
1389- if !self . features . cm_async_builtins ( ) {
1389+ if !self . features . cm_more_async_builtins ( ) {
13901390 bail ! (
13911391 offset,
1392- "`resource.drop` as `async` requires the component model async builtins feature"
1392+ "`resource.drop` as `async` requires the component model more async builtins feature"
13931393 )
13941394 }
13951395 self . resource_at ( resource, types, offset) ?;
@@ -1608,10 +1608,10 @@ impl ComponentState {
16081608 "`subtask.cancel` requires the component model async feature"
16091609 )
16101610 }
1611- if async_ && !self . features . cm_async_builtins ( ) {
1611+ if async_ && !self . features . cm_more_async_builtins ( ) {
16121612 bail ! (
16131613 offset,
1614- "async `subtask.cancel` requires the component model async builtins feature"
1614+ "async `subtask.cancel` requires the component model more async builtins feature"
16151615 )
16161616 }
16171617
@@ -1657,8 +1657,14 @@ impl ComponentState {
16571657 bail ! ( offset, "`stream.read` requires a stream type" )
16581658 } ;
16591659
1660- let ty_id = self
1661- . check_options ( types, options, offset) ?
1660+ let options = self . check_options ( types, options, offset) ?;
1661+ if options. concurrency . is_sync ( ) && !self . features . cm_more_async_builtins ( ) {
1662+ bail ! (
1663+ offset,
1664+ "synchronous `stream.read` requires the component model more async builtins feature"
1665+ ) ;
1666+ }
1667+ let ty_id = options
16621668 . require_memory_if ( offset, || elem_ty. is_some ( ) ) ?
16631669 . require_realloc_if ( offset, || elem_ty. is_some_and ( |ty| ty. contains_ptr ( types) ) ) ?
16641670 . check_lower ( offset) ?
@@ -1691,8 +1697,14 @@ impl ComponentState {
16911697 bail ! ( offset, "`stream.write` requires a stream type" )
16921698 } ;
16931699
1694- let ty_id = self
1695- . check_options ( types, options, offset) ?
1700+ let options = self . check_options ( types, options, offset) ?;
1701+ if options. concurrency . is_sync ( ) && !self . features . cm_more_async_builtins ( ) {
1702+ bail ! (
1703+ offset,
1704+ "synchronous `stream.write` requires the component model more async builtins feature"
1705+ ) ;
1706+ }
1707+ let ty_id = options
16961708 . require_memory_if ( offset, || elem_ty. is_some ( ) ) ?
16971709 . check_lower ( offset) ?
16981710 . check_core_type (
@@ -1718,10 +1730,10 @@ impl ComponentState {
17181730 "`stream.cancel-read` requires the component model async feature"
17191731 )
17201732 }
1721- if cancellable && !self . features . cm_async_builtins ( ) {
1733+ if cancellable && !self . features . cm_more_async_builtins ( ) {
17221734 bail ! (
17231735 offset,
1724- "async `stream.cancel-read` requires the component model async builtins feature"
1736+ "async `stream.cancel-read` requires the component model more async builtins feature"
17251737 )
17261738 }
17271739
@@ -1748,10 +1760,10 @@ impl ComponentState {
17481760 "`stream.cancel-write` requires the component model async feature"
17491761 )
17501762 }
1751- if cancellable && !self . features . cm_async_builtins ( ) {
1763+ if cancellable && !self . features . cm_more_async_builtins ( ) {
17521764 bail ! (
17531765 offset,
1754- "async `stream.cancel-write` requires the component model async builtins feature"
1766+ "async `stream.cancel-write` requires the component model more async builtins feature"
17551767 )
17561768 }
17571769
@@ -1848,8 +1860,14 @@ impl ComponentState {
18481860 bail ! ( offset, "`future.read` requires a future type" )
18491861 } ;
18501862
1851- let ty_id = self
1852- . check_options ( types, options, offset) ?
1863+ let options = self . check_options ( types, options, offset) ?;
1864+ if options. concurrency . is_sync ( ) && !self . features . cm_more_async_builtins ( ) {
1865+ bail ! (
1866+ offset,
1867+ "synchronous `future.read` requires the component model more async builtins feature"
1868+ ) ;
1869+ }
1870+ let ty_id = options
18531871 . require_memory_if ( offset, || elem_ty. is_some ( ) ) ?
18541872 . require_realloc_if ( offset, || elem_ty. is_some_and ( |ty| ty. contains_ptr ( types) ) ) ?
18551873 . check_lower ( offset) ?
@@ -1866,7 +1884,7 @@ impl ComponentState {
18661884 fn future_write (
18671885 & mut self ,
18681886 ty : u32 ,
1869- options : Vec < CanonicalOption > ,
1887+ options : & [ CanonicalOption ] ,
18701888 types : & mut TypeAlloc ,
18711889 offset : usize ,
18721890 ) -> Result < ( ) > {
@@ -1882,8 +1900,14 @@ impl ComponentState {
18821900 bail ! ( offset, "`future.write` requires a future type" )
18831901 } ;
18841902
1885- let ty_id = self
1886- . check_options ( types, & options, offset) ?
1903+ let options = self . check_options ( types, & options, offset) ?;
1904+ if options. concurrency . is_sync ( ) && !self . features . cm_more_async_builtins ( ) {
1905+ bail ! (
1906+ offset,
1907+ "synchronous `future.write` requires the component model more async builtins feature"
1908+ ) ;
1909+ }
1910+ let ty_id = options
18871911 . require_memory_if ( offset, || elem_ty. is_some ( ) ) ?
18881912 . check_core_type (
18891913 types,
@@ -1908,10 +1932,10 @@ impl ComponentState {
19081932 "`future.cancel-read` requires the component model async feature"
19091933 )
19101934 }
1911- if cancellable && !self . features . cm_async_builtins ( ) {
1935+ if cancellable && !self . features . cm_more_async_builtins ( ) {
19121936 bail ! (
19131937 offset,
1914- "async `future.cancel-read` requires the component model async builtins feature"
1938+ "async `future.cancel-read` requires the component model more async builtins feature"
19151939 )
19161940 }
19171941
@@ -1938,10 +1962,10 @@ impl ComponentState {
19381962 "`future.cancel-write` requires the component model async feature"
19391963 )
19401964 }
1941- if cancellable && !self . features . cm_async_builtins ( ) {
1965+ if cancellable && !self . features . cm_more_async_builtins ( ) {
19421966 bail ! (
19431967 offset,
1944- "async `future.cancel-write` requires the component model async builtins feature"
1968+ "async `future.cancel-write` requires the component model more async builtins feature"
19451969 )
19461970 }
19471971
0 commit comments