rustloader

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rustloader turns the Rust code of a registered repository into the facts Kivgraph can store.

Rust has no type checker Kivgraph can link into its own process, so the authority for identity and resolution is `rust-analyzer`, invoked as a batch indexer over one Cargo workspace at a time. This package owns that invocation, the index it produces, and the registry that decides which registered repository provides a crate.

Index

Constants

View Source
const LangCrateOrigin = "https://github.com/rust-lang/rust/library/"

LangCrateOrigin is the version field rust-analyzer writes into the moniker of a standard library symbol seen from a crate that uses it.

It is a URL, not a release: `core` referenced from any crate arrives as `rust-analyzer cargo core https://github.com/rust-lang/rust/library/core`, while the same crate indexed as a workspace of its own publishes version `0.0.0`. The two sides therefore never agree on the version field, which is why attribution of a lang crate cannot compare it. They do agree on the crate name and on the descriptor path, and the stable key is built from those.

View Source
const RustLanguage = "rust"

RustLanguage is the language name every Rust stable key carries.

Variables

This section is empty.

Functions

func DiscoverSysroot

func DiscoverSysroot(ctx context.Context, workingDirectory string) (SysrootProvider, SysrootUnavailableReason, error)

DiscoverSysroot answers the standard library of the toolchain on this machine, or why it is not available.

It asks `rustc` rather than reading configuration: the sysroot that resolves a reference is the one the analyzer loaded, and that is decided by the toolchain, not by us. A `rust-toolchain.toml` inside a repository is honoured for free, because rustup answers per working directory.

func IsLangOrigin

func IsLangOrigin(version string) bool

IsLangOrigin reports whether a moniker's version field names the standard library rather than a release.

This is the evidence that attributes a reference to the sysroot. Resolving `core` because a provider happens to be called `core` would be attribution by name, which never produces an exact edge in this project.

func PublishedKind

func PublishedKind(identity SymbolIdentity, scipKind int32) string

PublishedKind answers the kind a reader sees.

It is not the kind the stable key uses: the key takes the descriptor suffix, which travels inside the symbol string and therefore cannot disagree between a consumer and its provider. This one is finer -- a struct, an enum and a type alias all carry the `#` suffix -- and it exists because `type Value` is a useless answer to "what is this".

It used to answer "implementation" for an `impl` block, and that branch could not run. Not publishing an impl block is a tested contract, older than this change: TestAnalyzeDeclaresTheImplementationBlockItCannotDefine asserts that `shapes::impl::Circle` lands in Unresolved with DEFINITION_NOT_INDEXED, and that no in-repository reference names a key the pass does not publish. So a kind for a symbol the loader never creates was unreachable by construction, not merely unobserved -- and nothing covered the branch itself. On kena, with 3063 Rust symbols across two workspaces, `find_symbol` with `kind=implementation` answers zero. LUQUE-2008.

The consequence is declared rather than hidden: a reference whose target is an impl header stays UNRESOLVED, because there is no symbol to point it at. That is 56 of the 1969 unresolved Rust references on kena, the same shape as a reference into the sysroot -- the declaration lives outside what this graph publishes. Members of those blocks are indexed normally, which is why `error::impl::ApiError::with_context_header` is a row and `error::impl::ApiError` is not.

func PublishedName

func PublishedName(identity SymbolIdentity, displayName string) string

PublishedName answers the name a reader sees.

func StableKeyFor

func StableKeyFor(repository string, identity SymbolIdentity) (hotsnapshot.StableKey, string, error)

StableKeyFor derives the durable identity of one Rust symbol.

The identity is the analyzer's own symbol string: crate, descriptor path and the suffix that separates a type from a term of the same name. The signature is deliberately not part of it: rust-analyzer emits no SymbolInformation for a declaration outside the workspace root it was pointed at, so a consumer that keyed on the signature could never name the key its provider publishes.

func SyntheticRepositoryName

func SyntheticRepositoryName(toolchain string) string

SyntheticRepositoryName is the name a sysroot of one toolchain is registered under. The colon is deliberate: a repository name is an identifier compared exactly, never a path component, so no registered repository can collide with this one by being called `rust`.

