Struct rustc_resolve::imports::ImportResolver
source · [−]pub struct ImportResolver<'a, 'b> {
pub r: &'a mut Resolver<'b>,
}
Fields
r: &'a mut Resolver<'b>
Implementations
sourceimpl<'a, 'b> ImportResolver<'a, 'b>
impl<'a, 'b> ImportResolver<'a, 'b>
sourcepub(crate) fn make_path_suggestion(
&mut self,
span: Span,
path: Vec<Segment>,
parent_scope: &ParentScope<'b>
) -> Option<(Vec<Segment>, Option<String>)>
pub(crate) fn make_path_suggestion(
&mut self,
span: Span,
path: Vec<Segment>,
parent_scope: &ParentScope<'b>
) -> Option<(Vec<Segment>, Option<String>)>
Adds suggestions for a path that cannot be resolved.
sourcefn make_missing_self_suggestion(
&mut self,
path: Vec<Segment>,
parent_scope: &ParentScope<'b>
) -> Option<(Vec<Segment>, Option<String>)>
fn make_missing_self_suggestion(
&mut self,
path: Vec<Segment>,
parent_scope: &ParentScope<'b>
) -> Option<(Vec<Segment>, Option<String>)>
Suggest a missing self::
if that resolves to an correct module.
|
LL | use foo::Bar;
| ^^^ did you mean `self::foo`?
sourcefn make_missing_crate_suggestion(
&mut self,
path: Vec<Segment>,
parent_scope: &ParentScope<'b>
) -> Option<(Vec<Segment>, Option<String>)>
fn make_missing_crate_suggestion(
&mut self,
path: Vec<Segment>,
parent_scope: &ParentScope<'b>
) -> Option<(Vec<Segment>, Option<String>)>
Suggests a missing crate::
if that resolves to an correct module.
|
LL | use foo::Bar;
| ^^^ did you mean `crate::foo`?
sourcefn make_missing_super_suggestion(
&mut self,
path: Vec<Segment>,
parent_scope: &ParentScope<'b>
) -> Option<(Vec<Segment>, Option<String>)>
fn make_missing_super_suggestion(
&mut self,
path: Vec<Segment>,
parent_scope: &ParentScope<'b>
) -> Option<(Vec<Segment>, Option<String>)>
Suggests a missing super::
if that resolves to an correct module.
|
LL | use foo::Bar;
| ^^^ did you mean `super::foo`?
sourcefn make_external_crate_suggestion(
&mut self,
path: Vec<Segment>,
parent_scope: &ParentScope<'b>
) -> Option<(Vec<Segment>, Option<String>)>
fn make_external_crate_suggestion(
&mut self,
path: Vec<Segment>,
parent_scope: &ParentScope<'b>
) -> Option<(Vec<Segment>, Option<String>)>
Suggests a missing external crate name if that resolves to an correct module.
|
LL | use foobar::Baz;
| ^^^^^^ did you mean `baz::foobar`?
Used when importing a submodule of an external crate but missing that crate’s name as the first part of path.
sourcepub(crate) fn check_for_module_export_macro(
&mut self,
import: &'b Import<'b>,
module: ModuleOrUniformRoot<'b>,
ident: Ident
) -> Option<(Option<(Vec<(Span, String)>, String, Applicability)>, Option<String>)>
pub(crate) fn check_for_module_export_macro(
&mut self,
import: &'b Import<'b>,
module: ModuleOrUniformRoot<'b>,
ident: Ident
) -> Option<(Option<(Vec<(Span, String)>, String, Applicability)>, Option<String>)>
Suggests importing a macro from the root of the crate rather than a module within the crate.
help: a macro with this name exists at the root of the crate
|
LL | use issue_59764::makro;
| ^^^^^^^^^^^^^^^^^^
|
= note: this could be because a macro annotated with `#[macro_export]` will be exported
at the root of the crate instead of the module where it is defined
sourceimpl<'a, 'b> ImportResolver<'a, 'b>
impl<'a, 'b> ImportResolver<'a, 'b>
sourcepub fn resolve_imports(&mut self)
pub fn resolve_imports(&mut self)
Resolves all imports for the crate. This method performs the fixed- point iteration.
pub fn finalize_imports(&mut self)
fn throw_unresolved_import_error(
&self,
errors: Vec<(String, UnresolvedImportError)>,
span: Option<MultiSpan>
)
sourcefn resolve_import(&mut self, import: &'b Import<'b>) -> bool
fn resolve_import(&mut self, import: &'b Import<'b>) -> bool
Attempts to resolve the given import, returning true if its resolution is determined. If successful, the resolved bindings are written into the module.
sourcefn finalize_import(
&mut self,
import: &'b Import<'b>
) -> Option<UnresolvedImportError>
fn finalize_import(
&mut self,
import: &'b Import<'b>
) -> Option<UnresolvedImportError>
Performs final import resolution, consistency checks and error reporting.
Optionally returns an unresolved import error. This error is buffered and used to consolidate multiple unresolved import errors into a single diagnostic.
fn check_for_redundant_imports(
&mut self,
ident: Ident,
import: &'b Import<'b>,
source_bindings: &PerNS<Cell<Result<&'b NameBinding<'b>, Determinacy>>>,
target_bindings: &PerNS<Cell<Option<&'b NameBinding<'b>>>>,
target: Ident
)
fn resolve_glob_import(&mut self, import: &'b Import<'b>)
fn finalize_resolutions_in(&mut self, module: &'b ModuleData<'b>)
Auto Trait Implementations
impl<'a, 'b> !RefUnwindSafe for ImportResolver<'a, 'b>
impl<'a, 'b> !Send for ImportResolver<'a, 'b>
impl<'a, 'b> !Sync for ImportResolver<'a, 'b>
impl<'a, 'b> Unpin for ImportResolver<'a, 'b>where
'b: 'a,
impl<'a, 'b> !UnwindSafe for ImportResolver<'a, 'b>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes