Struct rustdoc::passes::collect_intra_doc_links::LinkCollector[][src]

struct LinkCollector<'a, 'tcx> {
    cx: &'a mut DocContext<'tcx>,
    mod_ids: Vec<DefId>,
    kind_side_channel: Cell<Option<(DefKind, DefId)>>,
    visited_links: FxHashMap<ResolutionInfo, Option<CachedLink>>,
}

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

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.

Given a primitive type, try to resolve an associated item.

Resolves a string as a macro.

FIXME(jynelson): Can this be unified with resolve()?

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.

Resolves a string as a path within a particular namespace. Returns an optional URL fragment in the case of variants and methods.

Convert a DefId to a Res, where possible.

This is used for resolving type aliases.

Returns:

  • None if no associated item was found
  • Some((_, , Some())) if an item was found and should go through a side channel
  • Some((_, _, None)) otherwise

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).

This is the entry point for resolving an intra-doc link.

FIXME(jynelson): this is way too many arguments

After parsing the disambiguator, resolve the main part of the link.

Trait Implementations

don’t override!

don’t override!

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

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: 80 bytes