Types

type Analysis

type Analysis struct {
	Workspace    workspace.CargoWorkspace
	Crates       []workspace.CargoCrate
	Files        []IndexedFile
	Definitions  []Definition
	References   []Reference
	Dependencies []CrateDependency
	// Relations are the structural facts the grammar establishes over ends
	// the analyzer resolved: implementations, supertraits and overrides.
	Relations   []Relation
	Unresolved  []UnresolvedReference
	Diagnostics []string
	// ReferencesWithoutSource counts uses with no enclosing declaration, so
	// a dropped edge is visible instead of silently missing.
	ReferencesWithoutSource int
}

Analysis is everything one workspace contributed.

func Analyze

func Analyze(ctx context.Context, options AnalyzeOptions) (Analysis, error)

Analyze turns one decoded index into the facts of one Cargo workspace.

type AnalyzeOptions

type AnalyzeOptions struct {
	Repository workspace.Repository
	Workspace  workspace.CargoWorkspace
	// Crates are the crates this workspace resolves.
	Crates []workspace.CargoCrate
	Index  scipwire.Index
	// Registry attributes a crate to the repository that provides it. A nil
	// registry resolves nothing, which is what a single repository pass is.
	Registry *CrateRegistry
	Parsers  *syntax.ParserManager
	// ProcMacros and BuildScripts record how the index was produced, because
	// an index built without them is incomplete by configuration.
	ProcMacros   bool
	BuildScripts bool
	Diagnostics  []string
}

AnalyzeOptions is one workspace's index plus what the pass knows about the repositories around it.

type AnalyzerSource

type AnalyzerSource string

AnalyzerSource says where the analyzer this build will run came from.

const (
	// AnalyzerBundled is the binary that travels beside the executable.
	AnalyzerBundled AnalyzerSource = "bundled"
	// AnalyzerPath is a binary found through the PATH.
	AnalyzerPath AnalyzerSource = "path"
	// AnalyzerExplicit is a path the configuration spelled out.
	AnalyzerExplicit AnalyzerSource = "explicit"
)

func ResolveAnalyzer

func ResolveAnalyzer(command string) (string, AnalyzerSource, error)

ResolveAnalyzer answers the analyzer to run and where it came from.

The bundled binary wins over the PATH on purpose: an installation that ships its own engine must use it, or two machines with the same bundle would index the same repository with different analyzers. A configuration that spells a path out is always honoured.

type CrateDependency

type CrateDependency struct {
	SourceCrate CrateRef
	TargetCrate CrateRef
	// TargetRepository is empty when the provider is this repository.
	TargetRepository string
	// CrossWorkspace reports a dependency that leaves this Cargo workspace.
	CrossWorkspace bool

	File        string
	StartLine   int
	StartOffset int
	EndOffset   int
	Text        string
}

CrateDependency is one crate boundary a reference crossed, with the single occurrence that proves it.

type CrateProvider

type CrateProvider struct {
	Repository    string
	Name          string
	Version       string
	RootPath      string
	ManifestPath  string
	WorkspacePath string
	// Lang marks a crate of the standard library, provided by the synthetic
	// sysroot repository. Its version field is not a release: a consumer
	// spells it as an origin URL and the sysroot's own index spells it
	// `0.0.0`, so the two sides never agree on it. They agree on the crate
	// name and the descriptor path, which is all the stable key is built
	// from, so a lang crate resolves without comparing versions.
	Lang bool
}

CrateProvider is one crate offered by a repository.

type CrateRef

type CrateRef struct {
	Name string
	// Version is `.` when the analyzer did not know one, and a URL for the
	// crates that ship with the toolchain.
	Version string
}

CrateRef is the crate a symbol belongs to, as the analyzer named it.

func (CrateRef) Known

func (crate CrateRef) Known() bool

Known reports whether the crate carries a version that identifies code.

type CrateRegistry

type CrateRegistry struct {
	// contains filtered or unexported fields
}

