X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Frustc_ast%2Fsrc%2Fast.rs;h=2c047fbc53945ab04f2166e571283f71788c1b49;hb=7b987e34c083c81a9e70cb1d387759ac98c752c0;hp=e8cc9d9d291d2546eab0611e711dbc2fb4df75dc;hpb=16892cfe9538941ee941d2908125465c596cfb8f;p=rust.git diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index e8cc9d9d291..2c047fbc539 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -929,16 +929,6 @@ pub struct Stmt { } 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, @@ -1986,6 +1976,8 @@ pub struct BareFnTy { pub ext: Extern, pub generic_params: Vec, pub decl: P, + /// Span of the `fn(...) -> ...` part. + pub decl_span: Span, } /// The various kinds of type recognized by the compiler. @@ -2574,15 +2566,6 @@ pub fn new(generic_params: Vec, path: Path, span: Span) -> Self { } } -#[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, @@ -2593,7 +2576,6 @@ pub struct Visibility { #[derive(Clone, Encodable, Decodable, Debug)] pub enum VisibilityKind { Public, - Crate(CrateSugar), Restricted { path: P, id: NodeId }, Inherited, } @@ -2684,13 +2666,6 @@ pub fn span_with_attributes(&self) -> Span { } } -impl> Item { - 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 {