mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 03:38:29 +00:00
Correct path docs and add colon2 token to Path ast node
This commit is contained in:
parent
eedf11ae88
commit
a19b164661
@ -2323,10 +2323,10 @@ impl ArgList {
|
|||||||
/// generic parameters.
|
/// generic parameters.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// (0..10).❰ collect ❰ ::<Vec<_>> ❱ ❱();
|
/// (0..10).❰ ❰ collect ❱ ::<Vec<_>> ❱();
|
||||||
/// ❰ Vec ❰ ::<u8> ❰ ::with_capacity ❱ ❱ ❱(1024);
|
/// ❰ ❰ ❰ Vec ❱ ::<u8> ❱ ::with_capacity ❱(1024);
|
||||||
/// ❰ <Foo as Bar> ❰ ::baz ❱ ❱();
|
/// ❰ ❰ <❰ Foo ❱ as ❰ ❰ bar ❱ ::Bar ❱> ❱ ::baz ❱();
|
||||||
/// ❰ <bruh> ❰ ::bruuh ❱ ❱();
|
/// ❰ ❰ <❰ bruh ❱> ❱ ::bruuh ❱();
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [Reference](https://doc.rust-lang.org/reference/paths.html)
|
/// [Reference](https://doc.rust-lang.org/reference/paths.html)
|
||||||
@ -2336,15 +2336,21 @@ pub struct Path {
|
|||||||
}
|
}
|
||||||
impl Path {
|
impl Path {
|
||||||
pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) }
|
pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) }
|
||||||
|
pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
|
||||||
pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) }
|
pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) }
|
||||||
}
|
}
|
||||||
/// Segment of the path to a symbol.
|
/// Segment of the path to a symbol.
|
||||||
|
/// Only path segment of an absolute path holds the `::` token,
|
||||||
|
/// all other `::` tokens that connect path segments reside under `Path` itself.`
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// (0..10).❰ collect ❱ ❰ ::<Vec<_>> ❱();
|
/// (0..10).❰ collect ❱ :: ❰ <Vec<_>> ❱();
|
||||||
/// ❰ Vec >| ❰ ::<u8> ❱ ❰ ::with_capacity ❱(1024);
|
/// ❰ Vec ❱ :: ❰ <u8> ❱ :: ❰ with_capacity ❱(1024);
|
||||||
/// ❰ <Foo as Bar> ❱ ❰ ::baz ❱();
|
/// ❰ <❰ Foo ❱ as ❰ bar ❱ :: ❰ Bar ❱> ❱ :: ❰ baz ❱();
|
||||||
/// ❰ <bruh> ❱ ❰ ::bruuh ❱();
|
/// ❰ <❰ bruh ❱> ❱ :: ❰ bruuh ❱();
|
||||||
|
///
|
||||||
|
/// // Note that only in this case `::` token is inlcuded:
|
||||||
|
/// ❰ ::foo ❱;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [Reference](https://doc.rust-lang.org/reference/paths.html)
|
/// [Reference](https://doc.rust-lang.org/reference/paths.html)
|
||||||
|
@ -1893,32 +1893,35 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
|
|||||||
T![')']
|
T![')']
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: correct the example
|
|
||||||
/// Path to a symbol. Includes single identifier names and elaborate paths with
|
/// Path to a symbol. Includes single identifier names and elaborate paths with
|
||||||
/// generic parameters.
|
/// generic parameters.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// (0..10).❰ collect ❰ ::<Vec<_>> ❱ ❱();
|
/// (0..10).❰ ❰ collect ❱ ::<Vec<_>> ❱();
|
||||||
/// ❰ Vec ❰ ::<u8> ❰ ::with_capacity ❱ ❱ ❱(1024);
|
/// ❰ ❰ ❰ Vec ❱ ::<u8> ❱ ::with_capacity ❱(1024);
|
||||||
/// ❰ <Foo as Bar> ❰ ::baz ❱ ❱();
|
/// ❰ ❰ <❰ Foo ❱ as ❰ ❰ bar ❱ ::Bar ❱> ❱ ::baz ❱();
|
||||||
/// ❰ <bruh> ❰ ::bruuh ❱ ❱();
|
/// ❰ ❰ <❰ bruh ❱> ❱ ::bruuh ❱();
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [Reference](https://doc.rust-lang.org/reference/paths.html)
|
/// [Reference](https://doc.rust-lang.org/reference/paths.html)
|
||||||
struct Path {
|
struct Path {
|
||||||
segment: PathSegment,
|
segment: PathSegment,
|
||||||
|
T![::],
|
||||||
qualifier: Path,
|
qualifier: Path,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: verify the example
|
|
||||||
// TODO: what RetType is doing here? is this for Fn() -> T syntax?
|
|
||||||
/// Segment of the path to a symbol.
|
/// Segment of the path to a symbol.
|
||||||
|
/// Only path segment of an absolute path holds the `::` token,
|
||||||
|
/// all other `::` tokens that connect path segments reside under `Path` itself.`
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// (0..10).❰ collect ❱ ❰ ::<Vec<_>> ❱();
|
/// (0..10).❰ collect ❱ :: ❰ <Vec<_>> ❱();
|
||||||
/// ❰ Vec >| ❰ ::<u8> ❱ ❰ ::with_capacity ❱(1024);
|
/// ❰ Vec ❱ :: ❰ <u8> ❱ :: ❰ with_capacity ❱(1024);
|
||||||
/// ❰ <Foo as Bar> ❱ ❰ ::baz ❱();
|
/// ❰ <❰ Foo ❱ as ❰ bar ❱ :: ❰ Bar ❱> ❱ :: ❰ baz ❱();
|
||||||
/// ❰ <bruh> ❱ ❰ ::bruuh ❱();
|
/// ❰ <❰ bruh ❱> ❱ :: ❰ bruuh ❱();
|
||||||
|
///
|
||||||
|
/// // Note that only in this case `::` token is inlcuded:
|
||||||
|
/// ❰ ::foo ❱;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [Reference](https://doc.rust-lang.org/reference/paths.html)
|
/// [Reference](https://doc.rust-lang.org/reference/paths.html)
|
||||||
@ -1956,7 +1959,6 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
|
|||||||
/// [Reference](https://doc.rust-lang.org/reference/paths.html#paths-in-expressions)
|
/// [Reference](https://doc.rust-lang.org/reference/paths.html#paths-in-expressions)
|
||||||
struct TypeArg { TypeRef }
|
struct TypeArg { TypeRef }
|
||||||
|
|
||||||
// TODO: verify inline type bounds example
|
|
||||||
/// Associated type argument that is passed at generic instantiation site.
|
/// Associated type argument that is passed at generic instantiation site.
|
||||||
/// ```
|
/// ```
|
||||||
/// use foo::<'a, u64, bool, ❰ Item = Bar ❱, 42>::baz;
|
/// use foo::<'a, u64, bool, ❰ Item = Bar ❱, 42>::baz;
|
||||||
|
Loading…
Reference in New Issue
Block a user