CrateRegistry indexes crate names across every registered repository.

Ambiguity is preserved, never resolved by preference: two repositories declaring the same crate is a fact the caller must see, exactly as it is for a Go module path or a TypeScript package name.

func NewCrateRegistry

func NewCrateRegistry(
	ctx context.Context,
	repositories []workspace.Repository,
	sysroot *SysrootProvider,
) (*CrateRegistry, error)

NewCrateRegistry builds the cross-repository crate index. A non-nil sysroot adds the standard library as a provider of its own crates.

func (*CrateRegistry) CrateNames

func (registry *CrateRegistry) CrateNames() []string

CrateNames answers every indexed crate name, sorted.

func (*CrateRegistry) Providers

func (registry *CrateRegistry) Providers(name string) []CrateProvider

Providers answers the registered providers of one crate name, in a deterministic order.

func (*CrateRegistry) Resolve

func (registry *CrateRegistry) Resolve(name, version string) (CrateProvider, CrateStatus)

Resolve attributes a crate reference to the repository that provides it.

The version is part of the question, not a detail: two repositories may declare the same crate, and a consumer compiled against a version nobody registered was not compiled against the code in the graph.

A crate of the standard library is the one case where the version cannot be compared, because the two sides of the boundary do not write the same thing in that field. What is compared instead is the origin the analyzer named, which is evidence of the same kind: a reference that does not carry it is not a reference to the standard library.

type CrateStatus

type CrateStatus string

CrateStatus reports whether a crate reference could be attributed to a registered provider.

const (
	// CrateResolved means one registered repository provides the crate at
	// the requested version.
	CrateResolved CrateStatus = "RESOLVED"
	// CrateProviderNotFound means no registered repository declares it.
	CrateProviderNotFound CrateStatus = "CRATE_PROVIDER_NOT_FOUND"
	// AmbiguousCrateProvider means several providers declare the crate at
	// the requested version. None of them provides it.
	AmbiguousCrateProvider CrateStatus = "AMBIGUOUS_CRATE_PROVIDER"
	// CrateVersionUnknown means the reference carries no usable version, so
	// no provider can be proven to be the code it was compiled against.
	CrateVersionUnknown CrateStatus = "CRATE_VERSION_UNKNOWN"
	// CrateVersionMismatch means the crate is declared by a registered
	// repository, at another version.
	CrateVersionMismatch CrateStatus = "CRATE_VERSION_MISMATCH"
)

type Declaration

type Declaration struct {
	NodeKind  string
	Name      string
	StartByte int
	EndByte   int
	StartLine int
}

Declaration is one item a Rust file declares, as the grammar sees it.

type Definition

type Definition struct {
	StableKey         hotsnapshot.StableKey
	CanonicalIdentity string
	Symbol            string
	Crate             CrateRef
	// File is the repository relative path of the declaring file.
	File          string
	Name          string
	QualifiedName string
	Kind          string
	Exported      bool
	Signature     string
	// Owner is the type an `impl` block declares this member on, empty for
	// anything declared outside one. It is the type parameter of the `impl`
	// descriptor, so it names the type rather than the block: the block
	// itself is not published, and the type is what a caller asks about.
	Owner string

	StartLine   int
	StartColumn int
	StartOffset int
	EndLine     int
	EndOffset   int
}

Definition is one indexed Rust declaration with durable identity.

type Descriptor

type Descriptor struct {
	Name          string
	Suffix        DescriptorSuffix
	Disambiguator string
}

Descriptor is one step of a SCIP symbol path.

type DescriptorSuffix

type DescriptorSuffix string

DescriptorSuffix is the grammar element that says what a descriptor names. The suffix is part of the symbol string itself, so consumer and provider always agree on it even when they classify the symbol differently.

const (
	SuffixNamespace     DescriptorSuffix = "namespace"
	SuffixType          DescriptorSuffix = "type"
	SuffixTerm          DescriptorSuffix = "term"
	SuffixMethod        DescriptorSuffix = "method"
	SuffixTypeParameter DescriptorSuffix = "type_parameter"
	SuffixParameter     DescriptorSuffix = "parameter"
	SuffixMeta          DescriptorSuffix = "meta"
	SuffixMacro         DescriptorSuffix = "macro"
)

