Skip to content

Commit d4cf00f

Browse files
Rollup merge of rust-lang#106383 - Manishearth:ast-docs, r=compiler-errors
Document some of the AST nodes Someone was confused about some of this on Zulip, added some docs We probably should make sure every last field/variant in the AST/HIR is documented at some point `@bors` rollup
2 parents d112cd9 + 157211f commit d4cf00f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

compiler/rustc_ast/src/ast.rs

+15
Original file line numberDiff line numberDiff line change
@@ -2743,8 +2743,19 @@ impl Item {
27432743
/// `extern` qualifier on a function item or function type.
27442744
#[derive(Clone, Copy, Encodable, Decodable, Debug)]
27452745
pub enum Extern {
2746+
/// No explicit extern keyword was used
2747+
///
2748+
/// E.g. `fn foo() {}`
27462749
None,
2750+
/// An explicit extern keyword was used, but with implicit ABI
2751+
///
2752+
/// E.g. `extern fn foo() {}`
2753+
///
2754+
/// This is just `extern "C"` (see `rustc_target::spec::abi::Abi::FALLBACK`)
27472755
Implicit(Span),
2756+
/// An explicit extern keyword was used with an explicit ABI
2757+
///
2758+
/// E.g. `extern "C" fn foo() {}`
27482759
Explicit(StrLit, Span),
27492760
}
27502761

@@ -2763,9 +2774,13 @@ impl Extern {
27632774
/// included in this struct (e.g., `async unsafe fn` or `const extern "C" fn`).
27642775
#[derive(Clone, Copy, Encodable, Decodable, Debug)]
27652776
pub struct FnHeader {
2777+
/// The `unsafe` keyword, if any
27662778
pub unsafety: Unsafe,
2779+
/// The `async` keyword, if any
27672780
pub asyncness: Async,
2781+
/// The `const` keyword, if any
27682782
pub constness: Const,
2783+
/// The `extern` keyword and corresponding ABI string, if any
27692784
pub ext: Extern,
27702785
}
27712786

0 commit comments

Comments
 (0)