pub struct WKVar {
pub wkvid: WKVid,
pub self_args: usize,
pub args: List<Expr>,
}Expand description
A weak kvar is like a kvar with the exception that it infers the weakest condition necessary instead of the strongest condition. Due to the way we generate these kvars (on fn_sigs, rather than during constraint generation), they also in theory are global.
Fields§
§wkvid: WKVid§self_args: usizeAnalagous to KVar self arguments except we require that instantiations use at least one of the self_args (unless there are none, in which case there is no such requirement).
This is mostly relevant for weak kvars corresponding to function outputs. Consider the signature
foo: fn(x: usize) -> bool{b: $wk1(b, x)}
requires $wk0(x)In this case self_args would be 1 (corresponding to the bool b).
Consider now the snippet
let b = foo(x);
assert(x > 0);Suppose the assertion fails. Without the self_args requirement, we could validly instantiate
$wk1(b, x) := x > 0But this is somewhat nonsensical because only in exceptional cases
does it make sense for foo to somehow “add” information to its
argument (x).
By checking for the presence of at least one self arg, we ensure that the self argument is “used”; fixpoint does a similar check.
This is a syntactic underapproximation and doesn’t preclude things like
$wk1(b, x) := (b => true) && (x > 0)But we could conceive of a more sophisticated check using the self_args.
args: List<Expr>All arguments with self arguments at the beginning.
Implementations§
Trait Implementations§
Source§impl TypeFoldable for WKVar
impl TypeFoldable for WKVar
fn try_fold_with<__F: FallibleTypeFolder>( &self, __folder: &mut __F, ) -> Result<Self, __F::Error>
fn fold_with<F: TypeFolder>(&self, folder: &mut F) -> Self
Source§fn normalize(&self, genv: GlobalEnv<'_, '_>) -> Self
fn normalize(&self, genv: GlobalEnv<'_, '_>) -> Self
Source§fn replace_holes(
&self,
f: impl FnMut(&[BoundVariableKinds], HoleKind) -> Expr,
) -> Self
fn replace_holes( &self, f: impl FnMut(&[BoundVariableKinds], HoleKind) -> Expr, ) -> Self
Source§fn with_holes(&self) -> Self
fn with_holes(&self) -> Self
BaseTy into a TyKind::Exists with a
TyKind::Constr and a hole. For example, Vec<{v. i32[v] | v > 0}>[n] becomes
{n. Vec<{v. i32[v] | *}>[n] | *}.fn replace_evars( &self, f: &mut impl FnMut(EVid) -> Option<Expr>, ) -> Result<Self, EVid>
Source§fn shift_horizontally(&self, amount: usize) -> Self
fn shift_horizontally(&self, amount: usize) -> Self
fn shift_in_escaping(&self, amount: u32) -> Self
fn shift_out_escaping(&self, amount: u32) -> Self
fn erase_regions(&self) -> Self
Source§impl TypeVisitable for WKVar
impl TypeVisitable for WKVar
fn visit_with<__V: TypeVisitor>( &self, __visitor: &mut __V, ) -> ControlFlow<__V::BreakTy>
fn has_escaping_bvars(&self) -> bool
Source§fn has_escaping_bvars_at_or_above(&self, binder: DebruijnIndex) -> bool
fn has_escaping_bvars_at_or_above(&self, binder: DebruijnIndex) -> bool
true if self has any late-bound vars that are either
bound by binder or bound by some binder outside of binder.
If binder is ty::INNERMOST, this indicates whether
there are any late-bound vars that appear free.Source§fn fvars(&self) -> FxHashSet<Name>
fn fvars(&self) -> FxHashSet<Name>
Vec<i32[n]>{v : v > m} returns {n, m}.fn early_params(&self) -> FxHashSet<EarlyReftParam>
Source§fn redundant_bvars(&self) -> UnordSet<BoundVar>
fn redundant_bvars(&self) -> UnordSet<BoundVar>
impl Eq for WKVar
impl StructuralPartialEq for WKVar
Auto Trait Implementations§
impl Freeze for WKVar
impl RefUnwindSafe for WKVar
impl Send for WKVar
impl Sync for WKVar
impl Unpin for WKVar
impl UnwindSafe for WKVar
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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