pub struct Resolver<'db> {
pub data: ResolverData,
pub owning_crate_id: CrateId,
pub settings: CrateSettings,
/* private fields */
}
Expand description
Resolves paths semantically.
Fields§
§data: ResolverData
§owning_crate_id: CrateId
§settings: CrateSettings
Implementations§
Source§impl Resolver<'_>
impl Resolver<'_>
Sourcepub fn set_feature_config(
&mut self,
element_id: &impl LanguageElementId,
syntax: &impl QueryAttrs,
diagnostics: &mut SemanticDiagnostics,
)
pub fn set_feature_config( &mut self, element_id: &impl LanguageElementId, syntax: &impl QueryAttrs, diagnostics: &mut SemanticDiagnostics, )
Extracts the allowed node from the syntax, and sets it as the allowed features of the resolver.
Source§impl<'db> Resolver<'db>
impl<'db> Resolver<'db>
pub fn new( db: &'db dyn SemanticGroup, module_file_id: ModuleFileId, inference_id: InferenceId, ) -> Self
pub fn with_data(db: &'db dyn SemanticGroup, data: ResolverData) -> Self
pub fn inference(&mut self) -> Inference<'_>
Sourcepub fn add_generic_param(&mut self, generic_param_id: GenericParamId)
pub fn add_generic_param(&mut self, generic_param_id: GenericParamId)
Adds a generic param to an existing resolver. This is required since a resolver needs to exist before resolving the generic params, and thus, they are added to the Resolver only after they are resolved.
Sourcepub fn resolve_concrete_path(
&mut self,
diagnostics: &mut SemanticDiagnostics,
path: impl AsSegments,
item_type: NotFoundItemType,
) -> Maybe<ResolvedConcreteItem>
pub fn resolve_concrete_path( &mut self, diagnostics: &mut SemanticDiagnostics, path: impl AsSegments, item_type: NotFoundItemType, ) -> Maybe<ResolvedConcreteItem>
Resolves a concrete item, given a path. Guaranteed to result in at most one diagnostic. Item not inside a statement.
Sourcepub fn resolve_concrete_path_ex(
&mut self,
diagnostics: &mut SemanticDiagnostics,
path: impl AsSegments,
item_type: NotFoundItemType,
statement_env: Option<&mut Environment>,
) -> Maybe<ResolvedConcreteItem>
pub fn resolve_concrete_path_ex( &mut self, diagnostics: &mut SemanticDiagnostics, path: impl AsSegments, item_type: NotFoundItemType, statement_env: Option<&mut Environment>, ) -> Maybe<ResolvedConcreteItem>
Resolves a concrete item, given a path. Guaranteed to result in at most one diagnostic.
Sourcepub fn resolve_generic_path(
&mut self,
diagnostics: &mut SemanticDiagnostics,
path: impl AsSegments,
item_type: NotFoundItemType,
statement_env: Option<&mut Environment>,
) -> Maybe<ResolvedGenericItem>
pub fn resolve_generic_path( &mut self, diagnostics: &mut SemanticDiagnostics, path: impl AsSegments, item_type: NotFoundItemType, statement_env: Option<&mut Environment>, ) -> Maybe<ResolvedGenericItem>
Resolves a generic item, given a path. Guaranteed to result in at most one diagnostic.
Sourcepub fn resolve_generic_path_with_args(
&mut self,
diagnostics: &mut SemanticDiagnostics,
path: impl AsSegments,
item_type: NotFoundItemType,
statement_env: Option<&mut Environment>,
) -> Maybe<ResolvedGenericItem>
pub fn resolve_generic_path_with_args( &mut self, diagnostics: &mut SemanticDiagnostics, path: impl AsSegments, item_type: NotFoundItemType, statement_env: Option<&mut Environment>, ) -> Maybe<ResolvedGenericItem>
Resolves a generic item, given a concrete item path, while ignoring the generic args. Guaranteed to result in at most one diagnostic.
Sourcepub fn prelude_submodule(&self) -> ModuleId
pub fn prelude_submodule(&self) -> ModuleId
Returns the crate’s prelude
submodule.
Sourcepub fn specialize_function(
&mut self,
diagnostics: &mut SemanticDiagnostics,
stable_ptr: SyntaxStablePtrId,
generic_function: GenericFunctionId,
generic_args: &[GenericArg],
) -> Maybe<FunctionId>
pub fn specialize_function( &mut self, diagnostics: &mut SemanticDiagnostics, stable_ptr: SyntaxStablePtrId, generic_function: GenericFunctionId, generic_args: &[GenericArg], ) -> Maybe<FunctionId>
Specializes a generic function.
Sourcepub fn specialize_type(
&mut self,
diagnostics: &mut SemanticDiagnostics,
stable_ptr: SyntaxStablePtrId,
generic_type: GenericTypeId,
generic_args: &[GenericArg],
) -> Maybe<TypeId>
pub fn specialize_type( &mut self, diagnostics: &mut SemanticDiagnostics, stable_ptr: SyntaxStablePtrId, generic_type: GenericTypeId, generic_args: &[GenericArg], ) -> Maybe<TypeId>
Specializes a generic type.
pub fn impl_lookup_context(&self) -> ImplLookupContext
Sourcepub fn resolve_generic_args(
&mut self,
diagnostics: &mut SemanticDiagnostics,
substitution: GenericSubstitution,
generic_params: &[GenericParam],
generic_args_syntax: &[GenericArg],
stable_ptr: SyntaxStablePtrId,
) -> Maybe<Vec<GenericArgumentId>>
pub fn resolve_generic_args( &mut self, diagnostics: &mut SemanticDiagnostics, substitution: GenericSubstitution, generic_params: &[GenericParam], generic_args_syntax: &[GenericArg], stable_ptr: SyntaxStablePtrId, ) -> Maybe<Vec<GenericArgumentId>>
Resolves generic arguments. For each generic argument, if the syntax is provided, it will be resolved by the inference. Otherwise, resolved by type.
Sourcepub fn ignore_visibility_checks(&self, module_id: ModuleId) -> bool
pub fn ignore_visibility_checks(&self, module_id: ModuleId) -> bool
Should visibility checks not actually happen for lookups in this module.
Sourcepub fn validate_feature_constraints<T: HasFeatureKind>(
&self,
diagnostics: &mut SemanticDiagnostics,
identifier: &TerminalIdentifier,
item_info: &T,
)
pub fn validate_feature_constraints<T: HasFeatureKind>( &self, diagnostics: &mut SemanticDiagnostics, identifier: &TerminalIdentifier, item_info: &T, )
Validates whether a given item is allowed based on its feature kind. This function checks if the item’s feature kind is allowed in the current configuration. If the item uses an unstable, deprecated, or internal feature that is not permitted, a corresponding diagnostic error is reported.
Methods from Deref<Target = ResolverData>§
pub fn clone_with_inference_id( &self, db: &dyn SemanticGroup, inference_id: InferenceId, ) -> Self
Trait Implementations§
Auto Trait Implementations§
impl<'db> Freeze for Resolver<'db>
impl<'db> !RefUnwindSafe for Resolver<'db>
impl<'db> !Send for Resolver<'db>
impl<'db> !Sync for Resolver<'db>
impl<'db> Unpin for Resolver<'db>
impl<'db> !UnwindSafe for Resolver<'db>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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