}
impl Stmt {
- pub fn tokens(&self) -> Option<&LazyTokenStream> {
- match self.kind {
- StmtKind::Local(ref local) => local.tokens.as_ref(),
- StmtKind::Item(ref item) => item.tokens.as_ref(),
- StmtKind::Expr(ref expr) | StmtKind::Semi(ref expr) => expr.tokens.as_ref(),
- StmtKind::Empty => None,
- StmtKind::MacCall(ref mac) => mac.tokens.as_ref(),
- }
- }
-
pub fn has_trailing_semicolon(&self) -> bool {
match &self.kind {
StmtKind::Semi(_) => true,
pub ext: Extern,
pub generic_params: Vec<GenericParam>,
pub decl: P<FnDecl>,
+ /// Span of the `fn(...) -> ...` part.
+ pub decl_span: Span,
}
/// The various kinds of type recognized by the compiler.
}
}
-#[derive(Copy, Clone, Encodable, Decodable, Debug, HashStable_Generic)]
-pub enum CrateSugar {
- /// Source is `pub(crate)`.
- PubCrate,
-
- /// Source is (just) `crate`.
- JustCrate,
-}
-
#[derive(Clone, Encodable, Decodable, Debug)]
pub struct Visibility {
pub kind: VisibilityKind,
#[derive(Clone, Encodable, Decodable, Debug)]
pub enum VisibilityKind {
Public,
- Crate(CrateSugar),
Restricted { path: P<Path>, id: NodeId },
Inherited,
}
}
}
-impl<K: Into<ItemKind>> Item<K> {
- pub fn into_item(self) -> Item {
- let Item { attrs, id, span, vis, ident, kind, tokens } = self;
- Item { attrs, id, span, vis, ident, kind: kind.into(), tokens }
- }
-}
-
/// `extern` qualifier on a function item or function type.
#[derive(Clone, Copy, Encodable, Decodable, Debug)]
pub enum Extern {