From 964f8986ff4083144d8b14dfdec7a705221ba9cc Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 3 May 2024 09:01:12 -0700 Subject: [PATCH] Use rustdoc's `doc_auto_cfg` feature instead of `doc_cfg` (#8532) This commit removes all our `#[cfg_attr(..., doc(cfg(...)))]` annotations throughout Wasmtime and `wasmtime-wasi`. These are all replaced with `feature(doc_auto_cfg)` which automatically infers the attribute to show rather than requiring us to duplicate it. Spot-checking the docs this looks just-as-readable while being much easier to maintain over time. --- crates/wasi/src/ctx.rs | 1 - crates/wasi/src/lib.rs | 2 +- crates/wasi/src/preview0.rs | 2 -- crates/wasi/src/preview1.rs | 2 -- crates/wasmtime/src/compile/code_builder.rs | 1 - crates/wasmtime/src/compile/runtime.rs | 5 ---- crates/wasmtime/src/config.rs | 23 ------------------- crates/wasmtime/src/engine.rs | 4 ---- crates/wasmtime/src/lib.rs | 2 +- crates/wasmtime/src/runtime.rs | 2 -- .../src/runtime/component/component.rs | 3 --- crates/wasmtime/src/runtime/component/func.rs | 2 -- .../src/runtime/component/func/typed.rs | 2 -- .../src/runtime/component/instance.rs | 1 - .../wasmtime/src/runtime/component/linker.rs | 3 --- crates/wasmtime/src/runtime/component/mod.rs | 1 - .../src/runtime/component/resources.rs | 1 - .../wasmtime/src/runtime/externals/table.rs | 2 -- crates/wasmtime/src/runtime/func.rs | 7 ------ crates/wasmtime/src/runtime/func/typed.rs | 1 - crates/wasmtime/src/runtime/instance.rs | 2 -- crates/wasmtime/src/runtime/linker.rs | 9 -------- crates/wasmtime/src/runtime/memory.rs | 3 --- crates/wasmtime/src/runtime/module.rs | 5 ---- crates/wasmtime/src/runtime/store.rs | 4 ---- 25 files changed, 2 insertions(+), 88 deletions(-) diff --git a/crates/wasi/src/ctx.rs b/crates/wasi/src/ctx.rs index f2007f2bdd..8959bc8bbf 100644 --- a/crates/wasi/src/ctx.rs +++ b/crates/wasi/src/ctx.rs @@ -515,7 +515,6 @@ impl WasiCtxBuilder { /// usage of this method is not allowed and should use a second builder /// instead. #[cfg(feature = "preview1")] - #[cfg_attr(docsrs, doc(cfg(feature = "preview1")))] pub fn build_p1(&mut self) -> crate::preview1::WasiP1Ctx { let wasi = self.build(); crate::preview1::WasiP1Ctx::new(wasi) diff --git a/crates/wasi/src/lib.rs b/crates/wasi/src/lib.rs index fd24493984..0bc65d724c 100644 --- a/crates/wasi/src/lib.rs +++ b/crates/wasi/src/lib.rs @@ -178,7 +178,7 @@ //! [`wasi:sockets/udp`]: bindings::sockets::udp::Host //! [async]: https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.async_support -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] use wasmtime::component::Linker; diff --git a/crates/wasi/src/preview0.rs b/crates/wasi/src/preview0.rs index c1992cb5a3..995a88691a 100644 --- a/crates/wasi/src/preview0.rs +++ b/crates/wasi/src/preview0.rs @@ -3,8 +3,6 @@ //! This module is purely here for backwards compatibility in the Wasmtime CLI. //! You probably want to use [`preview1`](crate::preview1) instead. -#![cfg_attr(docsrs, doc(cfg(feature = "preview1")))] - use crate::preview0::types::Error; use crate::preview1::types as snapshot1_types; use crate::preview1::wasi_snapshot_preview1::WasiSnapshotPreview1 as Snapshot1; diff --git a/crates/wasi/src/preview1.rs b/crates/wasi/src/preview1.rs index 57fd0ebf59..36075e8a42 100644 --- a/crates/wasi/src/preview1.rs +++ b/crates/wasi/src/preview1.rs @@ -63,8 +63,6 @@ //! } //! ``` -#![cfg_attr(docsrs, doc(cfg(feature = "preview1")))] - use crate::bindings::{ cli::{ stderr, stdin, stdout, terminal_input, terminal_output, terminal_stderr, terminal_stdin, diff --git a/crates/wasmtime/src/compile/code_builder.rs b/crates/wasmtime/src/compile/code_builder.rs index 58afd663f0..6d4d421b3d 100644 --- a/crates/wasmtime/src/compile/code_builder.rs +++ b/crates/wasmtime/src/compile/code_builder.rs @@ -239,7 +239,6 @@ impl<'a> CodeBuilder<'a> { /// compiles a serialized [`Component`](crate::component::Component) /// instead of a module. #[cfg(feature = "component-model")] - #[cfg_attr(docsrs, doc(cfg(feature = "component-model")))] pub fn compile_component_serialized(&self) -> Result> { let bytes = self.wasm_binary()?; let (v, _) = super::build_component_artifacts(self.engine, &bytes, None)?; diff --git a/crates/wasmtime/src/compile/runtime.rs b/crates/wasmtime/src/compile/runtime.rs index cd7d1c2861..0aa974da97 100644 --- a/crates/wasmtime/src/compile/runtime.rs +++ b/crates/wasmtime/src/compile/runtime.rs @@ -78,7 +78,6 @@ impl<'a> CodeBuilder<'a> { /// /// Note that this method will cache compilations if the `cache` feature is /// enabled and turned on in [`Config`](crate::Config). - #[cfg_attr(docsrs, doc(cfg(feature = "runtime")))] pub fn compile_module(&self) -> Result { let (code, info_and_types) = self.compile_cached(super::build_artifacts)?; Module::from_parts(self.engine, code, info_and_types) @@ -87,10 +86,6 @@ impl<'a> CodeBuilder<'a> { /// Same as [`CodeBuilder::compile_module`] except that it compiles a /// [`Component`] instead of a module. #[cfg(feature = "component-model")] - #[cfg_attr( - docsrs, - doc(cfg(all(feature = "runtime", feature = "component-model"))) - )] pub fn compile_component(&self) -> Result { let (code, artifacts) = self.compile_cached(super::build_component_artifacts)?; Component::from_parts(self.engine, code, artifacts) diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index e29d291cd8..e063c2650e 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -303,7 +303,6 @@ impl Config { /// /// This method will error if the given target triple is not supported. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn target(&mut self, target: &str) -> Result<&mut Self> { self.compiler_config.target = Some(target_lexicon::Triple::from_str(target).map_err(|e| anyhow::anyhow!(e))?); @@ -414,7 +413,6 @@ impl Config { /// it. If Wasmtime doesn't support exactly what you'd like just yet, please /// feel free to open an issue! #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub fn async_support(&mut self, enable: bool) -> &mut Self { self.async_support = enable; self @@ -691,7 +689,6 @@ impl Config { /// The `Engine::new` method will fail if the value for this option is /// smaller than the [`Config::max_wasm_stack`] option. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub fn async_stack_size(&mut self, size: usize) -> &mut Self { self.async_stack_size = size; self @@ -732,7 +729,6 @@ impl Config { /// [threads]: https://github.com/webassembly/threads /// [wasi-threads]: https://github.com/webassembly/wasi-threads #[cfg(feature = "threads")] - #[cfg_attr(docsrs, doc(cfg(feature = "threads")))] pub fn wasm_threads(&mut self, enable: bool) -> &mut Self { self.features.set(WasmFeatures::THREADS, enable); self @@ -755,7 +751,6 @@ impl Config { /// /// [proposal]: https://github.com/webassembly/reference-types #[cfg(feature = "gc")] - #[cfg_attr(docsrs, doc(cfg(feature = "gc")))] pub fn wasm_reference_types(&mut self, enable: bool) -> &mut Self { self.features.set(WasmFeatures::REFERENCE_TYPES, enable); self @@ -775,7 +770,6 @@ impl Config { /// /// [proposal]: https://github.com/WebAssembly/function-references #[cfg(feature = "gc")] - #[cfg_attr(docsrs, doc(cfg(feature = "gc")))] pub fn wasm_function_references(&mut self, enable: bool) -> &mut Self { self.features.set(WasmFeatures::FUNCTION_REFERENCES, enable); self @@ -797,7 +791,6 @@ impl Config { /// /// [proposal]: https://github.com/WebAssembly/gc #[cfg(feature = "gc")] - #[cfg_attr(docsrs, doc(cfg(feature = "gc")))] pub fn wasm_gc(&mut self, enable: bool) -> &mut Self { self.features.set(WasmFeatures::GC, enable); self @@ -1010,7 +1003,6 @@ impl Config { /// /// The default value for this is `Strategy::Auto`. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn strategy(&mut self, strategy: Strategy) -> &mut Self { self.compiler_config.strategy = strategy; self @@ -1044,7 +1036,6 @@ impl Config { /// /// The default value for this is `false` #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn cranelift_debug_verifier(&mut self, enable: bool) -> &mut Self { let val = if enable { "true" } else { "false" }; self.compiler_config @@ -1061,7 +1052,6 @@ impl Config { /// /// The default value for this is `OptLevel::None`. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn cranelift_opt_level(&mut self, level: OptLevel) -> &mut Self { let val = match level { OptLevel::None => "none", @@ -1088,7 +1078,6 @@ impl Config { /// /// The default value for this is `false` #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn cranelift_nan_canonicalization(&mut self, enable: bool) -> &mut Self { let val = if enable { "true" } else { "false" }; self.compiler_config @@ -1111,7 +1100,6 @@ impl Config { /// over a trail of "breadcrumbs" or facts at each intermediate /// value. Thus, it is appropriate to enable in production. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn cranelift_pcc(&mut self, enable: bool) -> &mut Self { let val = if enable { "true" } else { "false" }; self.compiler_config @@ -1137,7 +1125,6 @@ impl Config { /// cause `Engine::new` fail if the flag's name does not exist, or the value is not appropriate /// for the flag type. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub unsafe fn cranelift_flag_enable(&mut self, flag: &str) -> &mut Self { self.compiler_config.flags.insert(flag.to_string()); self @@ -1163,7 +1150,6 @@ impl Config { /// For example, feature `wasm_backtrace` will set `unwind_info` to `true`, but if it's /// manually set to false then it will fail. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub unsafe fn cranelift_flag_set(&mut self, name: &str, value: &str) -> &mut Self { self.compiler_config .settings @@ -1190,7 +1176,6 @@ impl Config { /// /// [docs]: https://bytecodealliance.github.io/wasmtime/cli-cache.html #[cfg(feature = "cache")] - #[cfg_attr(docsrs, doc(cfg(feature = "cache")))] pub fn cache_config_load(&mut self, path: impl AsRef) -> Result<&mut Self> { self.cache_config = CacheConfig::from_file(Some(path.as_ref()))?; Ok(self) @@ -1207,7 +1192,6 @@ impl Config { /// This method is only available when the `cache` feature of this crate is /// enabled. #[cfg(feature = "cache")] - #[cfg_attr(docsrs, doc(cfg(feature = "cache")))] pub fn disable_cache(&mut self) -> &mut Self { self.cache_config = CacheConfig::new_cache_disabled(); self @@ -1235,7 +1219,6 @@ impl Config { /// /// [docs]: https://bytecodealliance.github.io/wasmtime/cli-cache.html #[cfg(feature = "cache")] - #[cfg_attr(docsrs, doc(cfg(feature = "cache")))] pub fn cache_config_load_default(&mut self) -> Result<&mut Self> { self.cache_config = CacheConfig::from_file(None)?; Ok(self) @@ -1256,7 +1239,6 @@ impl Config { /// Custom memory creators are used when creating creating async instance stacks for /// the on-demand instance allocation strategy. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub fn with_host_stack(&mut self, stack_creator: Arc) -> &mut Self { self.stack_creator = Some(Arc::new(StackCreatorProxy(stack_creator))); self @@ -1568,7 +1550,6 @@ impl Config { /// /// By default parallel compilation is enabled. #[cfg(feature = "parallel-compilation")] - #[cfg_attr(docsrs, doc(cfg(feature = "parallel-compilation")))] pub fn parallel_compilation(&mut self, parallel: bool) -> &mut Self { self.parallel_compilation = parallel; self @@ -1672,7 +1653,6 @@ impl Config { /// /// This option is disabled by default. #[cfg(feature = "coredump")] - #[cfg_attr(docsrs, doc(cfg(feature = "coredump")))] pub fn coredump_on_trap(&mut self, enable: bool) -> &mut Self { self.coredump_on_trap = enable; self @@ -2372,7 +2352,6 @@ impl PoolingAllocationConfig { /// /// [`call_async`]: crate::TypedFunc::call_async #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub fn async_stack_zeroing(&mut self, enable: bool) -> &mut Self { self.config.async_stack_zeroing = enable; self @@ -2390,7 +2369,6 @@ impl PoolingAllocationConfig { /// Note that when using this option the memory with async stacks will /// never be decommitted. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub fn async_stack_keep_resident(&mut self, size: usize) -> &mut Self { let size = round_up_to_pages(size as u64) as usize; self.config.async_stack_keep_resident = size; @@ -2770,7 +2748,6 @@ impl PoolingAllocationConfig { /// entry in the pool contains the space needed for each GC heap used by a /// store. #[cfg(feature = "gc")] - #[cfg_attr(docsrs, doc(cfg(feature = "gc")))] pub fn total_gc_heaps(&mut self, count: u32) -> &mut Self { self.config.limits.total_gc_heaps = count; self diff --git a/crates/wasmtime/src/engine.rs b/crates/wasmtime/src/engine.rs index 47f8dd4193..540aa35c5d 100644 --- a/crates/wasmtime/src/engine.rs +++ b/crates/wasmtime/src/engine.rs @@ -496,7 +496,6 @@ impl Engine { } #[cfg(any(feature = "cranelift", feature = "winch"))] -#[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] impl Engine { pub(crate) fn compiler(&self) -> &dyn wasmtime_environ::Compiler { &*self.inner.compiler @@ -533,7 +532,6 @@ impl Engine { /// Same as [`Engine::precompile_module`] except for a /// [`Component`](crate::component::Component) #[cfg(feature = "component-model")] - #[cfg_attr(docsrs, doc(cfg(feature = "component-model")))] pub fn precompile_component(&self, bytes: &[u8]) -> Result> { crate::CodeBuilder::new(self) .wasm(bytes, None)? @@ -575,7 +573,6 @@ pub enum Precompiled { } #[cfg(feature = "runtime")] -#[cfg_attr(docsrs, doc(cfg(feature = "runtime")))] impl Engine { /// Eagerly initialize thread-local functionality shared by all [`Engine`]s. /// @@ -667,7 +664,6 @@ impl Engine { /// compatible [`Config`]s. If this Hash matches between two [`Engine`]s then binaries /// from one are guaranteed to deserialize in the other. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(feature = "cranelift")))] // see build.rs pub fn precompile_compatibility_hash(&self) -> impl std::hash::Hash + '_ { crate::compile::HashedEngineCompileEnv(self) } diff --git a/crates/wasmtime/src/lib.rs b/crates/wasmtime/src/lib.rs index 53771a3599..8b9c1288b8 100644 --- a/crates/wasmtime/src/lib.rs +++ b/crates/wasmtime/src/lib.rs @@ -262,7 +262,7 @@ #![deny(missing_docs)] #![doc(test(attr(deny(warnings))))] #![doc(test(attr(allow(dead_code, unused_variables, unused_mut))))] -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(not(feature = "default"), allow(dead_code, unused_imports))] // Allow broken links when the default features is disabled because most of our // documentation is written for the "one build" of the `main` branch which has diff --git a/crates/wasmtime/src/runtime.rs b/crates/wasmtime/src/runtime.rs index af43f0b39e..487fcb0733 100644 --- a/crates/wasmtime/src/runtime.rs +++ b/crates/wasmtime/src/runtime.rs @@ -1,5 +1,3 @@ -#![cfg_attr(docsrs, doc(cfg(feature = "runtime")))] - #[macro_use] pub(crate) mod func; diff --git a/crates/wasmtime/src/runtime/component/component.rs b/crates/wasmtime/src/runtime/component/component.rs index 3cb1cb9670..0235a66ea8 100644 --- a/crates/wasmtime/src/runtime/component/component.rs +++ b/crates/wasmtime/src/runtime/component/component.rs @@ -147,7 +147,6 @@ impl Component { /// # Ok(()) /// # } #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn new(engine: &Engine, bytes: impl AsRef<[u8]>) -> Result { crate::CodeBuilder::new(engine) .wasm(bytes.as_ref(), None)? @@ -160,7 +159,6 @@ impl Component { /// This is a convenience function for reading the contents of `file` on /// disk and then calling [`Component::new`]. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn from_file(engine: &Engine, file: impl AsRef) -> Result { crate::CodeBuilder::new(engine) .wasm_file(file.as_ref())? @@ -177,7 +175,6 @@ impl Component { /// /// For more information on semantics and errors see [`Component::new`]. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn from_binary(engine: &Engine, binary: &[u8]) -> Result { crate::CodeBuilder::new(engine) .wasm(binary, None)? diff --git a/crates/wasmtime/src/runtime/component/func.rs b/crates/wasmtime/src/runtime/component/func.rs index 04300abe3a..444925575d 100644 --- a/crates/wasmtime/src/runtime/component/func.rs +++ b/crates/wasmtime/src/runtime/component/func.rs @@ -349,7 +349,6 @@ impl Func { /// only works with functions defined within an asynchronous store. Also /// panics if `store` does not own this function. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn call_async( &self, mut store: impl AsContextMut, @@ -609,7 +608,6 @@ impl Func { /// Panics if this is called on a function in a synchronous store. This /// only works with functions defined within an asynchronous store. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn post_return_async( &self, mut store: impl AsContextMut, diff --git a/crates/wasmtime/src/runtime/component/func/typed.rs b/crates/wasmtime/src/runtime/component/func/typed.rs index a328087e56..9994b44577 100644 --- a/crates/wasmtime/src/runtime/component/func/typed.rs +++ b/crates/wasmtime/src/runtime/component/func/typed.rs @@ -170,7 +170,6 @@ where /// only works with functions defined within an asynchronous store. Also /// panics if `store` does not own this function. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn call_async( &self, mut store: impl AsContextMut, @@ -336,7 +335,6 @@ where /// See [`Func::post_return_async`] #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn post_return_async( &self, store: impl AsContextMut, diff --git a/crates/wasmtime/src/runtime/component/instance.rs b/crates/wasmtime/src/runtime/component/instance.rs index 2138b4d797..b17092cbcd 100644 --- a/crates/wasmtime/src/runtime/component/instance.rs +++ b/crates/wasmtime/src/runtime/component/instance.rs @@ -591,7 +591,6 @@ impl InstancePre { // // TODO: needs more docs #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn instantiate_async( &self, mut store: impl AsContextMut, diff --git a/crates/wasmtime/src/runtime/component/linker.rs b/crates/wasmtime/src/runtime/component/linker.rs index 4a885f0270..745e4b9428 100644 --- a/crates/wasmtime/src/runtime/component/linker.rs +++ b/crates/wasmtime/src/runtime/component/linker.rs @@ -319,7 +319,6 @@ impl Linker { /// can return an error if something goes wrong during instantiation such as /// a runtime trap or a runtime limit being exceeded. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn instantiate_async( &self, store: impl AsContextMut, @@ -384,7 +383,6 @@ impl LinkerInstance<'_, T> { /// This is exactly like [`Self::func_wrap`] except it takes an async /// host function. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub fn func_wrap_async(&mut self, name: &str, f: F) -> Result<()> where F: for<'a> Fn( @@ -522,7 +520,6 @@ impl LinkerInstance<'_, T> { /// This is exactly like [`Self::func_new`] except it takes an async /// host function. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub fn func_new_async(&mut self, name: &str, f: F) -> Result<()> where F: for<'a> Fn( diff --git a/crates/wasmtime/src/runtime/component/mod.rs b/crates/wasmtime/src/runtime/component/mod.rs index 721f1e80ef..7276b5cdeb 100644 --- a/crates/wasmtime/src/runtime/component/mod.rs +++ b/crates/wasmtime/src/runtime/component/mod.rs @@ -97,7 +97,6 @@ //! //! See the docs for [`bindgen!`] for more information on how to use it. -#![cfg_attr(docsrs, doc(cfg(feature = "component-model")))] // rustdoc appears to lie about a warning above, so squelch it for now. #![allow(rustdoc::redundant_explicit_links)] diff --git a/crates/wasmtime/src/runtime/component/resources.rs b/crates/wasmtime/src/runtime/component/resources.rs index 789329523a..b2f8d08b1d 100644 --- a/crates/wasmtime/src/runtime/component/resources.rs +++ b/crates/wasmtime/src/runtime/component/resources.rs @@ -978,7 +978,6 @@ impl ResourceAny { /// Same as [`ResourceAny::resource_drop`] except for use with async stores /// to execute the destructor asynchronously. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn resource_drop_async(self, mut store: impl AsContextMut) -> Result<()> where T: Send, diff --git a/crates/wasmtime/src/runtime/externals/table.rs b/crates/wasmtime/src/runtime/externals/table.rs index e7397750eb..359e61f881 100644 --- a/crates/wasmtime/src/runtime/externals/table.rs +++ b/crates/wasmtime/src/runtime/externals/table.rs @@ -77,7 +77,6 @@ impl Table { Table::_new(store.as_context_mut().0, ty, init) } - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] /// Async variant of [`Table::new`]. You must use this variant with /// [`Store`](`crate::Store`)s which have a /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`). @@ -265,7 +264,6 @@ impl Table { } } - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] /// Async variant of [`Table::grow`]. Required when using a /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`). /// diff --git a/crates/wasmtime/src/runtime/func.rs b/crates/wasmtime/src/runtime/func.rs index c0c70bf089..79cadf450a 100644 --- a/crates/wasmtime/src/runtime/func.rs +++ b/crates/wasmtime/src/runtime/func.rs @@ -368,7 +368,6 @@ macro_rules! generate_wrap_async_func { /// This function will panic if called with a non-asynchronous store. #[allow(non_snake_case)] #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub fn []( store: impl AsContextMut, func: impl for<'a> Fn(Caller<'a, T>, $($args),*) -> Box + Send + 'a> + Send + Sync + 'static, @@ -445,7 +444,6 @@ impl Func { /// Panics if the given function type is not associated with this store's /// engine. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn new( store: impl AsContextMut, ty: FuncType, @@ -489,7 +487,6 @@ impl Func { /// Panics if the given function type is not associated with this store's /// engine. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub unsafe fn new_unchecked( mut store: impl AsContextMut, ty: FuncType, @@ -574,7 +571,6 @@ impl Func { /// # } /// ``` #[cfg(all(feature = "async", feature = "cranelift"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "async", feature = "cranelift"))))] pub fn new_async(store: impl AsContextMut, ty: FuncType, func: F) -> Func where F: for<'a> Fn( @@ -1113,7 +1109,6 @@ impl Func { /// only works with functions defined within an asynchronous store. Also /// panics if `store` does not own this function. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn call_async( &self, mut store: impl AsContextMut, @@ -2080,7 +2075,6 @@ impl Caller<'_, T> { /// /// Same as [`Store::gc`](crate::Store::gc). #[cfg(feature = "gc")] - #[cfg_attr(docsrs, doc(cfg(feature = "gc")))] pub fn gc(&mut self) { self.store.gc() } @@ -2089,7 +2083,6 @@ impl Caller<'_, T> { /// /// Same as [`Store::gc_async`](crate::Store::gc_async). #[cfg(all(feature = "async", feature = "gc"))] - #[cfg_attr(docsrs, doc(cfg(feature = "gc")))] pub async fn gc_async(&mut self) where T: Send, diff --git a/crates/wasmtime/src/runtime/func/typed.rs b/crates/wasmtime/src/runtime/func/typed.rs index faacb3a159..1e486c516e 100644 --- a/crates/wasmtime/src/runtime/func/typed.rs +++ b/crates/wasmtime/src/runtime/func/typed.rs @@ -125,7 +125,6 @@ where /// /// [`Trap`]: crate::Trap #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn call_async( &self, mut store: impl AsContextMut, diff --git a/crates/wasmtime/src/runtime/instance.rs b/crates/wasmtime/src/runtime/instance.rs index 80db9340a9..38b251954a 100644 --- a/crates/wasmtime/src/runtime/instance.rs +++ b/crates/wasmtime/src/runtime/instance.rs @@ -145,7 +145,6 @@ impl Instance { /// This function will also panic, like [`Instance::new`], if any [`Extern`] /// specified does not belong to `store`. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn new_async( mut store: impl AsContextMut, module: &Module, @@ -888,7 +887,6 @@ impl InstancePre { /// Panics if any import closed over by this [`InstancePre`] isn't owned by /// `store`, or if `store` does not have async support enabled. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn instantiate_async( &self, mut store: impl AsContextMut, diff --git a/crates/wasmtime/src/runtime/linker.rs b/crates/wasmtime/src/runtime/linker.rs index d9546071b9..ff643367ee 100644 --- a/crates/wasmtime/src/runtime/linker.rs +++ b/crates/wasmtime/src/runtime/linker.rs @@ -140,7 +140,6 @@ macro_rules! generate_wrap_async_func { /// [`Func::wrapN_async`](crate::Func::wrap1_async). #[allow(non_snake_case)] #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub fn []<$($args,)* R>( &mut self, module: &str, @@ -275,7 +274,6 @@ impl Linker { /// # } /// ``` #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn define_unknown_imports_as_traps(&mut self, module: &Module) -> anyhow::Result<()> { for import in module.imports() { if let Err(import_err) = self._get_by_import(&import) { @@ -311,7 +309,6 @@ impl Linker { /// # } /// ``` #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn define_unknown_imports_as_default_values( &mut self, module: &Module, @@ -430,7 +427,6 @@ impl Linker { /// Panics if the given function type is not associated with the same engine /// as this linker. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn func_new( &mut self, module: &str, @@ -454,7 +450,6 @@ impl Linker { /// Panics if the given function type is not associated with the same engine /// as this linker. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub unsafe fn func_new_unchecked( &mut self, module: &str, @@ -483,7 +478,6 @@ impl Linker { /// * If the given function type is not associated with the same engine as /// this linker. #[cfg(all(feature = "async", feature = "cranelift"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "async", feature = "cranelift"))))] pub fn func_new_async( &mut self, module: &str, @@ -786,7 +780,6 @@ impl Linker { /// # } /// ``` #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn module( &mut self, mut store: impl AsContextMut, @@ -857,7 +850,6 @@ impl Linker { /// /// This is the same as [`Linker::module`], except for async `Store`s. #[cfg(all(feature = "async", feature = "cranelift"))] - #[cfg_attr(docsrs, doc(cfg(all(feature = "async", feature = "cranelift"))))] pub async fn module_async( &mut self, mut store: impl AsContextMut, @@ -1130,7 +1122,6 @@ impl Linker { /// Attempts to instantiate the `module` provided. This is the same as /// [`Linker::instantiate`], except for async `Store`s. #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub async fn instantiate_async( &self, mut store: impl AsContextMut, diff --git a/crates/wasmtime/src/runtime/memory.rs b/crates/wasmtime/src/runtime/memory.rs index 4962ffc966..45eb45c22c 100644 --- a/crates/wasmtime/src/runtime/memory.rs +++ b/crates/wasmtime/src/runtime/memory.rs @@ -237,7 +237,6 @@ impl Memory { Self::_new(store.as_context_mut().0, ty) } - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] /// Async variant of [`Memory::new`]. You must use this variant with /// [`Store`](`crate::Store`)s which have a /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`). @@ -519,7 +518,6 @@ impl Memory { } } - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] /// Async variant of [`Memory::grow`]. Required when using a /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`). /// @@ -726,7 +724,6 @@ impl SharedMemory { /// `maximum` number of 64K-sized pages. This call allocates the necessary /// pages on the system. #[cfg(feature = "threads")] - #[cfg_attr(docsrs, doc(cfg(feature = "threads")))] pub fn new(engine: &Engine, ty: MemoryType) -> Result { if !ty.is_shared() { bail!("shared memory must have the `shared` flag enabled on its memory type") diff --git a/crates/wasmtime/src/runtime/module.rs b/crates/wasmtime/src/runtime/module.rs index 22818f5b7d..7f39308f8d 100644 --- a/crates/wasmtime/src/runtime/module.rs +++ b/crates/wasmtime/src/runtime/module.rs @@ -235,7 +235,6 @@ impl Module { /// # } /// ``` #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn new(engine: &Engine, bytes: impl AsRef<[u8]>) -> Result { crate::CodeBuilder::new(engine) .wasm(bytes.as_ref(), None)? @@ -271,7 +270,6 @@ impl Module { /// # } /// ``` #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn from_file(engine: &Engine, file: impl AsRef) -> Result { crate::CodeBuilder::new(engine) .wasm_file(file.as_ref())? @@ -310,7 +308,6 @@ impl Module { /// # } /// ``` #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn from_binary(engine: &Engine, binary: &[u8]) -> Result { crate::CodeBuilder::new(engine) .wasm(binary, None)? @@ -340,7 +337,6 @@ impl Module { /// reflect the current state of the file, not necessarily the original /// state of the file. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub unsafe fn from_trusted_file(engine: &Engine, file: impl AsRef) -> Result { let mmap = MmapVec::from_file(file.as_ref())?; if &mmap[0..4] == b"\x7fELF" { @@ -550,7 +546,6 @@ impl Module { /// this method can be useful to get the serialized version without /// compiling twice. #[cfg(any(feature = "cranelift", feature = "winch"))] - #[cfg_attr(docsrs, doc(cfg(any(feature = "cranelift", feature = "winch"))))] pub fn serialize(&self) -> Result> { // The current representation of compiled modules within a compiled // component means that it cannot be serialized. The mmap returned here diff --git a/crates/wasmtime/src/runtime/store.rs b/crates/wasmtime/src/runtime/store.rs index 45e06e6c43..3f409d8b74 100644 --- a/crates/wasmtime/src/runtime/store.rs +++ b/crates/wasmtime/src/runtime/store.rs @@ -710,7 +710,6 @@ impl Store { /// [`Store`] configured via /// [`Config::async_support`](crate::Config::async_support). #[cfg(feature = "async")] - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] pub fn limiter_async( &mut self, mut limiter: impl FnMut(&mut T) -> &mut (dyn crate::ResourceLimiterAsync) @@ -734,7 +733,6 @@ impl Store { inner.limiter = Some(ResourceLimiterInner::Async(Box::new(limiter))); } - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] /// Configures an async function that runs on calls and returns between /// WebAssembly and host code. For the non-async equivalent of this method, /// see [`Store::call_hook`]. @@ -968,7 +966,6 @@ impl Store { self.inner.epoch_deadline_callback(Box::new(callback)); } - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] /// Configures epoch-deadline expiration to yield to the async /// caller and the update the deadline. /// @@ -1101,7 +1098,6 @@ impl<'a, T> StoreContextMut<'a, T> { self.0.epoch_deadline_trap(); } - #[cfg_attr(docsrs, doc(cfg(feature = "async")))] /// Configures epoch-deadline expiration to yield to the async /// caller and the update the deadline. ///