Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ jobs:
runs-on: ubuntu-latest
env:
CARGO_MDBOOK_VERSION: 0.4.21
RUSTDOCFLAGS: -Dbroken_intra_doc_links --cfg nightlydoc
RUSTDOCFLAGS: -Dbroken_intra_doc_links --cfg docsrs
OPENVINO_SKIP_LINKING: 1
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion crates/runtime/src/sys/unix/machports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ use mach::port::*;
use mach::thread_act::*;
use mach::traps::*;
use std::mem;
use std::ptr::addr_of_mut;
use std::thread;

/// Other `mach` declarations awaiting <https://github.com/fitzgen/mach/pull/64>
Expand Down Expand Up @@ -180,7 +181,7 @@ pub unsafe fn platform_init() {
// Allocate our WASMTIME_PORT and make sure that it can be sent to so we
// can receive exceptions.
let me = mach_task_self();
let kret = mach_port_allocate(me, MACH_PORT_RIGHT_RECEIVE, &mut WASMTIME_PORT);
let kret = mach_port_allocate(me, MACH_PORT_RIGHT_RECEIVE, addr_of_mut!(WASMTIME_PORT));
assert_eq!(kret, KERN_SUCCESS, "failed to allocate port");
let kret = mach_port_insert_right(me, WASMTIME_PORT, WASMTIME_PORT, MACH_MSG_TYPE_MAKE_SEND);
assert_eq!(kret, KERN_SUCCESS, "failed to insert right");
Expand Down
2 changes: 0 additions & 2 deletions crates/wasi-common/cap-std-sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
//! deps, so we will retain a sync implementation so that wasi-common users
//! have an option of not pulling in an async runtime.

#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]

pub mod clocks;
pub mod dir;
pub mod file;
Expand Down
1 change: 0 additions & 1 deletion crates/wasmtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ rust-version.workspace = true
workspace = true

[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "nightlydoc"]
# Docs.rs will use the `component-model` feature for documentation;
# so this feature also passed in to the `cargo doc` invocation in CI.
# See .github/workflows/main.yml
Expand Down
36 changes: 18 additions & 18 deletions crates/wasmtime/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl Config {
///
/// This method will error if the given target triple is not supported.
#[cfg(any(feature = "cranelift", feature = "winch"))]
#[cfg_attr(nightlydoc, doc(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))?);
Expand Down Expand Up @@ -391,7 +391,7 @@ 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(nightlydoc, doc(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
Expand Down Expand Up @@ -668,7 +668,7 @@ 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(nightlydoc, doc(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
Expand Down Expand Up @@ -906,7 +906,7 @@ impl Config {
///
/// The default value for this is `Strategy::Auto`.
#[cfg(any(feature = "cranelift", feature = "winch"))]
#[cfg_attr(nightlydoc, doc(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
Expand Down Expand Up @@ -940,7 +940,7 @@ impl Config {
///
/// The default value for this is `false`
#[cfg(any(feature = "cranelift", feature = "winch"))]
#[cfg_attr(nightlydoc, doc(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
Expand All @@ -957,7 +957,7 @@ impl Config {
///
/// The default value for this is `OptLevel::None`.
#[cfg(any(feature = "cranelift", feature = "winch"))]
#[cfg_attr(nightlydoc, doc(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",
Expand All @@ -979,7 +979,7 @@ impl Config {
///
/// The default value for this is `false`
#[cfg(any(feature = "cranelift", feature = "winch"))]
#[cfg_attr(nightlydoc, doc(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
Expand All @@ -1002,7 +1002,7 @@ 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(nightlydoc, doc(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
Expand All @@ -1028,7 +1028,7 @@ 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(nightlydoc, doc(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
Expand All @@ -1054,7 +1054,7 @@ 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(nightlydoc, doc(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
Expand All @@ -1081,7 +1081,7 @@ impl Config {
///
/// [docs]: https://bytecodealliance.github.io/wasmtime/cli-cache.html
#[cfg(feature = "cache")]
#[cfg_attr(nightlydoc, doc(cfg(feature = "cache")))]
#[cfg_attr(docsrs, doc(cfg(feature = "cache")))]
pub fn cache_config_load(&mut self, path: impl AsRef<Path>) -> Result<&mut Self> {
self.cache_config = CacheConfig::from_file(Some(path.as_ref()))?;
Ok(self)
Expand All @@ -1098,7 +1098,7 @@ impl Config {
/// This method is only available when the `cache` feature of this crate is
/// enabled.
#[cfg(feature = "cache")]
#[cfg_attr(nightlydoc, doc(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
Expand Down Expand Up @@ -1126,7 +1126,7 @@ impl Config {
///
/// [docs]: https://bytecodealliance.github.io/wasmtime/cli-cache.html
#[cfg(feature = "cache")]
#[cfg_attr(nightlydoc, doc(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)
Expand All @@ -1147,7 +1147,7 @@ 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(nightlydoc, doc(cfg(feature = "async")))]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub fn with_host_stack(&mut self, stack_creator: Arc<dyn StackCreator>) -> &mut Self {
self.stack_creator = Some(Arc::new(StackCreatorProxy(stack_creator)));
self
Expand Down Expand Up @@ -1459,7 +1459,7 @@ impl Config {
///
/// By default parallel compilation is enabled.
#[cfg(feature = "parallel-compilation")]
#[cfg_attr(nightlydoc, doc(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
Expand Down Expand Up @@ -1553,7 +1553,7 @@ impl Config {
///
/// This option is disabled by default.
#[cfg(feature = "coredump")]
#[cfg_attr(nightlydoc, doc(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
Expand Down Expand Up @@ -2117,7 +2117,7 @@ impl PoolingAllocationConfig {
///
/// [`call_async`]: crate::TypedFunc::call_async
#[cfg(feature = "async")]
#[cfg_attr(nightlydoc, doc(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
Expand All @@ -2135,7 +2135,7 @@ impl PoolingAllocationConfig {
/// Note that when using this option the memory with async stacks will
/// never be decommitted.
#[cfg(feature = "async")]
#[cfg_attr(nightlydoc, doc(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;
Expand Down
8 changes: 4 additions & 4 deletions crates/wasmtime/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ impl Engine {
}

#[cfg(any(feature = "cranelift", feature = "winch"))]
#[cfg_attr(nightlydoc, doc(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
Expand Down Expand Up @@ -519,7 +519,7 @@ impl Engine {
/// Same as [`Engine::precompile_module`] except for a
/// [`Component`](crate::component::Component)
#[cfg(feature = "component-model")]
#[cfg_attr(nightlydoc, doc(cfg(feature = "component-model")))]
#[cfg_attr(docsrs, doc(cfg(feature = "component-model")))]
pub fn precompile_component(&self, bytes: &[u8]) -> Result<Vec<u8>> {
#[cfg(feature = "wat")]
let bytes = wat::parse_bytes(&bytes)?;
Expand Down Expand Up @@ -562,7 +562,7 @@ pub enum Precompiled {
}

#[cfg(feature = "runtime")]
#[cfg_attr(nightlydoc, doc(cfg(feature = "runtime")))]
#[cfg_attr(docsrs, doc(cfg(feature = "runtime")))]
impl Engine {
/// Eagerly initialize thread-local functionality shared by all [`Engine`]s.
///
Expand Down Expand Up @@ -650,7 +650,7 @@ 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(nightlydoc, doc(cfg(feature = "cranelift")))] // see build.rs
#[cfg_attr(docsrs, doc(cfg(feature = "cranelift")))] // see build.rs
pub fn precompile_compatibility_hash(&self) -> impl std::hash::Hash + '_ {
crate::module::HashedEngineCompileEnv(self)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
#![deny(missing_docs)]
#![doc(test(attr(deny(warnings))))]
#![doc(test(attr(allow(dead_code, unused_variables, unused_mut))))]
#![cfg_attr(nightlydoc, feature(doc_cfg))]
#![cfg_attr(docsrs, feature(doc_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
Expand Down
4 changes: 2 additions & 2 deletions crates/wasmtime/src/profiling_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cfg_if::cfg_if! {
pub use jitdump::new as new_jitdump;
} else {
pub fn new_jitdump() -> Result<Box<dyn ProfilingAgent>> {
if cfg!(feature = "jitdump") {
if cfg!(feature = "profiling") {
bail!("jitdump is not supported on this platform");
} else {
bail!("jitdump support disabled at compile time");
Expand Down Expand Up @@ -35,7 +35,7 @@ cfg_if::cfg_if! {
pub use vtune::new as new_vtune;
} else {
pub fn new_vtune() -> Result<Box<dyn ProfilingAgent>> {
if cfg!(feature = "vtune") {
if cfg!(feature = "profiling") {
bail!("VTune is not supported on this platform.");
} else {
bail!("VTune support disabled at compile time.");
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/src/runtime.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg_attr(nightlydoc, doc(cfg(feature = "runtime")))]
#![cfg_attr(docsrs, doc(cfg(feature = "runtime")))]

#[macro_use]
pub(crate) mod func;
Expand Down
6 changes: 3 additions & 3 deletions crates/wasmtime/src/runtime/component/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl Component {
/// # Ok(())
/// # }
#[cfg(any(feature = "cranelift", feature = "winch"))]
#[cfg_attr(nightlydoc, doc(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<Component> {
let bytes = bytes.as_ref();
#[cfg(feature = "wat")]
Expand All @@ -154,7 +154,7 @@ 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(nightlydoc, doc(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<Path>) -> Result<Component> {
match Self::new(
engine,
Expand Down Expand Up @@ -185,7 +185,7 @@ impl Component {
///
/// For more information on semantics and errors see [`Component::new`].
#[cfg(any(feature = "cranelift", feature = "winch"))]
#[cfg_attr(nightlydoc, doc(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<Component> {
use crate::compile::build_component_artifacts;
use crate::module::HashedEngineCompileEnv;
Expand Down
4 changes: 2 additions & 2 deletions crates/wasmtime/src/runtime/component/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ 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(nightlydoc, doc(cfg(feature = "async")))]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub async fn call_async<T>(
&self,
mut store: impl AsContextMut<Data = T>,
Expand Down Expand Up @@ -614,7 +614,7 @@ 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(nightlydoc, doc(cfg(feature = "async")))]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub async fn post_return_async<T: Send>(
&self,
mut store: impl AsContextMut<Data = T>,
Expand Down
4 changes: 2 additions & 2 deletions crates/wasmtime/src/runtime/component/func/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ where
/// only works with functions defined within an asynchronous store. Also
/// panics if `store` does not own this function.
#[cfg(feature = "async")]
#[cfg_attr(nightlydoc, doc(cfg(feature = "async")))]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub async fn call_async<T>(
&self,
mut store: impl AsContextMut<Data = T>,
Expand Down Expand Up @@ -336,7 +336,7 @@ where

/// See [`Func::post_return_async`]
#[cfg(feature = "async")]
#[cfg_attr(nightlydoc, doc(cfg(feature = "async")))]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub async fn post_return_async<T: Send>(
&self,
store: impl AsContextMut<Data = T>,
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/src/runtime/component/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ impl<T> InstancePre<T> {
//
// TODO: needs more docs
#[cfg(feature = "async")]
#[cfg_attr(nightlydoc, doc(cfg(feature = "async")))]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub async fn instantiate_async(
&self,
mut store: impl AsContextMut<Data = T>,
Expand Down
6 changes: 3 additions & 3 deletions crates/wasmtime/src/runtime/component/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl<T> Linker<T> {
/// 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(nightlydoc, doc(cfg(feature = "async")))]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub async fn instantiate_async(
&self,
store: impl AsContextMut<Data = T>,
Expand Down Expand Up @@ -377,7 +377,7 @@ impl<T> LinkerInstance<'_, T> {
/// This is exactly like [`Self::func_wrap`] except it takes an async
/// host function.
#[cfg(feature = "async")]
#[cfg_attr(nightlydoc, doc(cfg(feature = "async")))]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub fn func_wrap_async<Params, Return, F>(&mut self, name: &str, f: F) -> Result<()>
where
F: for<'a> Fn(
Expand Down Expand Up @@ -456,7 +456,7 @@ impl<T> LinkerInstance<'_, T> {
/// This is exactly like [`Self::func_new`] except it takes an async
/// host function.
#[cfg(feature = "async")]
#[cfg_attr(nightlydoc, doc(cfg(feature = "async")))]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub fn func_new_async<F>(&mut self, component: &Component, name: &str, f: F) -> Result<()>
where
F: for<'a> Fn(
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/src/runtime/component/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
//! Model][Component Model] to get an overview about how to build components
//! from various languages.

#![cfg_attr(nightlydoc, doc(cfg(feature = "component-model")))]
#![cfg_attr(docsrs, doc(cfg(feature = "component-model")))]

mod component;
mod func;
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/src/runtime/component/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ impl ResourceAny {
/// Same as [`ResourceAny::resource_drop`] except for use with async stores
/// to execute the destructor asynchronously.
#[cfg(feature = "async")]
#[cfg_attr(nightlydoc, doc(cfg(feature = "async")))]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub async fn resource_drop_async<T>(self, mut store: impl AsContextMut<Data = T>) -> Result<()>
where
T: Send,
Expand Down
Loading