type ImplementationHeader

type ImplementationHeader struct {
	// TraitStart and TraitEnd are empty for an inherent implementation.
	TraitStart int
	TraitEnd   int
	TypeStart  int
	TypeEnd    int
	BodyStart  int
	BodyEnd    int
}

ImplementationHeader is the `impl ... for ...` line of one implementation block: the spans where the trait and the self type are written.

type IndexedFile

type IndexedFile struct {
	Path  string
	Crate CrateRef
}

IndexedFile is one repository file the analyzer indexed.

type Reference

type Reference struct {
	SourceKey string
	TargetKey string
	// TargetRepository is empty for a target of this repository.
	TargetRepository string
	// TargetQualifiedName describes a target of another repository, whose key
	// this pass composed without reading its declaration.
	TargetQualifiedName string
	Kind                ReferenceKind
	Use                 UseKind
	SourceCrate         CrateRef
	TargetCrate         CrateRef

	File        string
	StartLine   int
	StartColumn int
	StartOffset int
	EndOffset   int
	Text        string
}

Reference is one classified use with both ends identified.

type ReferenceKind

type ReferenceKind string

ReferenceKind is the syntactic role of one occurrence.

The analyzer says which symbol an occurrence resolves to, and never how it is used: `symbol_roles` distinguishes a definition and nothing else, and `syntax_kind` is left unset. The shape of the code decides the relation, exactly as the Go AST decides GO_AST_CALL over a go/types resolution.

const (
	ReferenceUse  ReferenceKind = "use"
	ReferenceCall ReferenceKind = "call"
	ReferenceType ReferenceKind = "type"
	// ReferenceCallback is a function named as the argument of a call.
	ReferenceCallback ReferenceKind = "callback"
	// ReferenceAssign is a function bound to a name instead of called.
	ReferenceAssign ReferenceKind = "assign"
	// ReferenceReturn is a function that leaves a body as its result.
	ReferenceReturn ReferenceKind = "return"
)

type Relation

type Relation struct {
	Kind      RelationKind
	SourceKey string
	TargetKey string
	// TargetRepository is empty for a target of this repository.
	TargetRepository string
	// TargetCrate and TargetQualifiedName describe a target of another
	// repository, whose key this pass composed without reading its
	// declaration.
	TargetCrate         CrateRef
	TargetQualifiedName string

	File        string
	StartLine   int
	StartColumn int
	StartOffset int
	EndOffset   int
	Text        string
}

Relation is one structural relation with the occurrence that proves it.

type RelationKind

type RelationKind string

RelationKind is a structural relation between two declarations.

The analyzer states none of these: `SymbolInformation.relationships` travels empty. What it does state is which symbol every token of an `impl` header or a trait bound resolves to, and the grammar says which token is the trait and which is the type. Both ends are the analyzer's; only the shape is the grammar's, exactly as a call is.

const (
	// RelationImplements is `impl Trait for Type`, and the pairing of each
	// member of that block with the trait declaration it answers for. Both
	// granularities are the same relation -- this is the implementation of
	// that -- and the member one is what makes a call through `dyn Trait`
	// answerable, because the analyzer resolves such a call to the trait
	// method and nothing else would say which body it arrives at.
	//
	// The member pairing used to be reported as OVERRIDES, which named a
	// different relation from the one Go reports under that kind: there, a
	// method that HIDES a promoted one, which a call never reaches. One
	// canonical kind cannot mean both. A trait method carrying a default body
	// is genuinely overridden by an impl that replaces it, and SCIP does not
	// say whether a default exists, so that case is reported as IMPLEMENTS
	// too: it is true of both, and it is the statement a caller needs.
	RelationImplements RelationKind = "implements"
	// RelationExtends is the supertrait of `trait A: B`.
	RelationExtends RelationKind = "extends"
)

type RunError

type RunError struct {
	Kind      RunErrorKind
	Workspace string
	Detail    string
	Err       error
}

