Struct rustdoc::passes::collect_intra_doc_links::LinkCollector [−][src]
Fields
cx: &'a mut DocContext<'tcx>mod_ids: Vec<DefId>A stack of modules used to decide what scope to resolve in.
The last module will be used if the parent scope of the current item is unknown.
kind_side_channel: Cell<Option<(DefKind, DefId)>>This is used to store the kind of associated items,
because clean and the disambiguator code expect them to be different.
See the code for associated items on inherent impls for details.
visited_links: FxHashMap<ResolutionInfo, Option<CachedLink>>Cache the resolved links so we can avoid resolving (and emitting errors for) the same link.
The link will be None if it could not be resolved (i.e. the error was cached).
Implementations
impl<'a, 'tcx> LinkCollector<'a, 'tcx>[src]
fn variant_field<'path>(
&self,
path_str: &'path str,
module_id: DefId
) -> Result<(Res, Option<String>), ErrorKind<'path>>[src]
&self,
path_str: &'path str,
module_id: DefId
) -> Result<(Res, Option<String>), ErrorKind<'path>>
Given a full link, parse it as an enum struct variant.
In particular, this will return an error whenever there aren’t three full path segments left in the link.
fn resolve_primitive_associated_item<'path>(
&self,
prim_ty: PrimitiveType,
ns: Namespace,
module_id: DefId,
item_name: Symbol,
item_str: &'path str
) -> Result<(Res, Option<String>), ErrorKind<'path>>[src]
&self,
prim_ty: PrimitiveType,
ns: Namespace,
module_id: DefId,
item_name: Symbol,
item_str: &'path str
) -> Result<(Res, Option<String>), ErrorKind<'path>>
Given a primitive type, try to resolve an associated item.
HACK(jynelson): item_str is passed in instead of derived from item_name so the
lifetimes on &'path will work.
fn resolve_macro(
&self,
path_str: &'a str,
module_id: DefId
) -> Result<Res, ResolutionFailure<'a>>[src]
&self,
path_str: &'a str,
module_id: DefId
) -> Result<Res, ResolutionFailure<'a>>
Resolves a string as a macro.
FIXME(jynelson): Can this be unified with resolve()?
fn resolve_path(
&self,
path_str: &str,
ns: Namespace,
module_id: DefId
) -> Option<Res>[src]
&self,
path_str: &str,
ns: Namespace,
module_id: DefId
) -> Option<Res>
Convenience wrapper around resolve_str_path_error.
This also handles resolving true and false as booleans.
NOTE: resolve_str_path_error knows only about paths, not about types.
Associated items will never be resolved by this function.
fn resolve<'path>(
&mut self,
path_str: &'path str,
ns: Namespace,
module_id: DefId,
extra_fragment: &Option<String>
) -> Result<(Res, Option<String>), ErrorKind<'path>>[src]
&mut self,
path_str: &'path str,
ns: Namespace,
module_id: DefId,
extra_fragment: &Option<String>
) -> Result<(Res, Option<String>), ErrorKind<'path>>
Resolves a string as a path within a particular namespace. Returns an optional URL fragment in the case of variants and methods.
fn check_full_res(
&mut self,
ns: Namespace,
path_str: &str,
module_id: DefId,
extra_fragment: &Option<String>
) -> Option<Res>[src]
&mut self,
ns: Namespace,
path_str: &str,
module_id: DefId,
extra_fragment: &Option<String>
) -> Option<Res>
Used for reporting better errors.
Returns whether the link resolved ‘fully’ in another namespace.
‘fully’ here means that all parts of the link resolved, not just some path segments.
This returns the Res even if it was erroneous for some reason
(such as having invalid URL fragments or being in the wrong namespace).
impl LinkCollector<'_, '_>[src]
fn resolve_link(
&mut self,
item: &Item,
dox: &str,
self_name: &Option<String>,
parent_node: Option<DefId>,
krate: CrateNum,
ori_link: MarkdownLink
) -> Option<ItemLink>[src]
&mut self,
item: &Item,
dox: &str,
self_name: &Option<String>,
parent_node: Option<DefId>,
krate: CrateNum,
ori_link: MarkdownLink
) -> Option<ItemLink>
This is the entry point for resolving an intra-doc link.
FIXME(jynelson): this is way too many arguments
fn resolve_with_disambiguator_cached(
&mut self,
key: ResolutionInfo,
diag: DiagnosticInfo<'_>,
cache_resolution_failure: bool
) -> Option<(Res, Option<String>)>[src]
&mut self,
key: ResolutionInfo,
diag: DiagnosticInfo<'_>,
cache_resolution_failure: bool
) -> Option<(Res, Option<String>)>
fn resolve_with_disambiguator(
&mut self,
key: &ResolutionInfo,
diag: DiagnosticInfo<'_>
) -> Option<(Res, Option<String>)>[src]
&mut self,
key: &ResolutionInfo,
diag: DiagnosticInfo<'_>
) -> Option<(Res, Option<String>)>
After parsing the disambiguator, resolve the main part of the link.
Trait Implementations
impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx>[src]
Auto Trait Implementations
impl<'a, 'tcx> !RefUnwindSafe for LinkCollector<'a, 'tcx>
impl<'a, 'tcx> !Send for LinkCollector<'a, 'tcx>
impl<'a, 'tcx> !Sync for LinkCollector<'a, 'tcx>
impl<'a, 'tcx> Unpin for LinkCollector<'a, 'tcx> where
'tcx: 'a,
'tcx: 'a,
impl<'a, 'tcx> !UnwindSafe for LinkCollector<'a, 'tcx>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,