pub type DomainGoal = DomainGoal<Interner>;
Aliased Type§
enum DomainGoal {
Holds(WhereClause<Interner>),
WellFormed(WellFormed<Interner>),
FromEnv(FromEnv<Interner>),
Normalize(Normalize<Interner>),
IsLocal(Ty<Interner>),
IsUpstream(Ty<Interner>),
IsFullyVisible(Ty<Interner>),
LocalImplAllowed(TraitRef<Interner>),
Compatible,
DownstreamType(Ty<Interner>),
Reveal,
ObjectSafe(TraitId<Interner>),
}
Variants§
Holds(WhereClause<Interner>)
Simple goal that is true if the where clause is true.
WellFormed(WellFormed<Interner>)
True if the type or trait ref is well-formed.
FromEnv(FromEnv<Interner>)
True if the trait ref can be derived from in-scope where clauses.
Normalize(Normalize<Interner>)
True if the alias type can be normalized to some other type
IsLocal(Ty<Interner>)
True if a type is considered to have been “defined” by the current crate. This is true for
a struct Foo { }
but false for a #[upstream] struct Foo { }
. However, for fundamental types
like Box<T>
, it is true if T
is local.
IsUpstream(Ty<Interner>)
True if a type is not considered to have been “defined” by the current crate. This is
false for a struct Foo { }
but true for a #[upstream] struct Foo { }
. However, for
fundamental types like Box<T>
, it is true if T
is upstream.
IsFullyVisible(Ty<Interner>)
True if a type and its input types are fully visible, known types. That is, there are no unknown type parameters anywhere in this type.
More formally, for each struct S<P0..Pn>: forall<P0..Pn> { IsFullyVisible(S<P0…Pn>) :- IsFullyVisible(P0), … IsFullyVisible(Pn) }
Note that any of these types can have lifetimes in their parameters too, but we only consider type parameters.
LocalImplAllowed(TraitRef<Interner>)
Used to dictate when trait impls are allowed in the current (local) crate based on the orphan rules.
LocalImplAllowed(T: Trait)
is true if the type T is allowed to impl trait Trait in
the current crate. Under the current rules, this is unconditionally true for all types if
the Trait is considered to be “defined” in the current crate. If that is not the case, then
LocalImplAllowed(T: Trait)
can still be true if IsLocal(T)
is true.
Compatible
Used to activate the “compatible modality” rules. Rules that introduce predicates that have to do with “all compatible universes” should depend on this clause so that they only apply if this is present.
DownstreamType(Ty<Interner>)
Used to indicate that a given type is in a downstream crate. Downstream crates contain the current crate at some level of their dependencies.
Since chalk does not actually see downstream types, this is usually introduced with implication on a fresh, universally quantified type.
forall
This makes a new type T
available and makes DownstreamType(T)
provable for that type.
Reveal
Used to activate the “reveal mode”, in which opaque (impl Trait
) types can be equated
to their actual type.
ObjectSafe(TraitId<Interner>)
Used to indicate that a trait is object safe.
Trait Implementations§
source§impl HirDisplay for DomainGoal
impl HirDisplay for DomainGoal
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError>
source§fn into_displayable<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>,
limited_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget,
closure_style: ClosureStyle,
show_container_bounds: bool,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn into_displayable<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>,
limited_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget,
closure_style: ClosureStyle,
show_container_bounds: bool,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Display
able type that is human-readable.source§fn display<'a>(
&'a self,
db: &'a dyn HirDatabase,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display<'a>(
&'a self,
db: &'a dyn HirDatabase,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Display
able type that is human-readable.
Use this for showing types to the user (e.g. diagnostics)source§fn display_truncated<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_truncated<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Display
able type that is human-readable and tries to be succinct.
Use this for showing types to the user where space is constrained (e.g. doc popups)source§fn display_limited<'a>(
&'a self,
db: &'a dyn HirDatabase,
limited_size: Option<usize>,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_limited<'a>(
&'a self,
db: &'a dyn HirDatabase,
limited_size: Option<usize>,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Display
able type that is human-readable and tries to limit the number of items inside.
Use this for showing definitions which may contain too many items, like trait
, struct
, enum
source§fn display_source_code<'a>(
&'a self,
db: &'a dyn HirDatabase,
module_id: ModuleId,
allow_opaque: bool,
) -> Result<String, DisplaySourceCodeError>
fn display_source_code<'a>( &'a self, db: &'a dyn HirDatabase, module_id: ModuleId, allow_opaque: bool, ) -> Result<String, DisplaySourceCodeError>
self
that can be inserted into the given module.
Use this when generating code (e.g. assists)source§fn display_test<'a>(
&'a self,
db: &'a dyn HirDatabase,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_test<'a>(
&'a self,
db: &'a dyn HirDatabase,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
self
for test purposessource§fn display_with_container_bounds<'a>(
&'a self,
db: &'a dyn HirDatabase,
show_container_bounds: bool,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_with_container_bounds<'a>(
&'a self,
db: &'a dyn HirDatabase,
show_container_bounds: bool,
edition: Edition,
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
self
that shows the constraint from
the container for functions