RunError is a classified failure of one analyzer invocation.

func (*RunError) Error

func (err *RunError) Error() string

func (*RunError) Unwrap

func (err *RunError) Unwrap() error

type RunErrorKind

type RunErrorKind string

RunErrorKind classifies a failure of the external indexer. Every kind maps to one unresolved reason, so a repository that produced no facts always says why.

const (
	// RunErrorAnalyzerUnavailable means the configured command is not on the
	// PATH.
	RunErrorAnalyzerUnavailable RunErrorKind = "ANALYZER_UNAVAILABLE"
	// RunErrorWorkspaceNotLoaded means the analyzer refused the workspace.
	RunErrorWorkspaceNotLoaded RunErrorKind = "WORKSPACE_NOT_LOADED"
	// RunErrorIndexUnreadable means the index could not be read or decoded.
	RunErrorIndexUnreadable RunErrorKind = "INDEX_UNREADABLE"
	// RunErrorAnalyzerUnsupported means the analyzer produced an index this
	// build cannot turn into facts.
	RunErrorAnalyzerUnsupported RunErrorKind = "ANALYZER_UNSUPPORTED"
	// RunErrorRepositoryWritten means the run modified the sources it was
	// asked to read.
	RunErrorRepositoryWritten RunErrorKind = "REPOSITORY_WRITTEN"
	// RunErrorCanceled means the caller cancelled the run.
	RunErrorCanceled RunErrorKind = "CANCELED"
	// RunErrorInvalidOptions means the caller asked for something this
	// package refuses to do.
	RunErrorInvalidOptions RunErrorKind = "INVALID_OPTIONS"
)

type RunOptions

type RunOptions struct {
	// Workspace is the absolute path of the Cargo workspace root.
	Workspace string
	// OutputDirectory holds the generated configuration and the index. It
	// must live outside every indexed repository.
	OutputDirectory string
	// AnalyzerCommand is the command line of the analyzer, arguments
	// included.
	AnalyzerCommand string
	// TargetDirectory is where cargo writes the artifacts of this analysis.
	// rust-analyzer always runs build scripts, so a run without a target
	// directory outside the repository would write inside it.
	TargetDirectory string

	Features          []string
	AllFeatures       bool
	NoDefaultFeatures bool
	Cfgs              []string
	BuildScripts      bool
	ProcMacros        bool
	// IncludeTests sets `cfg(test)` for the crates of the workspace.
	IncludeTests bool
	AllowNetwork bool
	Sysroot      string
	// Threads bounds the analyzer's own cache priming. Zero lets it decide.
	Threads int
}

RunOptions configures one invocation over one Cargo workspace.

type RunResult

type RunResult struct {
	Index scipwire.Index
	// ToolVersion is the analyzer that produced the index, as it named
	// itself. It belongs to the identity of any cached facts.
	ToolVersion string
	// Diagnostics are the analyzer's own warnings and errors, kept because a
	// degraded load is the usual reason a crate is missing from the graph.
	Diagnostics []string
	Duration    time.Duration
}

RunResult is one decoded index and what the run reported about itself.

func Run

func Run(ctx context.Context, options RunOptions) (RunResult, error)

Run indexes one Cargo workspace and answers the decoded index.

The analyzer runs build scripts whether or not the caller wants them -- the scip command hardcodes it -- so hermeticity is imposed from the outside: the target directory is redirected out of the repository, cargo runs offline and locked unless the caller allows the network, and the run refuses to succeed if the workspace was written to anyway.

type Source

type Source struct {
	// Path is the repository relative path of the file.
	Path string
	// contains filtered or unexported fields
}

Source is one parsed Rust file: its bytes, its line offsets and its tree.

func NewSource

func NewSource(ctx context.Context, manager *syntax.ParserManager, path string, code []byte) (*Source, error)

NewSource parses one file. The caller owns the source and must Close it.

func (*Source) Close

func (source *Source) Close()

Close releases the parsed tree.

func (*Source) Declarations

func (source *Source) Declarations() []Declaration

