Remove associated_type_defaults unstable feature

Summary: Removes the `associated_type_defaults` unstable feature. This brings us one step closer to removing all usage of unstable nightly features, which will allow publishing the crate on https://crates.io.

Reviewed By: rrnewton

Differential Revision: D41389496

fbshipit-source-id: f80d9dd960196ce4fb61c886796836a79e12962b
This commit is contained in:
Jason White 2022-11-18 12:36:51 -08:00 committed by Facebook GitHub Bot
parent 9a942d055f
commit b9e3f0c0e7
2 changed files with 9 additions and 6 deletions

View file

@ -9,7 +9,6 @@
#![doc = include_str!("../../README.md")]
#![deny(missing_docs)]
#![deny(rustdoc::broken_intra_doc_links)]
#![feature(associated_type_defaults)]
#![feature(never_type)]
mod auxv;

View file

@ -38,14 +38,14 @@ use crate::Tid;
#[async_trait]
pub trait GlobalTool: Send + Sync + Default {
/// The message to send to the global tool.
type Request: Serialize + DeserializeOwned + Send = ();
type Request: Serialize + DeserializeOwned + Send;
/// The result of sending the message.
type Response: Serialize + DeserializeOwned + Send = ();
type Response: Serialize + DeserializeOwned + Send;
/// Static, read-only configuration data that is available everywhere the
/// tool runs code.
type Config: Serialize + DeserializeOwned + Send + Sync + Clone + Default = ();
type Config: Serialize + DeserializeOwned + Send + Sync + Clone + Default;
/// Initialize the tool, allocating the global state.
async fn init_global_state(_cfg: &Self::Config) -> Self {
@ -66,6 +66,7 @@ pub trait GlobalTool: Send + Sync + Default {
impl GlobalTool for () {
type Request = ();
type Response = ();
type Config = ();
async fn receive_rpc(&self, _from: Tid, _message: ()) {}
}
@ -116,7 +117,7 @@ pub trait Tool: Send + Sync + Default {
/// The type of the global half that goes along with this Local tool. By
/// including this type, the Tool is actually a complete specification for an
/// instrumentation tool.
type GlobalState: GlobalTool = ();
type GlobalState: GlobalTool;
/// Tool-state specific to each guest thread. If unset, this defaults to the
/// unit type `()`, indicating that the tool does not have thread-level
@ -131,7 +132,7 @@ pub trait Tool: Send + Sync + Default {
///
/// [`Serialize`]: serde::Serialize
/// [`DeserializeOwned`]: serde::de::DeserializeOwned
type ThreadState: Serialize + DeserializeOwned + Default + Send + Sync = ();
type ThreadState: Serialize + DeserializeOwned + Default + Send + Sync;
/// A common constructor that initializes state when a process is created,
/// including the guest's initial, root process. Of course, every process
@ -317,6 +318,9 @@ pub trait Tool: Send + Sync + Default {
/// A "noop" tool that doesn't do anything.
impl Tool for () {
type GlobalState = ();
type ThreadState = ();
fn subscriptions(_cfg: &()) -> Subscription {
Subscription::none()
}