Skip to main content

Runtime

Struct Runtime 

Source
pub(crate) struct Runtime<'db> {
    data: Rc<RuntimeData<'db>>,
}

Fields§

§data: Rc<RuntimeData<'db>>

Implementations§

Source§

impl<'db> Runtime<'db>

Source

pub(crate) fn execute<T, R>( db: &'db dyn Db, span: Span<'db>, message: &'static str, values: &[&dyn Serialize], constrain: impl AsyncFnOnce(&Runtime<'db>) -> T + 'db, cleanup: impl FnOnce(T) -> R + 'db, ) -> R
where T: 'db, R: 'db + Err<'db> + Serialize + Debug,

Source

fn new( db: &'db dyn Db, compiler_location: &'static Location<'static>, span: Span<'db>, message: &'static str, values: &[&dyn Serialize], ) -> Self

Source

pub fn root_log(&self) -> LogHandle<'db>

Get a duplicate of the root log handle.

Source

fn next_task_id(&self) -> u64

Source

fn spawn_future(&self, future: impl Future<Output = ()> + 'db)

Spawn a new check-task.

Source

fn pop_task(&self) -> Option<Arc<CheckTask>>

Pop and return a task that is ready to execute (if any).

Source

fn drain(&self)

Continues running tasks until no more are left.

Source

fn mark_complete(&self)

Mark the inference process as complete and wake all tasks.

Source

pub fn check_complete(&self) -> bool

Returns true if we have fully constructed the object IR for a given function. Once this returns true, no more bounds will be added to inference variables.

Source

pub fn fresh_inference_var( &self, log: &LogHandle<'_>, data: InferenceVarData<'db>, ) -> InferVarIndex

Creates a fresh inference variable of the given kind and universe.

Low-level routine not to be directly invoked.

Source

pub fn loop_on_inference_var<T>( &self, infer: InferVarIndex, compiler_location: &'static Location<'static>, log: &LogHandle<'db>, op: impl FnMut(&InferenceVarData<'db>) -> Option<T>, ) -> impl Future<Output = Option<T>>
where T: Serialize,

Returns a future that blocks the current task until op returns Some. op will be reinvoked each time the state of the inference variable may have changed.

Source

pub fn perm_infer(&self, infer: InferVarIndex) -> InferVarIndex

If infer is a type variable, returns the permission variable associated with infer. If infer is a permission variable, just returns infer.

Source

pub fn with_inference_var_data<T>( &self, infer: InferVarIndex, op: impl FnOnce(&InferenceVarData<'db>) -> T, ) -> T

Read the current data for the given inference variable.

A lock is held while the read occurs; deadlock will occur if there is an attempt to mutate inference var data during the read.

Source

pub fn mutate_inference_var_data<T>( &self, infer: InferVarIndex, log: &LogHandle<'_>, op: impl FnOnce(&mut InferenceVarData<'db>) -> T, ) -> T

Modify the data for the inference variable infer. If the data actually changes (as indicated by the return value of op via the InferenceVarDataChanged trait), then log the result and wake any tasks blocked on this inference variable.

op should invoke one of the mutation methods on InferenceVarData and nothing else. A write lock is held during the call so anything more complex risks deadlock.

Source

pub fn insert_sub_infer_var_pair( &self, lower: InferVarIndex, upper: InferVarIndex, log: &LogHandle<'_>, ) -> bool

Record that lower <: upper must hold, returning true if this is the first time that this has been recorded or false if it has been recorded before.

Source

fn wake_tasks_monitoring_inference_var(&self, infer: InferVarIndex)

Source

pub fn spawn<R>( &self, env: &Env<'db>, task_description: TaskDescription<'db>, check: impl 'db + AsyncFnOnce(&mut Env<'db>) -> R, )
where R: DeferResult,

Execute the given future asynchronously from the main execution. It must execute to completion eventually or an error will be reported.

Source

fn block_on_inference_var( &self, compiler_location: &'static Location<'static>, log: &LogHandle<'db>, infer: InferVarIndex, cx: &mut Context<'_>, )

Block the current task on changes to the given inference variable.

§Panics

If called when Self::check_complete returns true.

Source

fn report_type_annotations_needed(&self, span: Span<'db>) -> Reported

Trait Implementations§

Source§

impl<'db> Clone for Runtime<'db>

Source§

fn clone(&self) -> Runtime<'db>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'db> Deref for Runtime<'db>

Source§

type Target = RuntimeData<'db>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'db> Freeze for Runtime<'db>

§

impl<'db> !RefUnwindSafe for Runtime<'db>

§

impl<'db> !Send for Runtime<'db>

§

impl<'db> !Sync for Runtime<'db>

§

impl<'db> Unpin for Runtime<'db>

§

impl<'db> UnsafeUnpin for Runtime<'db>

§

impl<'db> !UnwindSafe for Runtime<'db>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Lookup<T> for T

§

fn into_owned(self) -> T

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T