Declarations lists the items the grammar sees, which is what an index is compared against when a declaration produced no symbol.

func (*Source) Exported

func (source *Source) Exported(start, end int) bool

Exported reports whether the declaration that owns a span is public.

SCIP carries no visibility, so `pub` is read from the grammar. Two Rust rules make that more than a check for the keyword: an item of a trait is as visible as the trait, and a method of a trait implementation is reachable through the trait wherever the trait is. Neither ever writes `pub`.

func (*Source) Implementations

func (source *Source) Implementations() []ImplementationHeader

Implementations lists the implementation blocks of the file.

func (*Source) Offset

func (source *Source) Offset(line, column int) (int, bool)

Offset converts a zero based line and byte column into a byte offset.

SCIP positions are line and column pairs; every durable key of an observation is built from byte offsets, so the two views must agree exactly.

func (*Source) Reference

func (source *Source) Reference(start, end int) ReferenceKind

Reference classifies one occurrence by the shape of the code around it.

func (*Source) Text

func (source *Source) Text(start, end int) string

Text answers the source excerpt of a byte span.

func (*Source) TraitBounds

func (source *Source) TraitBounds() []TraitBound

TraitBounds lists the supertraits every trait of the file declares.

func (*Source) Use

func (source *Source) Use(start, end int) UseKind

Use answers how a `use` declaration containing the span brings its name into scope.

type SymbolIdentity

type SymbolIdentity struct {
	// Raw is the string the analyzer emitted. It is what a consumer and a
	// provider compare when they are indexed separately.
	Raw string
	// Local marks a symbol scoped to one document. A local has no durable
	// identity and never becomes a node of the graph.
	Local       bool
	Scheme      string
	Manager     string
	Crate       CrateRef
	Descriptors []Descriptor
}

SymbolIdentity is a parsed SCIP symbol string.

func ParseSymbol

func ParseSymbol(raw string) (SymbolIdentity, error)

ParseSymbol reads a SCIP symbol string.

The grammar is the one in the pinned schema: scheme, package manager, package name and version separated by spaces, then a descriptor path whose suffix characters say what each step names. A document-local symbol is spelled `local <n>` and is reported as such rather than rejected: the analyzer emits one for every binding inside a function body.

func (SymbolIdentity) Addressable

func (identity SymbolIdentity) Addressable() bool

Addressable reports whether the symbol can be a node of the graph: it needs a crate, a descriptor path and no document-local identity.

func (SymbolIdentity) Kind

func (identity SymbolIdentity) Kind() DescriptorSuffix

Kind is the suffix of the last descriptor: the part of the identity that distinguishes a type from a term of the same name.

func (SymbolIdentity) Name

func (identity SymbolIdentity) Name() string

Name is the last descriptor name, which is what the declaration is called.

func (SymbolIdentity) QualifiedName

func (identity SymbolIdentity) QualifiedName() string

QualifiedName renders the descriptor path the way Rust spells a path.

type SysrootProvider

type SysrootProvider struct {
	Repository workspace.Repository
	// Toolchain is the release `rustc` reported, such as `1.96.1`.
	Toolchain string
	// LibraryPath is the Cargo workspace of the standard library.
	LibraryPath string
}

SysrootProvider is the standard library shaped like a repository, which is what the rest of the pass already knows how to index.

The repository is synthetic: it has a name and a path but no commit, no branch and no registry entry. Its name carries the toolchain version because the stable key of every symbol it publishes carries the repository, and two toolchains do not declare the same code.

type SysrootUnavailableReason

type SysrootUnavailableReason string

SysrootUnavailableReason says why the standard library is not in the graph when the configuration asked for it.

None of these is a failure of the pass: the sysroot is opt-in and its absence leaves the graph exactly as it is without it, saying so.

