Path in rustc_ast::ast - Rust (original) (raw)
pub struct Path {
pub span: Span,
pub segments: ThinVec<PathSegment>,
pub tokens: Option<LazyAttrTokenStream>,
}
Expand description
A “Path” is essentially Rust’s notion of a name.
It’s represented as a sequence of identifiers, along with a bunch of supporting information.
E.g., std::cmp::PartialEq
.
The segments in the path: the things separated by ::
. Global paths begin with kw::PathRoot
.
Convert a span and an identifier to the corresponding one-segment path.
Check if this path is potentially a trivial const arg, i.e., one that can _potentially_be represented without an anon const in the HIR.
If allow_mgca_arg
is true (as should be the case in most situations when#![feature(min_generic_const_args)]
is enabled), then this always returns true because all paths are valid.
Otherwise, it returns true iff the path has exactly one segment, and it has no generic args (i.e., it is potentially a const parameter).
This is true
if this HasAttrs
might support ‘custom’ (proc-macro) inner attributes. Attributes like #![cfg]
and #![cfg_attr]
are not considered ‘custom’ attributes. Read more
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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: 24 bytes