const (
	// SysrootNotRequested means the configuration did not ask for it.
	SysrootNotRequested SysrootUnavailableReason = "SYSROOT_NOT_REQUESTED"
	// SysrootToolchainNotFound means no `rustc` answered, so nothing names
	// which standard library this corpus compiles against.
	SysrootToolchainNotFound SysrootUnavailableReason = "SYSROOT_TOOLCHAIN_NOT_FOUND"
	// SysrootSourceMissing means the toolchain carries no library source.
	// `rustup component add rust-src` installs it; without the sources there
	// is nothing to index, only artifacts.
	SysrootSourceMissing SysrootUnavailableReason = "SYSROOT_SOURCE_MISSING"
)

type TraitBound

type TraitBound struct {
	NameStart int
	NameEnd   int
	// TraitStart and TraitEnd are the name span of the declaring trait.
	TraitStart int
	TraitEnd   int
}

TraitBound is one supertrait span of a trait declaration.

type UnresolvedReason

type UnresolvedReason string

UnresolvedReason classifies a Rust fact that did not become an exact edge.

const (
	// UnresolvedCrateProviderNotFound means no registered repository
	// declares the crate that owns the target.
	UnresolvedCrateProviderNotFound UnresolvedReason = "CRATE_PROVIDER_NOT_FOUND"
	// UnresolvedAmbiguousCrateProvider means several repositories declare it.
	UnresolvedAmbiguousCrateProvider UnresolvedReason = "AMBIGUOUS_CRATE_PROVIDER"
	// UnresolvedCrateVersionUnknown means the analyzer named no version for
	// the crate, so no provider can be proven to be its code.
	UnresolvedCrateVersionUnknown UnresolvedReason = "CRATE_VERSION_UNKNOWN"
	// UnresolvedCrateVersionMismatch means the crate is registered at
	// another version than the one this code was compiled against.
	UnresolvedCrateVersionMismatch UnresolvedReason = "CRATE_VERSION_MISMATCH"
	// UnresolvedCrateSymbolNotMatched means the provider is registered but
	// the target's identity could not be rebuilt from it.
	UnresolvedCrateSymbolNotMatched UnresolvedReason = "CRATE_SYMBOL_NOT_MATCHED"
	// UnresolvedDefinitionNotIndexed means the grammar sees a declaration
	// the analyzer did not index.
	UnresolvedDefinitionNotIndexed UnresolvedReason = "DEFINITION_NOT_INDEXED"
	// UnresolvedTargetNotBuildable means a crate of the workspace produced
	// no indexed file at all under this build configuration.
	UnresolvedTargetNotBuildable UnresolvedReason = "TARGET_NOT_BUILDABLE"
	// UnresolvedMacroExpansionDisabled declares an index built without
	// expanding macros, so generated items are absent by configuration.
	UnresolvedMacroExpansionDisabled UnresolvedReason = "MACRO_EXPANSION_DISABLED"
	// UnresolvedWorkspaceNotLoaded means the analyzer could not read the
	// workspace.
	UnresolvedWorkspaceNotLoaded UnresolvedReason = "WORKSPACE_NOT_LOADED"
	// UnresolvedAnalyzerUnavailable means the external analyzer is missing.
	UnresolvedAnalyzerUnavailable UnresolvedReason = "ANALYZER_UNAVAILABLE"
)

type UnresolvedReference

type UnresolvedReference struct {
	Crate           CrateRef
	File            string
	SourceKey       string
	RequestedCrate  string
	RequestedSymbol string
	Reason          UnresolvedReason
	Detail          string
	StartLine       int
	StartColumn     int
	StartOffset     int
}

UnresolvedReference is one classified failure with the evidence it has.

type UseKind

type UseKind string

UseKind says how a `use` brings a name into scope, which is the difference between an import and a re-export.

const (
	// UseNone means the occurrence is not inside a use declaration.
	UseNone UseKind = ""
	// UseImport is a private `use`: the name is visible in this module only.
	UseImport UseKind = "import"
	// UseReexport is a `pub use`: the module offers the name to others.
	UseReexport UseKind = "reexport"
)

Directories

Path Synopsis
Package scipwire decodes the subset of the SCIP index format Kivgraph reads from `rust-analyzer scip`.
Package scipwire decodes the subset of the SCIP index format Kivgraph reads from `rust-analyzer scip`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL