(index<- ) ./libsyntax/ast.rs
git branch: * master 5200215 auto merge of #14035 : alexcrichton/rust/experimental, r=huonw
modified: Fri May 9 13:02:28 2014
1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // The Rust abstract syntax tree.
12
13 use codemap::{Span, Spanned, DUMMY_SP};
14 use abi::Abi;
15 use ast_util;
16 use owned_slice::OwnedSlice;
17 use parse::token::{InternedString, special_idents, str_to_ident};
18 use parse::token;
19
20 use std::fmt;
21 use std::fmt::Show;
22 use std::option::Option;
23 use std::rc::Rc;
24 use serialize::{Encodable, Decodable, Encoder, Decoder};
25
26 /// A pointer abstraction. FIXME(eddyb) #10676 use Rc<T> in the future.
27 pub type P<T> = @T;
28
29 /// Construct a P<T> from a T value.
30 pub fn P<T: 'static>(value: T) -> P<T> {
31 @value
32 }
33
34 // FIXME #6993: in librustc, uses of "ident" should be replaced
35 // by just "Name".
36
37 // an identifier contains a Name (index into the interner
38 // table) and a SyntaxContext to track renaming and
39 // macro expansion per Flatt et al., "Macros
40 // That Work Together"
41 #[deriving(Clone, Hash, Ord, TotalEq, TotalOrd, Show)]
42 pub struct Ident {
43 pub name: Name,
44 pub ctxt: SyntaxContext
45 }
46
47 impl Ident {
48 /// Construct an identifier with the given name and an empty context:
49 pub fn new(name: Name) -> Ident { Ident {name: name, ctxt: EMPTY_CTXT}}
50 }
51
52 impl Eq for Ident {
53 fn eq(&self, other: &Ident) -> bool {
54 if self.ctxt == other.ctxt {
55 self.name == other.name
56 } else {
57 // IF YOU SEE ONE OF THESE FAILS: it means that you're comparing
58 // idents that have different contexts. You can't fix this without
59 // knowing whether the comparison should be hygienic or non-hygienic.
60 // if it should be non-hygienic (most things are), just compare the
61 // 'name' fields of the idents. Or, even better, replace the idents
62 // with Name's.
63 //
64 // On the other hand, if the comparison does need to be hygienic,
65 // one example and its non-hygienic counterpart would be:
66 // syntax::parse::token::mtwt_token_eq
67 // syntax::ext::tt::macro_parser::token_name_eq
68 fail!("not allowed to compare these idents: {:?}, {:?}. \
69 Probably related to issue \\#6993", self, other);
70 }
71 }
72 fn ne(&self, other: &Ident) -> bool {
73 ! self.eq(other)
74 }
75 }
76
77 /// A SyntaxContext represents a chain of macro-expandings
78 /// and renamings. Each macro expansion corresponds to
79 /// a fresh uint
80
81 // I'm representing this syntax context as an index into
82 // a table, in order to work around a compiler bug
83 // that's causing unreleased memory to cause core dumps
84 // and also perhaps to save some work in destructor checks.
85 // the special uint '0' will be used to indicate an empty
86 // syntax context.
87
88 // this uint is a reference to a table stored in thread-local
89 // storage.
90 pub type SyntaxContext = u32;
91 pub static EMPTY_CTXT : SyntaxContext = 0;
92 pub static ILLEGAL_CTXT : SyntaxContext = 1;
93
94 /// A name is a part of an identifier, representing a string or gensym. It's
95 /// the result of interning.
96 pub type Name = u32;
97
98 /// A mark represents a unique id associated with a macro expansion
99 pub type Mrk = u32;
100
101 impl<S: Encoder<E>, E> Encodable<S, E> for Ident {
102 fn encode(&self, s: &mut S) -> Result<(), E> {
103 s.emit_str(token::get_ident(*self).get())
104 }
105 }
106
107 impl<D:Decoder<E>, E> Decodable<D, E> for Ident {
108 fn decode(d: &mut D) -> Result<Ident, E> {
109 Ok(str_to_ident(try!(d.read_str())))
110 }
111 }
112
113 /// Function name (not all functions have names)
114 pub type FnIdent = Option<Ident>;
115
116 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
117 pub struct Lifetime {
118 pub id: NodeId,
119 pub span: Span,
120 pub name: Name
121 }
122
123 // a "Path" is essentially Rust's notion of a name;
124 // for instance: std::cmp::Eq . It's represented
125 // as a sequence of identifiers, along with a bunch
126 // of supporting information.
127 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
128 pub struct Path {
129 pub span: Span,
130 /// A `::foo` path, is relative to the crate root rather than current
131 /// module (like paths in an import).
132 pub global: bool,
133 /// The segments in the path: the things separated by `::`.
134 pub segments: Vec<PathSegment> ,
135 }
136
137 /// A segment of a path: an identifier, an optional lifetime, and a set of
138 /// types.
139 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
140 pub struct PathSegment {
141 /// The identifier portion of this path segment.
142 pub identifier: Ident,
143 /// The lifetime parameters for this path segment.
144 pub lifetimes: Vec<Lifetime>,
145 /// The type parameters for this path segment, if present.
146 pub types: OwnedSlice<P<Ty>>,
147 }
148
149 pub type CrateNum = u32;
150
151 pub type NodeId = u32;
152
153 #[deriving(Clone, TotalEq, TotalOrd, Ord, Eq, Encodable, Decodable, Hash, Show)]
154 pub struct DefId {
155 pub krate: CrateNum,
156 pub node: NodeId,
157 }
158
159 /// Item definitions in the currently-compiled crate would have the CrateNum
160 /// LOCAL_CRATE in their DefId.
161 pub static LOCAL_CRATE: CrateNum = 0;
162 pub static CRATE_NODE_ID: NodeId = 0;
163
164 // When parsing and doing expansions, we initially give all AST nodes this AST
165 // node value. Then later, in the renumber pass, we renumber them to have
166 // small, positive ids.
167 pub static DUMMY_NODE_ID: NodeId = -1;
168
169 // The AST represents all type param bounds as types.
170 // typeck::collect::compute_bounds matches these against
171 // the "special" built-in traits (see middle::lang_items) and
172 // detects Copy, Send and Share.
173 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
174 pub enum TyParamBound {
175 TraitTyParamBound(TraitRef),
176 StaticRegionTyParamBound,
177 OtherRegionTyParamBound(Span) // FIXME -- just here until work for #5723 lands
178 }
179
180 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
181 pub struct TyParam {
182 pub ident: Ident,
183 pub id: NodeId,
184 pub sized: Sized,
185 pub bounds: OwnedSlice<TyParamBound>,
186 pub default: Option<P<Ty>>,
187 pub span: Span
188 }
189
190 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
191 pub struct Generics {
192 pub lifetimes: Vec<Lifetime>,
193 pub ty_params: OwnedSlice<TyParam>,
194 }
195
196 impl Generics {
197 pub fn is_parameterized(&self) -> bool {
198 self.lifetimes.len() + self.ty_params.len() > 0
199 }
200 pub fn is_lt_parameterized(&self) -> bool {
201 self.lifetimes.len() > 0
202 }
203 pub fn is_type_parameterized(&self) -> bool {
204 self.ty_params.len() > 0
205 }
206 }
207
208 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
209 pub enum MethodProvenance {
210 FromTrait(DefId),
211 FromImpl(DefId),
212 }
213
214 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
215 pub enum Def {
216 DefFn(DefId, FnStyle),
217 DefStaticMethod(/* method */ DefId, MethodProvenance, FnStyle),
218 DefSelfTy(/* trait id */ NodeId),
219 DefMod(DefId),
220 DefForeignMod(DefId),
221 DefStatic(DefId, bool /* is_mutbl */),
222 DefArg(NodeId, BindingMode),
223 DefLocal(NodeId, BindingMode),
224 DefVariant(DefId /* enum */, DefId /* variant */, bool /* is_structure */),
225 DefTy(DefId),
226 DefTrait(DefId),
227 DefPrimTy(PrimTy),
228 DefTyParam(DefId, uint),
229 DefBinding(NodeId, BindingMode),
230 DefUse(DefId),
231 DefUpvar(NodeId, // id of closed over var
232 @Def, // closed over def
233 NodeId, // expr node that creates the closure
234 NodeId), // id for the block/body of the closure expr
235
236 /// Note that if it's a tuple struct's definition, the node id of the DefId
237 /// may either refer to the item definition's id or the StructDef.ctor_id.
238 ///
239 /// The cases that I have encountered so far are (this is not exhaustive):
240 /// - If it's a ty_path referring to some tuple struct, then DefMap maps
241 /// it to a def whose id is the item definition's id.
242 /// - If it's an ExprPath referring to some tuple struct, then DefMap maps
243 /// it to a def whose id is the StructDef.ctor_id.
244 DefStruct(DefId),
245 DefTyParamBinder(NodeId), /* struct, impl or trait with ty params */
246 DefRegion(NodeId),
247 DefLabel(NodeId),
248 DefMethod(DefId /* method */, Option<DefId> /* trait */),
249 }
250
251 #[deriving(Clone, Eq, TotalEq, Hash, Encodable, Decodable, Show)]
252 pub enum DefRegion {
253 DefStaticRegion,
254 DefEarlyBoundRegion(/* index */ uint, /* lifetime decl */ NodeId),
255 DefLateBoundRegion(/* binder_id */ NodeId, /* depth */ uint, /* lifetime decl */ NodeId),
256 DefFreeRegion(/* block scope */ NodeId, /* lifetime decl */ NodeId),
257 }
258
259 // The set of MetaItems that define the compilation environment of the crate,
260 // used to drive conditional compilation
261 pub type CrateConfig = Vec<@MetaItem> ;
262
263 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
264 pub struct Crate {
265 pub module: Mod,
266 pub attrs: Vec<Attribute>,
267 pub config: CrateConfig,
268 pub span: Span,
269 }
270
271 pub type MetaItem = Spanned<MetaItem_>;
272
273 #[deriving(Clone, Encodable, Decodable, TotalEq, Hash)]
274 pub enum MetaItem_ {
275 MetaWord(InternedString),
276 MetaList(InternedString, Vec<@MetaItem> ),
277 MetaNameValue(InternedString, Lit),
278 }
279
280 // can't be derived because the MetaList requires an unordered comparison
281 impl Eq for MetaItem_ {
282 fn eq(&self, other: &MetaItem_) -> bool {
283 match *self {
284 MetaWord(ref ns) => match *other {
285 MetaWord(ref no) => (*ns) == (*no),
286 _ => false
287 },
288 MetaNameValue(ref ns, ref vs) => match *other {
289 MetaNameValue(ref no, ref vo) => {
290 (*ns) == (*no) && vs.node == vo.node
291 }
292 _ => false
293 },
294 MetaList(ref ns, ref miss) => match *other {
295 MetaList(ref no, ref miso) => {
296 ns == no &&
297 miss.iter().all(|mi| miso.iter().any(|x| x.node == mi.node))
298 }
299 _ => false
300 }
301 }
302 }
303 }
304
305 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
306 pub struct Block {
307 pub view_items: Vec<ViewItem>,
308 pub stmts: Vec<@Stmt>,
309 pub expr: Option<@Expr>,
310 pub id: NodeId,
311 pub rules: BlockCheckMode,
312 pub span: Span,
313 }
314
315 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
316 pub struct Pat {
317 pub id: NodeId,
318 pub node: Pat_,
319 pub span: Span,
320 }
321
322 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
323 pub struct FieldPat {
324 pub ident: Ident,
325 pub pat: @Pat,
326 }
327
328 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
329 pub enum BindingMode {
330 BindByRef(Mutability),
331 BindByValue(Mutability),
332 }
333
334 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
335 pub enum Pat_ {
336 PatWild,
337 PatWildMulti,
338 // A PatIdent may either be a new bound variable,
339 // or a nullary enum (in which case the second field
340 // is None).
341 // In the nullary enum case, the parser can't determine
342 // which it is. The resolver determines this, and
343 // records this pattern's NodeId in an auxiliary
344 // set (of "pat_idents that refer to nullary enums")
345 PatIdent(BindingMode, Path, Option<@Pat>),
346 PatEnum(Path, Option<Vec<@Pat> >), /* "none" means a * pattern where
347 * we don't bind the fields to names */
348 PatStruct(Path, Vec<FieldPat> , bool),
349 PatTup(Vec<@Pat> ),
350 PatUniq(@Pat),
351 PatRegion(@Pat), // reference pattern
352 PatLit(@Expr),
353 PatRange(@Expr, @Expr),
354 // [a, b, ..i, y, z] is represented as
355 // PatVec(~[a, b], Some(i), ~[y, z])
356 PatVec(Vec<@Pat> , Option<@Pat>, Vec<@Pat> )
357 }
358
359 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash, Show)]
360 pub enum Mutability {
361 MutMutable,
362 MutImmutable,
363 }
364
365 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
366 pub enum ExprVstore {
367 ExprVstoreUniq, // ~[1,2,3,4]
368 ExprVstoreSlice, // &[1,2,3,4]
369 ExprVstoreMutSlice, // &mut [1,2,3,4]
370 }
371
372 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
373 pub enum BinOp {
374 BiAdd,
375 BiSub,
376 BiMul,
377 BiDiv,
378 BiRem,
379 BiAnd,
380 BiOr,
381 BiBitXor,
382 BiBitAnd,
383 BiBitOr,
384 BiShl,
385 BiShr,
386 BiEq,
387 BiLt,
388 BiLe,
389 BiNe,
390 BiGe,
391 BiGt,
392 }
393
394 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
395 pub enum UnOp {
396 UnBox,
397 UnUniq,
398 UnDeref,
399 UnNot,
400 UnNeg
401 }
402
403 pub type Stmt = Spanned<Stmt_>;
404
405 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
406 pub enum Stmt_ {
407 // could be an item or a local (let) binding:
408 StmtDecl(@Decl, NodeId),
409
410 // expr without trailing semi-colon (must have unit type):
411 StmtExpr(@Expr, NodeId),
412
413 // expr with trailing semi-colon (may have any type):
414 StmtSemi(@Expr, NodeId),
415
416 // bool: is there a trailing sem-colon?
417 StmtMac(Mac, bool),
418 }
419
420 // FIXME (pending discussion of #1697, #2178...): local should really be
421 // a refinement on pat.
422 /// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
423 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
424 pub struct Local {
425 pub ty: P<Ty>,
426 pub pat: @Pat,
427 pub init: Option<@Expr>,
428 pub id: NodeId,
429 pub span: Span,
430 }
431
432 pub type Decl = Spanned<Decl_>;
433
434 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
435 pub enum Decl_ {
436 // a local (let) binding:
437 DeclLocal(@Local),
438 // an item binding:
439 DeclItem(@Item),
440 }
441
442 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
443 pub struct Arm {
444 pub attrs: Vec<Attribute>,
445 pub pats: Vec<@Pat>,
446 pub guard: Option<@Expr>,
447 pub body: @Expr,
448 }
449
450 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
451 pub struct Field {
452 pub ident: SpannedIdent,
453 pub expr: @Expr,
454 pub span: Span,
455 }
456
457 pub type SpannedIdent = Spanned<Ident>;
458
459 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
460 pub enum BlockCheckMode {
461 DefaultBlock,
462 UnsafeBlock(UnsafeSource),
463 }
464
465 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
466 pub enum UnsafeSource {
467 CompilerGenerated,
468 UserProvided,
469 }
470
471 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
472 pub struct Expr {
473 pub id: NodeId,
474 pub node: Expr_,
475 pub span: Span,
476 }
477
478 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
479 pub enum Expr_ {
480 ExprVstore(@Expr, ExprVstore),
481 // First expr is the place; second expr is the value.
482 ExprBox(@Expr, @Expr),
483 ExprVec(Vec<@Expr>),
484 ExprCall(@Expr, Vec<@Expr>),
485 ExprMethodCall(SpannedIdent, Vec<P<Ty>>, Vec<@Expr>),
486 ExprTup(Vec<@Expr>),
487 ExprBinary(BinOp, @Expr, @Expr),
488 ExprUnary(UnOp, @Expr),
489 ExprLit(@Lit),
490 ExprCast(@Expr, P<Ty>),
491 ExprIf(@Expr, P<Block>, Option<@Expr>),
492 ExprWhile(@Expr, P<Block>),
493 // FIXME #6993: change to Option<Name>
494 ExprForLoop(@Pat, @Expr, P<Block>, Option<Ident>),
495 // Conditionless loop (can be exited with break, cont, or ret)
496 // FIXME #6993: change to Option<Name>
497 ExprLoop(P<Block>, Option<Ident>),
498 ExprMatch(@Expr, Vec<Arm>),
499 ExprFnBlock(P<FnDecl>, P<Block>),
500 ExprProc(P<FnDecl>, P<Block>),
501 ExprBlock(P<Block>),
502
503 ExprAssign(@Expr, @Expr),
504 ExprAssignOp(BinOp, @Expr, @Expr),
505 ExprField(@Expr, Ident, Vec<P<Ty>>),
506 ExprIndex(@Expr, @Expr),
507
508 /// Expression that looks like a "name". For example,
509 /// `std::slice::from_elem::<uint>` is an ExprPath that's the "name" part
510 /// of a function call.
511 ExprPath(Path),
512
513 ExprAddrOf(Mutability, @Expr),
514 ExprBreak(Option<Ident>),
515 ExprAgain(Option<Ident>),
516 ExprRet(Option<@Expr>),
517
518 ExprInlineAsm(InlineAsm),
519
520 ExprMac(Mac),
521
522 // A struct literal expression.
523 ExprStruct(Path, Vec<Field> , Option<@Expr> /* base */),
524
525 // A vector literal constructed from one repeated element.
526 ExprRepeat(@Expr /* element */, @Expr /* count */),
527
528 // No-op: used solely so we can pretty-print faithfully
529 ExprParen(@Expr)
530 }
531
532 // When the main rust parser encounters a syntax-extension invocation, it
533 // parses the arguments to the invocation as a token-tree. This is a very
534 // loose structure, such that all sorts of different AST-fragments can
535 // be passed to syntax extensions using a uniform type.
536 //
537 // If the syntax extension is an MBE macro, it will attempt to match its
538 // LHS "matchers" against the provided token tree, and if it finds a
539 // match, will transcribe the RHS token tree, splicing in any captured
540 // macro_parser::matched_nonterminals into the TTNonterminals it finds.
541 //
542 // The RHS of an MBE macro is the only place a TTNonterminal or TTSeq
543 // makes any real sense. You could write them elsewhere but nothing
544 // else knows what to do with them, so you'll probably get a syntax
545 // error.
546 //
547 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
548 #[doc="For macro invocations; parsing is delegated to the macro"]
549 pub enum TokenTree {
550 // a single token
551 TTTok(Span, ::parse::token::Token),
552 // a delimited sequence (the delimiters appear as the first
553 // and last elements of the vector)
554 // FIXME(eddyb) #6308 Use Rc<[TokenTree]> after DST.
555 TTDelim(Rc<Vec<TokenTree>>),
556
557 // These only make sense for right-hand-sides of MBE macros:
558
559 // a kleene-style repetition sequence with a span, a TTForest,
560 // an optional separator, and a boolean where true indicates
561 // zero or more (..), and false indicates one or more (+).
562 // FIXME(eddyb) #6308 Use Rc<[TokenTree]> after DST.
563 TTSeq(Span, Rc<Vec<TokenTree>>, Option<::parse::token::Token>, bool),
564
565 // a syntactic variable that will be filled in by macro expansion.
566 TTNonterminal(Span, Ident)
567 }
568
569 //
570 // Matchers are nodes defined-by and recognized-by the main rust parser and
571 // language, but they're only ever found inside syntax-extension invocations;
572 // indeed, the only thing that ever _activates_ the rules in the rust parser
573 // for parsing a matcher is a matcher looking for the 'matchers' nonterminal
574 // itself. Matchers represent a small sub-language for pattern-matching
575 // token-trees, and are thus primarily used by the macro-defining extension
576 // itself.
577 //
578 // MatchTok
579 // --------
580 //
581 // A matcher that matches a single token, denoted by the token itself. So
582 // long as there's no $ involved.
583 //
584 //
585 // MatchSeq
586 // --------
587 //
588 // A matcher that matches a sequence of sub-matchers, denoted various
589 // possible ways:
590 //
591 // $(M)* zero or more Ms
592 // $(M)+ one or more Ms
593 // $(M),+ one or more comma-separated Ms
594 // $(A B C);* zero or more semi-separated 'A B C' seqs
595 //
596 //
597 // MatchNonterminal
598 // -----------------
599 //
600 // A matcher that matches one of a few interesting named rust
601 // nonterminals, such as types, expressions, items, or raw token-trees. A
602 // black-box matcher on expr, for example, binds an expr to a given ident,
603 // and that ident can re-occur as an interpolation in the RHS of a
604 // macro-by-example rule. For example:
605 //
606 // $foo:expr => 1 + $foo // interpolate an expr
607 // $foo:tt => $foo // interpolate a token-tree
608 // $foo:tt => bar! $foo // only other valid interpolation
609 // // is in arg position for another
610 // // macro
611 //
612 // As a final, horrifying aside, note that macro-by-example's input is
613 // also matched by one of these matchers. Holy self-referential! It is matched
614 // by a MatchSeq, specifically this one:
615 //
616 // $( $lhs:matchers => $rhs:tt );+
617 //
618 // If you understand that, you have closed to loop and understand the whole
619 // macro system. Congratulations.
620 //
621 pub type Matcher = Spanned<Matcher_>;
622
623 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
624 pub enum Matcher_ {
625 // match one token
626 MatchTok(::parse::token::Token),
627 // match repetitions of a sequence: body, separator, zero ok?,
628 // lo, hi position-in-match-array used:
629 MatchSeq(Vec<Matcher> , Option<::parse::token::Token>, bool, uint, uint),
630 // parse a Rust NT: name to bind, name of NT, position in match array:
631 MatchNonterminal(Ident, Ident, uint)
632 }
633
634 pub type Mac = Spanned<Mac_>;
635
636 // represents a macro invocation. The Path indicates which macro
637 // is being invoked, and the vector of token-trees contains the source
638 // of the macro invocation.
639 // There's only one flavor, now, so this could presumably be simplified.
640 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
641 pub enum Mac_ {
642 MacInvocTT(Path, Vec<TokenTree> , SyntaxContext), // new macro-invocation
643 }
644
645 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
646 pub enum StrStyle {
647 CookedStr,
648 RawStr(uint)
649 }
650
651 pub type Lit = Spanned<Lit_>;
652
653 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
654 pub enum Lit_ {
655 LitStr(InternedString, StrStyle),
656 LitBinary(Rc<Vec<u8> >),
657 LitChar(char),
658 LitInt(i64, IntTy),
659 LitUint(u64, UintTy),
660 LitIntUnsuffixed(i64),
661 LitFloat(InternedString, FloatTy),
662 LitFloatUnsuffixed(InternedString),
663 LitNil,
664 LitBool(bool),
665 }
666
667 // NB: If you change this, you'll probably want to change the corresponding
668 // type structure in middle/ty.rs as well.
669 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
670 pub struct MutTy {
671 pub ty: P<Ty>,
672 pub mutbl: Mutability,
673 }
674
675 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
676 pub struct TypeField {
677 pub ident: Ident,
678 pub mt: MutTy,
679 pub span: Span,
680 }
681
682 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
683 pub struct TypeMethod {
684 pub ident: Ident,
685 pub attrs: Vec<Attribute>,
686 pub fn_style: FnStyle,
687 pub decl: P<FnDecl>,
688 pub generics: Generics,
689 pub explicit_self: ExplicitSelf,
690 pub id: NodeId,
691 pub span: Span,
692 }
693
694 // A trait method is either required (meaning it doesn't have an
695 // implementation, just a signature) or provided (meaning it has a default
696 // implementation).
697 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
698 pub enum TraitMethod {
699 Required(TypeMethod),
700 Provided(@Method),
701 }
702
703 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
704 pub enum IntTy {
705 TyI,
706 TyI8,
707 TyI16,
708 TyI32,
709 TyI64,
710 }
711
712 impl fmt::Show for IntTy {
713 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
714 write!(f.buf, "{}", ast_util::int_ty_to_str(*self, None))
715 }
716 }
717
718 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
719 pub enum UintTy {
720 TyU,
721 TyU8,
722 TyU16,
723 TyU32,
724 TyU64,
725 }
726
727 impl fmt::Show for UintTy {
728 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
729 write!(f.buf, "{}", ast_util::uint_ty_to_str(*self, None))
730 }
731 }
732
733 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
734 pub enum FloatTy {
735 TyF32,
736 TyF64,
737 TyF128
738 }
739
740 impl fmt::Show for FloatTy {
741 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
742 write!(f.buf, "{}", ast_util::float_ty_to_str(*self))
743 }
744 }
745
746 // NB Eq method appears below.
747 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
748 pub struct Ty {
749 pub id: NodeId,
750 pub node: Ty_,
751 pub span: Span,
752 }
753
754 // Not represented directly in the AST, referred to by name through a ty_path.
755 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
756 pub enum PrimTy {
757 TyInt(IntTy),
758 TyUint(UintTy),
759 TyFloat(FloatTy),
760 TyStr,
761 TyBool,
762 TyChar
763 }
764
765 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
766 pub enum Onceness {
767 Once,
768 Many
769 }
770
771 impl fmt::Show for Onceness {
772 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
773 match *self {
774 Once => "once".fmt(f),
775 Many => "many".fmt(f),
776 }
777 }
778 }
779
780 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
781 pub struct ClosureTy {
782 pub lifetimes: Vec<Lifetime>,
783 pub fn_style: FnStyle,
784 pub onceness: Onceness,
785 pub decl: P<FnDecl>,
786 // Optional optvec distinguishes between "fn()" and "fn:()" so we can
787 // implement issue #7264. None means "fn()", which means infer a default
788 // bound based on pointer sigil during typeck. Some(Empty) means "fn:()",
789 // which means use no bounds (e.g., not even Owned on a ~fn()).
790 pub bounds: Option<OwnedSlice<TyParamBound>>,
791 }
792
793 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
794 pub struct BareFnTy {
795 pub fn_style: FnStyle,
796 pub abi: Abi,
797 pub lifetimes: Vec<Lifetime>,
798 pub decl: P<FnDecl>
799 }
800
801 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
802 pub enum Ty_ {
803 TyNil,
804 TyBot, /* bottom type */
805 TyBox(P<Ty>),
806 TyUniq(P<Ty>),
807 TyVec(P<Ty>),
808 TyFixedLengthVec(P<Ty>, @Expr),
809 TyPtr(MutTy),
810 TyRptr(Option<Lifetime>, MutTy),
811 TyClosure(@ClosureTy, Option<Lifetime>),
812 TyProc(@ClosureTy),
813 TyBareFn(@BareFnTy),
814 TyTup(Vec<P<Ty>> ),
815 TyPath(Path, Option<OwnedSlice<TyParamBound>>, NodeId), // for #7264; see above
816 TyTypeof(@Expr),
817 // TyInfer means the type should be inferred instead of it having been
818 // specified. This can appear anywhere in a type.
819 TyInfer,
820 }
821
822 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
823 pub enum AsmDialect {
824 AsmAtt,
825 AsmIntel
826 }
827
828 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
829 pub struct InlineAsm {
830 pub asm: InternedString,
831 pub asm_str_style: StrStyle,
832 pub clobbers: InternedString,
833 pub inputs: Vec<(InternedString, @Expr)>,
834 pub outputs: Vec<(InternedString, @Expr)>,
835 pub volatile: bool,
836 pub alignstack: bool,
837 pub dialect: AsmDialect
838 }
839
840 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
841 pub struct Arg {
842 pub ty: P<Ty>,
843 pub pat: @Pat,
844 pub id: NodeId,
845 }
846
847 impl Arg {
848 pub fn new_self(span: Span, mutability: Mutability) -> Arg {
849 let path = ast_util::ident_to_path(span, special_idents::self_);
850 Arg {
851 // HACK(eddyb) fake type for the self argument.
852 ty: P(Ty {
853 id: DUMMY_NODE_ID,
854 node: TyInfer,
855 span: DUMMY_SP,
856 }),
857 pat: @Pat {
858 id: DUMMY_NODE_ID,
859 node: PatIdent(BindByValue(mutability), path, None),
860 span: span
861 },
862 id: DUMMY_NODE_ID
863 }
864 }
865 }
866
867 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
868 pub struct FnDecl {
869 pub inputs: Vec<Arg>,
870 pub output: P<Ty>,
871 pub cf: RetStyle,
872 pub variadic: bool
873 }
874
875 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
876 pub enum FnStyle {
877 UnsafeFn, // declared with "unsafe fn"
878 NormalFn, // declared with "fn"
879 }
880
881 impl fmt::Show for FnStyle {
882 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
883 match *self {
884 NormalFn => "normal".fmt(f),
885 UnsafeFn => "unsafe".fmt(f),
886 }
887 }
888 }
889
890 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
891 pub enum RetStyle {
892 NoReturn, // functions with return type _|_ that always
893 // raise an error or exit (i.e. never return to the caller)
894 Return, // everything else
895 }
896
897 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
898 pub enum ExplicitSelf_ {
899 SelfStatic, // no self
900 SelfValue, // `self`
901 SelfRegion(Option<Lifetime>, Mutability), // `&'lt self`, `&'lt mut self`
902 SelfUniq // `~self`
903 }
904
905 pub type ExplicitSelf = Spanned<ExplicitSelf_>;
906
907 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
908 pub struct Method {
909 pub ident: Ident,
910 pub attrs: Vec<Attribute>,
911 pub generics: Generics,
912 pub explicit_self: ExplicitSelf,
913 pub fn_style: FnStyle,
914 pub decl: P<FnDecl>,
915 pub body: P<Block>,
916 pub id: NodeId,
917 pub span: Span,
918 pub vis: Visibility,
919 }
920
921 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
922 pub struct Mod {
923 /// A span from the first token past `{` to the last token until `}`.
924 /// For `mod foo;`, the inner span ranges from the first token
925 /// to the last token in the external file.
926 pub inner: Span,
927 pub view_items: Vec<ViewItem>,
928 pub items: Vec<@Item>,
929 }
930
931 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
932 pub struct ForeignMod {
933 pub abi: Abi,
934 pub view_items: Vec<ViewItem>,
935 pub items: Vec<@ForeignItem>,
936 }
937
938 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
939 pub struct VariantArg {
940 pub ty: P<Ty>,
941 pub id: NodeId,
942 }
943
944 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
945 pub enum VariantKind {
946 TupleVariantKind(Vec<VariantArg>),
947 StructVariantKind(@StructDef),
948 }
949
950 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
951 pub struct EnumDef {
952 pub variants: Vec<P<Variant>>,
953 }
954
955 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
956 pub struct Variant_ {
957 pub name: Ident,
958 pub attrs: Vec<Attribute>,
959 pub kind: VariantKind,
960 pub id: NodeId,
961 pub disr_expr: Option<@Expr>,
962 pub vis: Visibility,
963 }
964
965 pub type Variant = Spanned<Variant_>;
966
967 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
968 pub struct PathListIdent_ {
969 pub name: Ident,
970 pub id: NodeId,
971 }
972
973 pub type PathListIdent = Spanned<PathListIdent_>;
974
975 pub type ViewPath = Spanned<ViewPath_>;
976
977 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
978 pub enum ViewPath_ {
979
980 // quux = foo::bar::baz
981 //
982 // or just
983 //
984 // foo::bar::baz (with 'baz =' implicitly on the left)
985 ViewPathSimple(Ident, Path, NodeId),
986
987 // foo::bar::*
988 ViewPathGlob(Path, NodeId),
989
990 // foo::bar::{a,b,c}
991 ViewPathList(Path, Vec<PathListIdent> , NodeId)
992 }
993
994 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
995 pub struct ViewItem {
996 pub node: ViewItem_,
997 pub attrs: Vec<Attribute>,
998 pub vis: Visibility,
999 pub span: Span,
1000 }
1001
1002 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
1003 pub enum ViewItem_ {
1004 // ident: name used to refer to this crate in the code
1005 // optional (InternedString,StrStyle): if present, this is a location
1006 // (containing arbitrary characters) from which to fetch the crate sources
1007 // For example, extern crate whatever = "github.com/mozilla/rust"
1008 ViewItemExternCrate(Ident, Option<(InternedString,StrStyle)>, NodeId),
1009 ViewItemUse(@ViewPath),
1010 }
1011
1012 // Meta-data associated with an item
1013 pub type Attribute = Spanned<Attribute_>;
1014
1015 // Distinguishes between Attributes that decorate items and Attributes that
1016 // are contained as statements within items. These two cases need to be
1017 // distinguished for pretty-printing.
1018 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
1019 pub enum AttrStyle {
1020 AttrOuter,
1021 AttrInner,
1022 }
1023
1024 // doc-comments are promoted to attributes that have is_sugared_doc = true
1025 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
1026 pub struct Attribute_ {
1027 pub style: AttrStyle,
1028 pub value: @MetaItem,
1029 pub is_sugared_doc: bool,
1030 }
1031
1032 /*
1033 TraitRef's appear in impls.
1034 resolve maps each TraitRef's ref_id to its defining trait; that's all
1035 that the ref_id is for. The impl_id maps to the "self type" of this impl.
1036 If this impl is an ItemImpl, the impl_id is redundant (it could be the
1037 same as the impl's node id).
1038 */
1039 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
1040 pub struct TraitRef {
1041 pub path: Path,
1042 pub ref_id: NodeId,
1043 }
1044
1045 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
1046 pub enum Visibility {
1047 Public,
1048 Inherited,
1049 }
1050
1051 impl Visibility {
1052 pub fn inherit_from(&self, parent_visibility: Visibility) -> Visibility {
1053 match self {
1054 &Inherited => parent_visibility,
1055 &Public => *self
1056 }
1057 }
1058 }
1059
1060 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
1061 pub enum Sized {
1062 DynSize,
1063 StaticSize,
1064 }
1065
1066 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
1067 pub struct StructField_ {
1068 pub kind: StructFieldKind,
1069 pub id: NodeId,
1070 pub ty: P<Ty>,
1071 pub attrs: Vec<Attribute>,
1072 }
1073
1074 pub type StructField = Spanned<StructField_>;
1075
1076 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
1077 pub enum StructFieldKind {
1078 NamedField(Ident, Visibility),
1079 UnnamedField(Visibility), // element of a tuple-like struct
1080 }
1081
1082 impl StructFieldKind {
1083 pub fn is_unnamed(&self) -> bool {
1084 match *self {
1085 UnnamedField(..) => true,
1086 NamedField(..) => false,
1087 }
1088 }
1089 }
1090
1091 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
1092 pub struct StructDef {
1093 pub fields: Vec<StructField>, /* fields, not including ctor */
1094 /* ID of the constructor. This is only used for tuple- or enum-like
1095 * structs. */
1096 pub ctor_id: Option<NodeId>,
1097 pub super_struct: Option<P<Ty>>, // Super struct, if specified.
1098 pub is_virtual: bool, // True iff the struct may be inherited from.
1099 }
1100
1101 /*
1102 FIXME (#3300): Should allow items to be anonymous. Right now
1103 we just use dummy names for anon items.
1104 */
1105 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
1106 pub struct Item {
1107 pub ident: Ident,
1108 pub attrs: Vec<Attribute>,
1109 pub id: NodeId,
1110 pub node: Item_,
1111 pub vis: Visibility,
1112 pub span: Span,
1113 }
1114
1115 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
1116 pub enum Item_ {
1117 ItemStatic(P<Ty>, Mutability, @Expr),
1118 ItemFn(P<FnDecl>, FnStyle, Abi, Generics, P<Block>),
1119 ItemMod(Mod),
1120 ItemForeignMod(ForeignMod),
1121 ItemTy(P<Ty>, Generics),
1122 ItemEnum(EnumDef, Generics),
1123 ItemStruct(@StructDef, Generics),
1124 ItemTrait(Generics, Sized, Vec<TraitRef> , Vec<TraitMethod> ),
1125 ItemImpl(Generics,
1126 Option<TraitRef>, // (optional) trait this impl implements
1127 P<Ty>, // self
1128 Vec<@Method> ),
1129 // a macro invocation (which includes macro definition)
1130 ItemMac(Mac),
1131 }
1132
1133 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
1134 pub struct ForeignItem {
1135 pub ident: Ident,
1136 pub attrs: Vec<Attribute>,
1137 pub node: ForeignItem_,
1138 pub id: NodeId,
1139 pub span: Span,
1140 pub vis: Visibility,
1141 }
1142
1143 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
1144 pub enum ForeignItem_ {
1145 ForeignItemFn(P<FnDecl>, Generics),
1146 ForeignItemStatic(P<Ty>, /* is_mutbl */ bool),
1147 }
1148
1149 // The data we save and restore about an inlined item or method. This is not
1150 // part of the AST that we parse from a file, but it becomes part of the tree
1151 // that we trans.
1152 #[deriving(Eq, TotalEq, Encodable, Decodable, Hash)]
1153 pub enum InlinedItem {
1154 IIItem(@Item),
1155 IIMethod(DefId /* impl id */, bool /* is provided */, @Method),
1156 IIForeign(@ForeignItem),
1157 }
1158
1159 #[cfg(test)]
1160 mod test {
1161 use serialize::json;
1162 use serialize;
1163 use codemap::*;
1164 use super::*;
1165
1166 // are ASTs encodable?
1167 #[test]
1168 fn check_asts_encodable() {
1169 use std::io;
1170 let e = Crate {
1171 module: Mod {
1172 inner: Span {
1173 lo: BytePos(11),
1174 hi: BytePos(19),
1175 expn_info: None,
1176 },
1177 view_items: Vec::new(),
1178 items: Vec::new(),
1179 },
1180 attrs: Vec::new(),
1181 config: Vec::new(),
1182 span: Span {
1183 lo: BytePos(10),
1184 hi: BytePos(20),
1185 expn_info: None,
1186 },
1187 };
1188 // doesn't matter which encoder we use....
1189 let _f = &e as &serialize::Encodable<json::Encoder, io::IoError>;
1190 }
1191 }
libsyntax/ast.rs:1143:53-1143:53 -enum- definition:
pub enum ForeignItem_ {
ForeignItemFn(P<FnDecl>, Generics),
ForeignItemStatic(P<Ty>, /* is_mutbl */ bool),
references:- 91144: pub enum ForeignItem_ {
libsyntax/ast.rs:1039:60-1039:60 -struct- definition:
pub struct TraitRef {
pub path: Path,
pub ref_id: NodeId,
references:- 36libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast.rs:755:60-755:60 -enum- definition:
pub enum PrimTy {
TyInt(IntTy),
TyUint(UintTy),
references:- 11754: // Not represented directly in the AST, referred to by name through a ty_path.
756: pub enum PrimTy {
libsyntax/ast.rs:1002:60-1002:60 -enum- definition:
pub enum ViewItem_ {
// ident: name used to refer to this crate in the code
// optional (InternedString,StrStyle): if present, this is a location
references:- 121003: pub enum ViewItem_ {
libsyntax/parse/parser.rs:
4817: // parse, e.g., "use a::b::{z,y}"
4818: fn parse_use(&mut self) -> ViewItem_ {
4819: return ViewItemUse(self.parse_view_paths());
libsyntax/ast.rs:
1003: pub enum ViewItem_ {
libsyntax/ast.rs:669:60-669:60 -struct- definition:
pub struct MutTy {
pub ty: P<Ty>,
pub mutbl: Mutability,
references:- 34libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/print/pprust.rs:
libsyntax/ast.rs:394:60-394:60 -enum- definition:
pub enum UnOp {
UnBox,
UnUniq,
references:- 15395: pub enum UnOp {
libsyntax/ast_util.rs:
121: pub fn unop_to_str(op: UnOp) -> &'static str {
122: match op {
libsyntax/parse/parser.rs:
1659: pub fn mk_unary(&mut self, unop: ast::UnOp, expr: @Expr) -> ast::Expr_ {
1660: ExprUnary(unop, expr)
libsyntax/ext/build.rs:
517: }
518: fn expr_unary(&self, sp: Span, op: ast::UnOp, e: @ast::Expr) -> @ast::Expr {
519: self.expr(sp, ast::ExprUnary(op, e))
libsyntax/ast.rs:
487: ExprBinary(BinOp, @Expr, @Expr),
488: ExprUnary(UnOp, @Expr),
489: ExprLit(@Lit),
libsyntax/ast.rs:1091:53-1091:53 -struct- definition:
pub struct StructDef {
pub fields: Vec<StructField>, /* fields, not including ctor */
/* ID of the constructor. This is only used for tuple- or enum-like
references:- 43libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/build.rs:
libsyntax/parse/parser.rs:
libsyntax/ast.rs:921:60-921:60 -struct- definition:
pub struct Mod {
/// A span from the first token past `{` to the last token until `}`.
/// For `mod foo;`, the inner span ranges from the first token
references:- 34libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ast.rs:
libsyntax/ast.rs:828:60-828:60 -struct- definition:
pub struct InlineAsm {
pub asm: InternedString,
pub asm_str_style: StrStyle,
references:- 23829: pub struct InlineAsm {
libsyntax/fold.rs:
869: ExprInlineAsm(ref a) => {
870: ExprInlineAsm(InlineAsm {
871: inputs: a.inputs.iter().map(|&(ref c, input)| {
libsyntax/ext/asm.rs:
215: id: ast::DUMMY_NODE_ID,
216: node: ast::ExprInlineAsm(ast::InlineAsm {
217: asm: token::intern_and_get_ident(asm.get()),
libsyntax/ast.rs:
829: pub struct InlineAsm {
libsyntax/ast.rs:315:60-315:60 -struct- definition:
pub struct Pat {
pub id: NodeId,
pub node: Pat_,
references:- 103libsyntax/ast_util.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/parse/token.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/build.rs:
libsyntax/ast_util.rs:
libsyntax/ast.rs:98:68-98:68 -NK_AS_STR_TODO- definition:
/// A mark represents a unique id associated with a macro expansion
pub type Mrk = u32;
impl<S: Encoder<E>, E> Encodable<S, E> for Ident {
references:- 18libsyntax/parse/token.rs:
675: // create a fresh mark.
676: pub fn fresh_mark() -> Mrk {
677: gensym("mark")
libsyntax/ext/expand.rs:
893: // A Marker adds the given mark to the syntax context
894: struct Marker { mark: Mrk }
--
918: // just a convenience:
919: fn new_mark_folder(m: Mrk) -> Marker {
920: Marker {mark: m}
--
923: // apply a given mark to the given token trees. Used prior to expansion of a macro.
924: fn mark_tts(tts: &[TokenTree], m: Mrk) -> Vec<TokenTree> {
925: fold_tts(tts, &mut new_mark_folder(m))
--
939: // apply a given mark to the given item. Used following the expansion of a macro.
940: fn mark_item(expr: @ast::Item, m: Mrk) -> SmallVector<@ast::Item> {
941: new_mark_folder(m).fold_item(expr)
libsyntax/ext/mtwt.rs:
64: let key = (tail, m);
65: let new_ctxt = |_: &(SyntaxContext, Mrk)|
66: idx_push(&mut *table.table.borrow_mut(), Mark(m, tail));
--
215: stopname: Name,
216: table: &SCTable) -> Vec<Mrk> {
217: let mut result = Vec::new();
--
255: // case pop and discard (so two of the same marks cancel)
256: fn xorPush(marks: &mut Vec<Mrk>, mark: Mrk) {
257: if (marks.len() > 0) && (*marks.last().unwrap() == mark) {
libsyntax/ast.rs:1115:60-1115:60 -enum- definition:
pub enum Item_ {
ItemStatic(P<Ty>, Mutability, @Expr),
ItemFn(P<FnDecl>, FnStyle, Abi, Generics, P<Block>),
references:- 211116: pub enum Item_ {
libsyntax/fold.rs:
585: pub fn noop_fold_item_underscore<T: Folder>(i: &Item_, folder: &mut T) -> Item_ {
586: match *i {
libsyntax/parse/parser.rs:
4201: path: Path,
4202: id_sp: Span) -> (ast::Item_, Vec<ast::Attribute> ) {
4203: let mut included_mod_stack = self.sess.included_mod_stack.borrow_mut();
libsyntax/ext/build.rs:
815: fn item(&self, span: Span,
816: name: Ident, attrs: Vec<ast::Attribute> , node: ast::Item_) -> @ast::Item {
817: // FIXME: Would be nice if our generated code didn't violate
libsyntax/ast.rs:
1116: pub enum Item_ {
libsyntax/ast.rs:697:60-697:60 -enum- definition:
pub enum TraitMethod {
Required(TypeMethod),
Provided(@Method),
references:- 20696: // implementation).
698: pub enum TraitMethod {
--
1123: ItemStruct(@StructDef, Generics),
1124: ItemTrait(Generics, Sized, Vec<TraitRef> , Vec<TraitMethod> ),
1125: ItemImpl(Generics,
libsyntax/ast_util.rs:
562: fn visit_trait_method(&mut self, tm: &ast::TraitMethod, _: ()) {
563: match *tm {
libsyntax/ast_map.rs:
98: NodeForeignItem(@ForeignItem),
99: NodeTraitMethod(@TraitMethod),
100: NodeMethod(@Method),
--
122: EntryForeignItem(NodeId, @ForeignItem),
123: EntryTraitMethod(NodeId, @TraitMethod),
124: EntryMethod(NodeId, @Method),
libsyntax/visit.rs:
556: pub fn walk_trait_method<E: Clone, V: Visitor<E>>(visitor: &mut V,
557: trait_method: &TraitMethod,
558: env: E) {
libsyntax/parse/parser.rs:
1066: // parse the methods in a trait declaration
1067: pub fn parse_trait_methods(&mut self) -> Vec<TraitMethod> {
1068: self.parse_unspanned_seq(
libsyntax/print/pprust.rs:
916: pub fn print_trait_method(&mut self,
917: m: &ast::TraitMethod) -> IoResult<()> {
918: match *m {
libsyntax/visit.rs:
85: fn visit_ty_method(&mut self, t: &TypeMethod, e: E) { walk_ty_method(self, t, e) }
86: fn visit_trait_method(&mut self, t: &TraitMethod, e: E) { walk_trait_method(self, t, e) }
87: fn visit_struct_def(&mut self, s: &StructDef, i: Ident, g: &Generics, n: NodeId, e: E) {
libsyntax/ast.rs:897:60-897:60 -enum- definition:
pub enum ExplicitSelf_ {
SelfStatic, // no self
SelfValue, // `self`
references:- 22898: pub enum ExplicitSelf_ {
--
905: pub type ExplicitSelf = Spanned<ExplicitSelf_>;
libsyntax/fold.rs:
326: fn fold_explicit_self_(&mut self, es: &ExplicitSelf_) -> ExplicitSelf_ {
327: match *es {
libsyntax/parse/parser.rs:
3565: fn maybe_parse_borrowed_explicit_self(this: &mut Parser)
3566: -> ast::ExplicitSelf_ {
3567: // The following things are possible to see here:
libsyntax/print/pprust.rs:
2080: generics: Option<&ast::Generics>,
2081: opt_explicit_self: Option<ast::ExplicitSelf_>)
2082: -> IoResult<()> {
--
2380: pub fn print_fn_header_info(&mut self,
2381: _opt_explicit_self: Option<ast::ExplicitSelf_>,
2382: opt_fn_style: Option<ast::FnStyle>,
libsyntax/ast.rs:
898: pub enum ExplicitSelf_ {
libsyntax/ast.rs:620:3-620:3 -NK_AS_STR_TODO- definition:
//
pub type Matcher = Spanned<Matcher_>;
pub enum Matcher_ {
references:- 13628: // lo, hi position-in-match-array used:
629: MatchSeq(Vec<Matcher> , Option<::parse::token::Token>, bool, uint, uint),
630: // parse a Rust NT: name to bind, name of NT, position in match array:
libsyntax/parse/parser.rs:
2163: ket: &token::Token)
2164: -> Vec<Matcher> {
2165: let mut ret_val = Vec::new();
--
2179: pub fn parse_matcher(&mut self, name_idx: &mut uint) -> Matcher {
2180: let lo = self.span.lo;
libsyntax/parse/token.rs:
118: NtTT( @ast::TokenTree), // needs @ed to break a circularity
119: NtMatchers(Vec<ast::Matcher> )
120: }
libsyntax/ext/tt/macro_parser.rs:
111: pub fn count_names(ms: &[Matcher]) -> uint {
112: ms.iter().fold(0, |ct, m| {
--
122: pub fn initial_matcher_pos(ms: Vec<Matcher> , sep: Option<Token>, lo: BytePos)
123: -> Box<MatcherPos> {
--
236: mut rdr: TtReader,
237: ms: &[Matcher])
238: -> ParseResult {
libsyntax/ext/tt/macro_rules.rs:
197: // these spans won't matter, anyways
198: fn ms(m: Matcher_) -> Matcher {
199: Spanned {
libsyntax/ext/tt/macro_parser.rs:
173: pub fn nameize(p_s: &ParseSess, ms: &[Matcher], res: &[Rc<NamedMatch>])
174: -> HashMap<Ident, Rc<NamedMatch>> {
libsyntax/ast.rs:478:60-478:60 -enum- definition:
pub enum Expr_ {
ExprVstore(@Expr, ExprVstore),
// First expr is the place; second expr is the value.
references:- 22479: pub enum Expr_ {
libsyntax/parse/parser.rs:
1687: pub fn mk_assign_op(&mut self, binop: ast::BinOp, lhs: @Expr, rhs: @Expr) -> ast::Expr_ {
1688: ExprAssignOp(binop, lhs, rhs)
--
1722: let ex: Expr_;
libsyntax/ext/build.rs:
491: fn expr(&self, span: Span, node: ast::Expr_) -> @ast::Expr {
492: @ast::Expr {
libsyntax/ast.rs:
479: pub enum Expr_ {
libsyntax/ast.rs:305:60-305:60 -struct- definition:
pub struct Block {
pub view_items: Vec<ViewItem>,
pub stmts: Vec<@Stmt>,
references:- 96libsyntax/ast_util.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/build.rs:
libsyntax/ext/format.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/parse/token.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/quote.rs:
libsyntax/ext/build.rs:
libsyntax/ast_util.rs:
libsyntax/ast.rs:682:60-682:60 -struct- definition:
pub struct TypeMethod {
pub ident: Ident,
pub attrs: Vec<Attribute>,
references:- 36libsyntax/ast_util.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/print/pprust.rs:
libsyntax/ast.rs:
libsyntax/ast.rs:95:29-95:29 -NK_AS_STR_TODO- definition:
/// the result of interning.
pub type Name = u32;
/// A mark represents a unique id associated with a macro expansion
references:- 53libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/parse/token.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/base.rs:
libsyntax/ext/build.rs:
libsyntax/ext/mtwt.rs:
libsyntax/util/interner.rs:
libsyntax/ext/base.rs:
libsyntax/ast.rs:139:60-139:60 -struct- definition:
pub struct PathSegment {
/// The identifier portion of this path segment.
pub identifier: Ident,
references:- 35libsyntax/ast_util.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ext/concat_idents.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ext/build.rs:
libsyntax/parse/parser.rs:
libsyntax/ast.rs:703:60-703:60 -enum- definition:
pub enum IntTy {
TyI,
TyI8,
references:- 18712: impl fmt::Show for IntTy {
713: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
--
756: pub enum PrimTy {
757: TyInt(IntTy),
758: TyUint(UintTy),
libsyntax/ast_util.rs:
136: // We want to avoid "45int" and "-3int" in favor of "45" and "-3"
137: pub fn int_ty_to_str(t: IntTy, val: Option<i64>) -> StrBuf {
138: let s = match t {
--
153: pub fn int_ty_max(t: IntTy) -> u64 {
154: match t {
libsyntax/parse/lexer.rs:
521: if c == 'u' || c == 'i' {
522: enum Result { Signed(ast::IntTy), Unsigned(ast::UintTy) }
523: let signed = c == 'i';
libsyntax/parse/token.rs:
82: LIT_CHAR(char),
83: LIT_INT(i64, ast::IntTy),
84: LIT_UINT(u64, ast::UintTy),
libsyntax/attr.rs:
478: pub enum IntType {
479: SignedInt(ast::IntTy),
480: UnsignedInt(ast::UintTy)
libsyntax/ast.rs:
704: pub enum IntTy {
libsyntax/ast.rs:974:1-974:1 -NK_AS_STR_TODO- definition:
pub type ViewPath = Spanned<ViewPath_>;
pub enum ViewPath_ {
// quux = foo::bar::baz
references:- 91008: ViewItemExternCrate(Ident, Option<(InternedString,StrStyle)>, NodeId),
1009: ViewItemUse(@ViewPath),
1010: }
libsyntax/ast_util.rs:
685: pub fn view_path_id(p: &ViewPath) -> NodeId {
686: match p.node {
libsyntax/fold.rs:
31: fn fold_view_path(&mut self, view_path: @ViewPath) -> @ViewPath {
32: let inner_view_path = match view_path.node {
libsyntax/parse/parser.rs:
4827: // | MOD? non_global_path
4828: fn parse_view_path(&mut self) -> @ViewPath {
4829: let lo = self.span.lo;
libsyntax/print/pprust.rs:
1975: pub fn print_view_path(&mut self, vp: &ast::ViewPath) -> IoResult<()> {
1976: match vp.node {
libsyntax/ext/build.rs:
954: fn view_use(&self, sp: Span,
955: vis: ast::Visibility, vp: @ast::ViewPath) -> ast::ViewItem {
956: ast::ViewItem {
libsyntax/parse/parser.rs:
4950: // matches view_paths = view_path | view_path , view_paths
4951: fn parse_view_paths(&mut self) -> @ViewPath {
4952: let vp = self.parse_view_path();
libsyntax/ast.rs:1076:60-1076:60 -enum- definition:
pub enum StructFieldKind {
NamedField(Ident, Visibility),
UnnamedField(Visibility), // element of a tuple-like struct
references:- 121082: impl StructFieldKind {
1083: pub fn is_unnamed(&self) -> bool {
libsyntax/ast.rs:633:1-633:1 -NK_AS_STR_TODO- definition:
pub type Mac = Spanned<Mac_>;
// represents a macro invocation. The Path indicates which macro
// is being invoked, and the vector of token-trees contains the source
references:- 111129: // a macro invocation (which includes macro definition)
1130: ItemMac(Mac),
1131: }
libsyntax/visit.rs:
639: pub fn walk_mac<E, V: Visitor<E>>(_: &mut V, _: &Mac, _: E) {
640: // Empty!
libsyntax/fold.rs:
294: fn fold_mac(&mut self, macro: &Mac) -> Mac {
295: Spanned {
libsyntax/parse/parser.rs:
4778: let m = ast::MacInvocTT(pth, tts, EMPTY_CTXT);
4779: let m: ast::Mac = codemap::Spanned { node: m,
4780: span: mk_sp(self.span.lo,
libsyntax/ext/expand.rs:
902: }
903: fn fold_mac(&mut self, m: &ast::Mac) -> ast::Mac {
904: let macro = match m.node {
libsyntax/print/pprust.rs:
1109: pub fn print_mac(&mut self, m: &ast::Mac) -> IoResult<()> {
1110: match m.node {
libsyntax/ast.rs:456:1-456:1 -NK_AS_STR_TODO- definition:
pub type SpannedIdent = Spanned<Ident>;
pub enum BlockCheckMode {
DefaultBlock,
references:- 3484: ExprCall(@Expr, Vec<@Expr>),
485: ExprMethodCall(SpannedIdent, Vec<P<Ty>>, Vec<@Expr>),
486: ExprTup(Vec<@Expr>),
libsyntax/parse/parser.rs:
1671: fn mk_method_call(&mut self,
1672: ident: ast::SpannedIdent,
1673: tps: Vec<P<Ty>>,
libsyntax/ast.rs:548:66-548:66 -enum- definition:
pub enum TokenTree {
// a single token
TTTok(Span, ::parse::token::Token),
references:- 102libsyntax/fold.rs:
libsyntax/parse/mod.rs:
libsyntax/parse/parser.rs:
libsyntax/parse/token.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/asm.rs:
libsyntax/ext/base.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/quote.rs:
libsyntax/ext/tt/transcribe.rs:
libsyntax/ext/tt/macro_rules.rs:
libsyntax/ext/cfg.rs:
libsyntax/ext/fmt.rs:
libsyntax/ext/format.rs:
libsyntax/ext/env.rs:
libsyntax/ext/bytes.rs:
libsyntax/ext/concat.rs:
libsyntax/ext/concat_idents.rs:
libsyntax/ext/log_syntax.rs:
libsyntax/ext/source_util.rs:
libsyntax/ext/trace_macros.rs:
libsyntax/ext/source_util.rs:
libsyntax/ast.rs:653:60-653:60 -enum- definition:
pub enum Lit_ {
LitStr(InternedString, StrStyle),
LitBinary(Rc<Vec<u8> >),
references:- 16654: pub enum Lit_ {
libsyntax/parse/parser.rs:
1401: // matches token_lit = LIT_INT | ...
1402: pub fn lit_from_token(&mut self, tok: &token::Token) -> Lit_ {
1403: match *tok {
libsyntax/ext/build.rs:
569: fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> @ast::Expr {
570: self.expr(sp, ast::ExprLit(@respan(sp, lit)))
--
948: name: InternedString,
949: value: ast::Lit_)
950: -> @ast::MetaItem {
libsyntax/ast.rs:
654: pub enum Lit_ {
libsyntax/ast.rs:1025:60-1025:60 -struct- definition:
pub struct Attribute_ {
pub style: AttrStyle,
pub value: @MetaItem,
references:- 261024: // doc-comments are promoted to attributes that have is_sugared_doc = true
1026: pub struct Attribute_ {
libsyntax/fold.rs:
361: span: fld.new_span(at.span),
362: node: ast::Attribute_ {
363: style: at.node.style,
libsyntax/parse/attr.rs:
102: span: span,
103: node: ast::Attribute_ {
104: style: style,
libsyntax/ext/build.rs:
928: fn attribute(&self, sp: Span, mi: @ast::MetaItem) -> ast::Attribute {
929: respan(sp, ast::Attribute_ {
930: style: ast::AttrOuter,
libsyntax/attr.rs:
168: let lit = spanned(lo, hi, ast::LitStr(text, ast::CookedStr));
169: let attr = Attribute_ {
170: style: style,
libsyntax/ast.rs:
1024: // doc-comments are promoted to attributes that have is_sugared_doc = true
1026: pub struct Attribute_ {
libsyntax/ast.rs:180:60-180:60 -struct- definition:
pub struct TyParam {
pub ident: Ident,
pub id: NodeId,
references:- 38libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/deriving/ty.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast.rs:322:60-322:60 -struct- definition:
pub struct FieldPat {
pub ident: Ident,
pub pat: @Pat,
references:- 27323: pub struct FieldPat {
libsyntax/fold.rs:
751: let fs = fields.iter().map(|f| {
752: ast::FieldPat {
753: ident: f.ident,
libsyntax/parse/parser.rs:
2758: };
2759: fields.push(ast::FieldPat { ident: fieldname, pat: subpat });
2760: }
libsyntax/ext/deriving/generic.rs:
1084: // id is guaranteed to be Some
1085: ast::FieldPat { ident: id.unwrap(), pat: pat }
1086: }).collect();
libsyntax/ast.rs:
323: pub struct FieldPat {
--
347: * we don't bind the fields to names */
348: PatStruct(Path, Vec<FieldPat> , bool),
349: PatTup(Vec<@Pat> ),
libsyntax/parse/parser.rs:
2700: // parse the fields of a struct-like pattern
2701: fn parse_pat_fields(&mut self) -> (Vec<ast::FieldPat> , bool) {
2702: let mut fields = Vec::new();
libsyntax/ext/build.rs:
724: fn pat_struct(&self, span: Span,
725: path: ast::Path, field_pats: Vec<ast::FieldPat> ) -> @ast::Pat {
726: let pat = ast::PatStruct(path, field_pats, false);
libsyntax/ast.rs:
323: pub struct FieldPat {
libsyntax/ast.rs:967:60-967:60 -struct- definition:
pub struct PathListIdent_ {
pub name: Ident,
pub id: NodeId,
references:- 24968: pub struct PathListIdent_ {
libsyntax/fold.rs:
49: Spanned {
50: node: PathListIdent_ {
51: name: path_list_ident.node
libsyntax/parse/parser.rs:
498: let hi = self.last_span.hi;
499: spanned(lo, hi, ast::PathListIdent_ { name: ident,
500: id: ast::DUMMY_NODE_ID })
libsyntax/ext/build.rs:
980: let imports = imports.iter().map(|id| {
981: respan(sp, ast::PathListIdent_ { name: *id, id: ast::DUMMY_NODE_ID })
982: }).collect();
libsyntax/ast.rs:
973: pub type PathListIdent = Spanned<PathListIdent_>;
libsyntax/ast.rs:1045:60-1045:60 -enum- definition:
pub enum Visibility {
Public,
Inherited,
references:- 46libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/build.rs:
libsyntax/print/pprust.rs:
libsyntax/ast.rs:442:60-442:60 -struct- definition:
pub struct Arm {
pub attrs: Vec<Attribute>,
pub pats: Vec<@Pat>,
references:- 40libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/deriving/primitive.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/ext/deriving/rand.rs:
libsyntax/ext/build.rs:
libsyntax/parse/parser.rs:
libsyntax/ast.rs:372:60-372:60 -enum- definition:
pub enum BinOp {
BiAdd,
BiSub,
references:- 22373: pub enum BinOp {
--
503: ExprAssign(@Expr, @Expr),
504: ExprAssignOp(BinOp, @Expr, @Expr),
505: ExprField(@Expr, Ident, Vec<P<Ty>>),
libsyntax/ast_util.rs:
82: pub fn binop_to_str(op: BinOp) -> &'static str {
83: match op {
--
318: /// Maps a binary operator to its precedence
319: pub fn operator_prec(op: ast::BinOp) -> uint {
320: match op {
libsyntax/parse/parser.rs:
1687: pub fn mk_assign_op(&mut self, binop: ast::BinOp, lhs: @Expr, rhs: @Expr) -> ast::Expr_ {
1688: ExprAssignOp(binop, lhs, rhs)
libsyntax/parse/token.rs:
503: */
504: pub fn token_to_binop(tok: &Token) -> Option<ast::BinOp> {
505: match *tok {
libsyntax/ext/deriving/generic.rs:
1255: pub fn cs_binop(binop: ast::BinOp, base: @Expr,
1256: enum_nonmatch_f: EnumNonMatchFunc,
libsyntax/ext/build.rs:
510: fn expr_binary(&self, sp: Span, op: ast::BinOp,
511: lhs: @ast::Expr, rhs: @ast::Expr) -> @ast::Expr {
libsyntax/ast.rs:
373: pub enum BinOp {
libsyntax/ast.rs:938:60-938:60 -struct- definition:
pub struct VariantArg {
pub ty: P<Ty>,
pub id: NodeId,
references:- 26939: pub struct VariantArg {
libsyntax/fold.rs:
544: let id = folder.new_id(va.id);
545: ast::VariantArg {
546: ty: folder.fold_ty(va.ty),
libsyntax/parse/parser.rs:
4441: for ty in arg_tys.move_iter() {
4442: args.push(ast::VariantArg {
4443: ty: ty,
libsyntax/ext/build.rs:
861: let args = tys.move_iter().map(|ty| {
862: ast::VariantArg { ty: ty, id: ast::DUMMY_NODE_ID }
863: }).collect();
libsyntax/ast.rs:
939: pub struct VariantArg {
--
945: pub enum VariantKind {
946: TupleVariantKind(Vec<VariantArg>),
947: StructVariantKind(@StructDef),
libsyntax/fold.rs:
543: fn fold_variant_arg_<T: Folder>(va: &VariantArg, folder: &mut T) -> VariantArg {
544: let id = folder.new_id(va.id);
libsyntax/ast.rs:
939: pub struct VariantArg {
libsyntax/ast.rs:423:53-423:53 -struct- definition:
pub struct Local {
pub ty: P<Ty>,
pub pat: @Pat,
references:- 31libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:26:72-26:72 -NK_AS_STR_TODO- definition:
/// A pointer abstraction. FIXME(eddyb) #10676 use Rc<T> in the future.
pub type P<T> = @T;
/// Construct a P<T> from a T value.
references:- 170libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/parse/token.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/deriving/ty.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:459:60-459:60 -enum- definition:
pub enum BlockCheckMode {
DefaultBlock,
UnsafeBlock(UnsafeSource),
references:- 14460: pub enum BlockCheckMode {
libsyntax/parse/parser.rs:
3242: // some blocks start with "#{"...
3243: fn parse_block_tail(&mut self, lo: BytePos, s: BlockCheckMode) -> P<Block> {
3244: self.parse_block_tail_(lo, s, Vec::new())
--
3247: // parse the rest of a block expression or function body
3248: fn parse_block_tail_(&mut self, lo: BytePos, s: BlockCheckMode,
3249: first_item_attrs: Vec<Attribute> ) -> P<Block> {
libsyntax/ast.rs:
460: pub enum BlockCheckMode {
libsyntax/ast.rs:1133:53-1133:53 -struct- definition:
pub struct ForeignItem {
pub ident: Ident,
pub attrs: Vec<Attribute>,
references:- 36libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ast.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ast_util.rs:
libsyntax/ast.rs:867:60-867:60 -struct- definition:
pub struct FnDecl {
pub inputs: Vec<Arg>,
pub output: P<Ty>,
references:- 68libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast.rs:793:53-793:53 -struct- definition:
pub struct BareFnTy {
pub fn_style: FnStyle,
pub abi: Abi,
references:- 19794: pub struct BareFnTy {
libsyntax/fold.rs:
180: TyBareFn(ref f) => {
181: TyBareFn(@BareFnTy {
182: lifetimes: f.lifetimes.iter().map(|l| self.fold_lifetime(l)).collect(),
libsyntax/parse/parser.rs:
917: let (decl, lifetimes) = self.parse_ty_fn_decl(true);
918: return TyBareFn(@BareFnTy {
919: abi: abi,
libsyntax/ast.rs:
794: pub struct BareFnTy {
--
812: TyProc(@ClosureTy),
813: TyBareFn(@BareFnTy),
814: TyTup(Vec<P<Ty>> ),
libsyntax/ast.rs:931:60-931:60 -struct- definition:
pub struct ForeignMod {
pub abi: Abi,
pub view_items: Vec<ViewItem>,
references:- 27932: pub struct ForeignMod {
libsyntax/fold.rs:
211: fn fold_foreign_mod(&mut self, nm: &ForeignMod) -> ForeignMod {
212: ast::ForeignMod {
213: abi: nm.abi,
libsyntax/parse/parser.rs:
4304: assert!(self.token == token::RBRACE);
4305: ast::ForeignMod {
4306: abi: abi,
libsyntax/ast.rs:
932: pub struct ForeignMod {
--
1119: ItemMod(Mod),
1120: ItemForeignMod(ForeignMod),
1121: ItemTy(P<Ty>, Generics),
libsyntax/fold.rs:
211: fn fold_foreign_mod(&mut self, nm: &ForeignMod) -> ForeignMod {
212: ast::ForeignMod {
libsyntax/parse/parser.rs:
4292: first_item_attrs: Vec<Attribute> )
4293: -> ForeignMod {
4294: let ParsedItemsAndViewItems {
libsyntax/print/pprust.rs:
430: pub fn print_foreign_mod(&mut self, nmod: &ast::ForeignMod,
431: attrs: &[ast::Attribute]) -> IoResult<()> {
libsyntax/ast.rs:
932: pub struct ForeignMod {
libsyntax/ast.rs:801:60-801:60 -enum- definition:
pub enum Ty_ {
TyNil,
TyBot, /* bottom type */
references:- 17802: pub enum Ty_ {
libsyntax/parse/parser.rs:
889: // parse a TyBareFn type:
890: pub fn parse_ty_bare_fn(&mut self) -> Ty_ {
891: /*
--
927: // already have been parsed.
928: pub fn parse_proc_type(&mut self) -> Ty_ {
929: /*
--
1313: pub fn parse_borrowed_pointee(&mut self) -> Ty_ {
1314: // look for `&'lt` or `&'foo ` and interpret `foo` as the region name:
libsyntax/ext/build.rs:
49: fn ty(&self, span: Span, ty: ast::Ty_) -> P<ast::Ty>;
50: fn ty_path(&self, ast::Path, Option<OwnedSlice<ast::TyParamBound>>) -> P<ast::Ty>;
--
304: fn ty(&self, span: Span, ty: ast::Ty_) -> P<ast::Ty> {
305: P(ast::Ty {
libsyntax/ast.rs:
802: pub enum Ty_ {
libsyntax/ast.rs:747:60-747:60 -struct- definition:
pub struct Ty {
pub id: NodeId,
pub node: Ty_,
references:- 133libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/parse/token.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/quote.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/deriving/ty.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:471:60-471:60 -struct- definition:
pub struct Expr {
pub id: NodeId,
pub node: Expr_,
references:- 455libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/asm.rs:
libsyntax/ext/base.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/build.rs:
libsyntax/ext/concat_idents.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/mod.rs:
libsyntax/parse/parser.rs:
libsyntax/parse/token.rs:
libsyntax/parse/classify.rs:
libsyntax/parse/obsolete.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/base.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/quote.rs:
libsyntax/ext/deriving/clone.rs:
libsyntax/ext/deriving/encodable.rs:
libsyntax/ext/deriving/decodable.rs:
libsyntax/ext/deriving/hash.rs:
libsyntax/ext/deriving/rand.rs:
libsyntax/ext/deriving/show.rs:
libsyntax/ext/deriving/zero.rs:
libsyntax/ext/deriving/default.rs:
libsyntax/ext/deriving/primitive.rs:
libsyntax/ext/deriving/cmp/eq.rs:
libsyntax/ext/deriving/cmp/totaleq.rs:
libsyntax/ext/deriving/cmp/ord.rs:
libsyntax/ext/deriving/cmp/totalord.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/deriving/ty.rs:
libsyntax/ext/build.rs:
libsyntax/ext/tt/macro_rules.rs:
libsyntax/ext/format.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:904:1-904:1 -NK_AS_STR_TODO- definition:
pub type ExplicitSelf = Spanned<ExplicitSelf_>;
pub struct Method {
pub ident: Ident,
references:- 10911: pub generics: Generics,
912: pub explicit_self: ExplicitSelf,
913: pub fn_style: FnStyle,
libsyntax/visit.rs:
182: fn walk_explicit_self<E: Clone, V: Visitor<E>>(visitor: &mut V,
183: explicit_self: &ExplicitSelf,
184: env: E) {
libsyntax/fold.rs:
319: fn fold_explicit_self(&mut self, es: &ExplicitSelf) -> ExplicitSelf {
320: Spanned {
libsyntax/parse/parser.rs:
3563: fn parse_fn_decl_with_self(&mut self, parse_arg_fn: |&mut Parser| -> Arg)
3564: -> (ExplicitSelf, P<FnDecl>) {
3565: fn maybe_parse_borrowed_explicit_self(this: &mut Parser)
libsyntax/ext/deriving/generic.rs:
590: generics: &Generics,
591: explicit_self: ast::ExplicitSelf,
592: arg_types: Vec<(Ident, P<ast::Ty>)> ,
libsyntax/ext/deriving/ty.rs:
246: pub fn get_explicit_self(cx: &ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
247: -> (@Expr, ast::ExplicitSelf) {
248: let self_path = cx.expr_self(span);
libsyntax/visit.rs:
111: }
112: fn visit_explicit_self(&mut self, es: &ExplicitSelf, e: E) {
113: walk_explicit_self(self, es, e)
libsyntax/ast.rs:875:60-875:60 -enum- definition:
pub enum FnStyle {
UnsafeFn, // declared with "unsafe fn"
NormalFn, // declared with "fn"
references:- 28794: pub struct BareFnTy {
795: pub fn_style: FnStyle,
796: pub abi: Abi,
--
876: pub enum FnStyle {
--
912: pub explicit_self: ExplicitSelf,
913: pub fn_style: FnStyle,
914: pub decl: P<FnDecl>,
libsyntax/visit.rs:
31: // fn foo() or extern "Abi" fn foo()
32: FkItemFn(Ident, &'a Generics, FnStyle, Abi),
libsyntax/parse/parser.rs:
1026: pub fn parse_unsafety(&mut self) -> FnStyle {
1027: if self.eat_keyword(keywords::Unsafe) {
--
3790: // parse an item-position function declaration.
3791: fn parse_item_fn(&mut self, fn_style: FnStyle, abi: abi::Abi) -> ItemInfo {
3792: let (ident, generics) = self.parse_fn_header();
--
4277: // parse safe/unsafe and fn
4278: fn parse_fn_style(&mut self) -> FnStyle {
4279: if self.eat_keyword(keywords::Fn) { NormalFn }
libsyntax/print/pprust.rs:
2074: opt_region: &Option<ast::Lifetime>,
2075: fn_style: ast::FnStyle,
2076: onceness: ast::Onceness,
--
2348: pub fn print_opt_fn_style(&mut self,
2349: opt_fn_style: Option<ast::FnStyle>) -> IoResult<()> {
2350: match opt_fn_style {
--
2381: _opt_explicit_self: Option<ast::ExplicitSelf_>,
2382: opt_fn_style: Option<ast::FnStyle>,
2383: abi: abi::Abi,
--
2396: pub fn print_fn_style(&mut self, s: ast::FnStyle) -> IoResult<()> {
2397: match s {
libsyntax/ast.rs:
1117: ItemStatic(P<Ty>, Mutability, @Expr),
1118: ItemFn(P<FnDecl>, FnStyle, Abi, Generics, P<Block>),
1119: ItemMod(Mod),
libsyntax/ast.rs:675:53-675:53 -struct- definition:
pub struct TypeField {
pub ident: Ident,
pub mt: MutTy,
references:- 21676: pub struct TypeField {
libsyntax/parse/parser.rs:
1155: let hi = ty.span.hi;
1156: ast::TypeField {
1157: ident: id,
libsyntax/ext/build.rs:
352: fn ty_field_imm(&self, span: Span, name: Ident, ty: P<ast::Ty>) -> ast::TypeField {
353: ast::TypeField {
354: ident: name,
libsyntax/ast.rs:
676: pub struct TypeField {
libsyntax/parse/parser.rs:
1148: // now used only by obsolete record syntax parser...
1149: pub fn parse_ty_field(&mut self) -> TypeField {
1150: let lo = self.span.lo;
libsyntax/ext/build.rs:
352: fn ty_field_imm(&self, span: Span, name: Ident, ty: P<ast::Ty>) -> ast::TypeField {
353: ast::TypeField {
libsyntax/ast.rs:
676: pub struct TypeField {
libsyntax/ast.rs:972:1-972:1 -NK_AS_STR_TODO- definition:
pub type PathListIdent = Spanned<PathListIdent_>;
pub type ViewPath = Spanned<ViewPath_>;
pub enum ViewPath_ {
references:- 2libsyntax/parse/parser.rs:
495: pub fn parse_path_list_ident(&mut self) -> ast::PathListIdent {
496: let lo = self.span.lo;
libsyntax/ast.rs:
990: // foo::bar::{a,b,c}
991: ViewPathList(Path, Vec<PathListIdent> , NodeId)
992: }
libsyntax/ast.rs:127:60-127:60 -struct- definition:
pub struct Path {
pub span: Span,
/// A `::foo` path, is relative to the crate root rather than current
references:- 86libsyntax/ast_util.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/concat_idents.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/parse/token.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/deriving/cmp/totalord.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/deriving/ty.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:334:60-334:60 -enum- definition:
pub enum Pat_ {
PatWild,
PatWildMulti,
references:- 14335: pub enum Pat_ {
libsyntax/parse/parser.rs:
3011: binding_mode: ast::BindingMode)
3012: -> ast::Pat_ {
3013: if !is_plain_ident(&self.token) {
libsyntax/ext/build.rs:
699: fn pat(&self, span: Span, pat: ast::Pat_) -> @ast::Pat {
700: @ast::Pat { id: ast::DUMMY_NODE_ID, node: pat, span: span }
libsyntax/ast.rs:
335: pub enum Pat_ {
libsyntax/ast.rs:153:81-153:81 -struct- definition:
pub struct DefId {
pub krate: CrateNum,
pub node: NodeId,
references:- 65libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/ast.rs:
libsyntax/ast.rs:214:60-214:60 -enum- definition:
pub enum Def {
DefFn(DefId, FnStyle),
DefStaticMethod(/* method */ DefId, MethodProvenance, FnStyle),
references:- 13215: pub enum Def {
--
231: DefUpvar(NodeId, // id of closed over var
232: @Def, // closed over def
233: NodeId, // expr node that creates the closure
libsyntax/ast_util.rs:
55: pub fn variant_def_ids(d: Def) -> Option<(DefId, DefId)> {
56: match d {
--
64: pub fn def_id_of_def(d: Def) -> DefId {
65: match d {
libsyntax/ast.rs:
215: pub enum Def {
libsyntax/ast.rs:1066:60-1066:60 -struct- definition:
pub struct StructField_ {
pub kind: StructFieldKind,
pub id: NodeId,
references:- 251067: pub struct StructField_ {
libsyntax/fold.rs:
83: Spanned {
84: node: ast::StructField_ {
85: kind: sf.node.kind,
--
508: Spanned {
509: node: ast::StructField_ {
510: kind: f.node.kind,
libsyntax/parse/parser.rs:
3968: let lo = p.span.lo;
3969: let struct_field_ = ast::StructField_ {
3970: kind: UnnamedField(p.parse_visibility()),
libsyntax/ast.rs:
1074: pub type StructField = Spanned<StructField_>;
libsyntax/ast.rs:190:60-190:60 -struct- definition:
pub struct Generics {
pub lifetimes: Vec<Lifetime>,
pub ty_params: OwnedSlice<TyParam>,
references:- 95libsyntax/ast_util.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/deriving/ty.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/quote.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/deriving/ty.rs:
libsyntax/ext/build.rs:
libsyntax/visit.rs:
libsyntax/ast.rs:822:60-822:60 -enum- definition:
pub enum AsmDialect {
AsmAtt,
AsmIntel
references:- 11823: pub enum AsmDialect {
--
836: pub alignstack: bool,
837: pub dialect: AsmDialect
838: }
libsyntax/ast.rs:1073:1-1073:1 -NK_AS_STR_TODO- definition:
pub type StructField = Spanned<StructField_>;
pub enum StructFieldKind {
NamedField(Ident, Visibility),
references:- 141092: pub struct StructDef {
1093: pub fields: Vec<StructField>, /* fields, not including ctor */
1094: /* ID of the constructor. This is only used for tuple- or enum-like
libsyntax/ast_util.rs:
312: pub fn struct_field_visibility(field: ast::StructField) -> Visibility {
313: match field.node.kind {
--
546: fn visit_struct_field(&mut self, struct_field: &StructField, env: ()) {
547: self.operation.visit_id(struct_field.node.id);
libsyntax/visit.rs:
582: pub fn walk_struct_field<E: Clone, V: Visitor<E>>(visitor: &mut V,
583: struct_field: &StructField,
584: env: E) {
libsyntax/fold.rs:
506: fn fold_struct_field<T: Folder>(f: &StructField, fld: &mut T) -> StructField {
507: let id = fld.new_id(f.node.id);
libsyntax/parse/parser.rs:
4004: attrs: Vec<Attribute> )
4005: -> StructField {
4006: let a_var = self.parse_name_and_ty(vis, attrs);
--
4022: // parse an element of a struct definition
4023: fn parse_struct_decl_field(&mut self) -> StructField {
--
4398: fn parse_struct_def(&mut self) -> @StructDef {
4399: let mut fields: Vec<StructField> = Vec::new();
4400: while self.token != token::RBRACE {
libsyntax/fold.rs:
506: fn fold_struct_field<T: Folder>(f: &StructField, fld: &mut T) -> StructField {
507: let id = fld.new_id(f.node.id);
libsyntax/ast.rs:273:56-273:56 -enum- definition:
pub enum MetaItem_ {
MetaWord(InternedString),
MetaList(InternedString, Vec<@MetaItem> ),
references:- 10274: pub enum MetaItem_ {
--
281: impl Eq for MetaItem_ {
282: fn eq(&self, other: &MetaItem_) -> bool {
283: match *self {
libsyntax/ast.rs:994:60-994:60 -struct- definition:
pub struct ViewItem {
pub node: ViewItem_,
pub attrs: Vec<Attribute>,
references:- 62libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/base.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/build.rs:
libsyntax/fold.rs:
libsyntax/ast.rs:650:1-650:1 -NK_AS_STR_TODO- definition:
pub type Lit = Spanned<Lit_>;
pub enum Lit_ {
LitStr(InternedString, StrStyle),
references:- 7276: MetaList(InternedString, Vec<@MetaItem> ),
277: MetaNameValue(InternedString, Lit),
278: }
--
488: ExprUnary(UnOp, @Expr),
489: ExprLit(@Lit),
490: ExprCast(@Expr, P<Ty>),
libsyntax/parse/parser.rs:
1425: // matches lit = true | false | token_lit
1426: pub fn parse_lit(&mut self) -> Lit {
1427: let lo = self.span.lo;
libsyntax/print/pprust.rs:
231: pub fn lit_to_str(l: &ast::Lit) -> StrBuf {
232: to_str(|s| s.print_literal(l))
--
2196: pub fn print_literal(&mut self, lit: &ast::Lit) -> IoResult<()> {
2197: try!(self.maybe_print_comment(lit.span.lo));
libsyntax/attr.rs:
144: pub fn mk_name_value_item(name: InternedString, value: ast::Lit)
145: -> @MetaItem {
libsyntax/ast_util.rs:
734: // Returns true if this literal is a string and false otherwise.
735: pub fn lit_is_str(lit: @Lit) -> bool {
736: match lit.node {
libsyntax/ast.rs:431:1-431:1 -NK_AS_STR_TODO- definition:
pub type Decl = Spanned<Decl_>;
pub enum Decl_ {
// a local (let) binding:
references:- 7407: // could be an item or a local (let) binding:
408: StmtDecl(@Decl, NodeId),
libsyntax/visit.rs:
76: fn visit_pat(&mut self, p: &Pat, e: E) { walk_pat(self, p, e) }
77: fn visit_decl(&mut self, d: &Decl, e: E) { walk_decl(self, d, e) }
78: fn visit_expr(&mut self, ex: &Expr, e: E) { walk_expr(self, ex, e) }
--
615: pub fn walk_decl<E: Clone, V: Visitor<E>>(visitor: &mut V, declaration: &Decl, env: E) {
616: match declaration.node {
libsyntax/fold.rs:
131: fn fold_decl(&mut self, d: @Decl) -> SmallVector<@Decl> {
132: let node = match d.node {
libsyntax/parse/parser.rs:
3061: // parse a "let" stmt
3062: fn parse_let(&mut self) -> @Decl {
3063: let lo = self.span.lo;
libsyntax/print/pprust.rs:
1518: pub fn print_decl(&mut self, decl: &ast::Decl) -> IoResult<()> {
1519: try!(self.maybe_print_comment(decl.span.lo));
libsyntax/fold.rs:
131: fn fold_decl(&mut self, d: @Decl) -> SmallVector<@Decl> {
132: let node = match d.node {
libsyntax/ast.rs:623:60-623:60 -enum- definition:
pub enum Matcher_ {
// match one token
MatchTok(::parse::token::Token),
references:- 12624: pub enum Matcher_ {
libsyntax/ext/tt/macro_rules.rs:
197: // these spans won't matter, anyways
198: fn ms(m: Matcher_) -> Matcher {
199: Spanned {
libsyntax/ast.rs:
624: pub enum Matcher_ {
libsyntax/ast.rs:1152:53-1152:53 -enum- definition:
pub enum InlinedItem {
IIItem(@Item),
IIMethod(DefId /* impl id */, bool /* is provided */, @Method),
references:- 131151: // that we trans.
1153: pub enum InlinedItem {
libsyntax/ast_util.rs:
594: pub fn compute_id_range_for_inlined_item(item: &InlinedItem) -> IdRange {
595: let visitor = IdRangeComputingVisitor {
libsyntax/ast_map.rs:
612: fold_ops: F,
613: fold: |&mut Ctx<F>| -> InlinedItem)
614: -> InlinedItem {
615: let mut cx = Ctx {
libsyntax/visit.rs:
123: pub fn walk_inlined_item<E: Clone, V: Visitor<E>>(visitor: &mut V,
124: item: &ast::InlinedItem,
125: env: E) {
libsyntax/ast.rs:
1151: // that we trans.
1153: pub enum InlinedItem {
libsyntax/ast.rs:944:60-944:60 -enum- definition:
pub enum VariantKind {
TupleVariantKind(Vec<VariantArg>),
StructVariantKind(@StructDef),
references:- 11945: pub enum VariantKind {
--
958: pub attrs: Vec<Attribute>,
959: pub kind: VariantKind,
960: pub id: NodeId,
libsyntax/ast.rs:890:60-890:60 -enum- definition:
pub enum RetStyle {
NoReturn, // functions with return type _|_ that always
// raise an error or exit (i.e. never return to the caller)
references:- 12891: pub enum RetStyle {
libsyntax/parse/parser.rs:
1163: // parse optional return type [ -> TY ] in function decl
1164: pub fn parse_ret_ty(&mut self) -> (RetStyle, P<Ty>) {
1165: return if self.eat(&token::RARROW) {
libsyntax/ast.rs:
891: pub enum RetStyle {
libsyntax/ast.rs:260:41-260:41 -NK_AS_STR_TODO- definition:
// used to drive conditional compilation
pub type CrateConfig = Vec<@MetaItem> ;
pub struct Crate {
references:- 23266: pub attrs: Vec<Attribute>,
267: pub config: CrateConfig,
268: pub span: Span,
libsyntax/parse/mod.rs:
200: pub fn new_parser_from_tts<'a>(sess: &'a ParseSess,
201: cfg: ast::CrateConfig,
202: tts: Vec<ast::TokenTree>) -> Parser<'a> {
--
256: tts: Vec<ast::TokenTree>,
257: cfg: ast::CrateConfig) -> Parser<'a> {
258: let trdr = lexer::new_tt_reader(&sess.span_diagnostic, None, tts);
libsyntax/parse/parser.rs:
277: sess: &'a ParseSess,
278: cfg: ast::CrateConfig,
279: mut rdr: Box<Reader:>)
--
321: pub last_span: Span,
322: pub cfg: CrateConfig,
323: // the previous token or None (only stashed sometimes).
libsyntax/ext/base.rs:
414: pub fn parse_sess(&self) -> &'a parse::ParseSess { self.parse_sess }
415: pub fn cfg(&self) -> ast::CrateConfig { self.cfg.clone() }
416: pub fn call_site(&self) -> Span {
libsyntax/ext/tt/macro_parser.rs:
234: pub fn parse(sess: &ParseSess,
235: cfg: ast::CrateConfig,
236: mut rdr: TtReader,
libsyntax/parse/mod.rs:
115: source: StrBuf,
116: cfg: ast::CrateConfig,
117: sess: &ParseSess)
libsyntax/ast.rs:640:60-640:60 -enum- definition:
pub enum Mac_ {
MacInvocTT(Path, Vec<TokenTree> , SyntaxContext), // new macro-invocation
}
references:- 12639: // There's only one flavor, now, so this could presumably be simplified.
641: pub enum Mac_ {
libsyntax/parse/parser.rs:
1691: pub fn mk_mac_expr(&mut self, lo: BytePos, hi: BytePos, m: Mac_) -> @Expr {
1692: @Expr {
libsyntax/ast.rs:
639: // There's only one flavor, now, so this could presumably be simplified.
641: pub enum Mac_ {
libsyntax/ast.rs:450:60-450:60 -struct- definition:
pub struct Field {
pub ident: SpannedIdent,
pub expr: @Expr,
references:- 33libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast.rs:405:60-405:60 -enum- definition:
pub enum Stmt_ {
// could be an item or a local (let) binding:
StmtDecl(@Decl, NodeId),
references:- 11406: pub enum Stmt_ {
libsyntax/ast.rs:733:60-733:60 -enum- definition:
pub enum FloatTy {
TyF32,
TyF64,
references:- 15734: pub enum FloatTy {
--
740: impl fmt::Show for FloatTy {
741: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
libsyntax/ast_util.rs:
189: pub fn float_ty_to_str(t: FloatTy) -> StrBuf {
190: match t {
libsyntax/parse/token.rs:
85: LIT_INT_UNSUFFIXED(i64),
86: LIT_FLOAT(ast::Ident, ast::FloatTy),
87: LIT_FLOAT_UNSUFFIXED(ast::Ident),
libsyntax/ast.rs:
758: TyUint(UintTy),
759: TyFloat(FloatTy),
760: TyStr,
libsyntax/ast.rs:780:53-780:53 -struct- definition:
pub struct ClosureTy {
pub lifetimes: Vec<Lifetime>,
pub fn_style: FnStyle,
references:- 22781: pub struct ClosureTy {
libsyntax/fold.rs:
162: TyClosure(ref f, ref region) => {
163: TyClosure(@ClosureTy {
164: fn_style: f.fn_style,
--
171: TyProc(ref f) => {
172: TyProc(@ClosureTy {
173: fn_style: f.fn_style,
libsyntax/parse/parser.rs:
958: });
959: TyProc(@ClosureTy {
960: fn_style: NormalFn,
--
1017: TyClosure(@ClosureTy {
1018: fn_style: fn_style,
libsyntax/ast.rs:
781: pub struct ClosureTy {
--
811: TyClosure(@ClosureTy, Option<Lifetime>),
812: TyProc(@ClosureTy),
813: TyBareFn(@BareFnTy),
libsyntax/ast.rs:950:60-950:60 -struct- definition:
pub struct EnumDef {
pub variants: Vec<P<Variant>>,
}
references:- 35libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ast.rs:
libsyntax/visit.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast.rs:1018:60-1018:60 -enum- definition:
pub enum AttrStyle {
AttrOuter,
AttrInner,
references:- 121017: // distinguished for pretty-printing.
1019: pub enum AttrStyle {
--
1026: pub struct Attribute_ {
1027: pub style: AttrStyle,
1028: pub value: @MetaItem,
libsyntax/parse/comments.rs:
47: pub fn doc_comment_style(comment: &str) -> ast::AttrStyle {
48: assert!(is_doc_comment(comment));
libsyntax/ast.rs:
1017: // distinguished for pretty-printing.
1019: pub enum AttrStyle {
libsyntax/ast.rs:173:60-173:60 -enum- definition:
pub enum TyParamBound {
TraitTyParamBound(TraitRef),
StaticRegionTyParamBound,
references:- 30libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast.rs:148:1-148:1 -NK_AS_STR_TODO- definition:
pub type CrateNum = u32;
pub type NodeId = u32;
pub struct DefId {
references:- 2154: pub struct DefId {
155: pub krate: CrateNum,
156: pub node: NodeId,
--
160: /// LOCAL_CRATE in their DefId.
161: pub static LOCAL_CRATE: CrateNum = 0;
162: pub static CRATE_NODE_ID: NodeId = 0;
libsyntax/ast.rs:251:66-251:66 -enum- definition:
pub enum DefRegion {
DefStaticRegion,
DefEarlyBoundRegion(/* index */ uint, /* lifetime decl */ NodeId),
references:- 11252: pub enum DefRegion {
libsyntax/ast.rs:645:60-645:60 -enum- definition:
pub enum StrStyle {
CookedStr,
RawStr(uint)
references:- 17646: pub enum StrStyle {
--
654: pub enum Lit_ {
655: LitStr(InternedString, StrStyle),
656: LitBinary(Rc<Vec<u8> >),
--
830: pub asm: InternedString,
831: pub asm_str_style: StrStyle,
832: pub clobbers: InternedString,
--
1007: // For example, extern crate whatever = "github.com/mozilla/rust"
1008: ViewItemExternCrate(Ident, Option<(InternedString,StrStyle)>, NodeId),
1009: ViewItemUse(@ViewPath),
libsyntax/parse/parser.rs:
5117: pub fn parse_str(&mut self) -> (InternedString, StrStyle) {
5118: match self.parse_optional_str() {
libsyntax/print/pprust.rs:
2325: pub fn print_string(&mut self, st: &str,
2326: style: ast::StrStyle) -> IoResult<()> {
2327: let st = match style {
libsyntax/ext/base.rs:
509: pub fn expr_to_str(cx: &mut ExtCtxt, expr: @ast::Expr, err_msg: &str)
510: -> Option<(InternedString, ast::StrStyle)> {
511: // we want to be able to handle e.g. concat("foo", "bar")
libsyntax/ast.rs:
646: pub enum StrStyle {
libsyntax/ast.rs:402:1-402:1 -NK_AS_STR_TODO- definition:
pub type Stmt = Spanned<Stmt_>;
pub enum Stmt_ {
// could be an item or a local (let) binding:
references:- 54libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/mod.rs:
libsyntax/parse/parser.rs:
libsyntax/parse/token.rs:
libsyntax/parse/classify.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/base.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/quote.rs:
libsyntax/ext/build.rs:
libsyntax/ext/tt/macro_rules.rs:
libsyntax/ast_util.rs:
libsyntax/ast.rs:1060:60-1060:60 -enum- definition:
pub enum Sized {
DynSize,
StaticSize,
references:- 181061: pub enum Sized {
--
1123: ItemStruct(@StructDef, Generics),
1124: ItemTrait(Generics, Sized, Vec<TraitRef> , Vec<TraitMethod> ),
1125: ItemImpl(Generics,
libsyntax/parse/parser.rs:
4045: fn parse_for_sized(&mut self) -> Sized {
4046: if self.eat_keyword(keywords::For) {
libsyntax/ext/deriving/ty.rs:
190: fn mk_ty_param(cx: &ExtCtxt, span: Span, name: &str, sized: ast::Sized, bounds: &[Path],
191: self_ident: Ident, self_generics: &Generics) -> ast::TyParam {
--
209: pub lifetimes: Vec<&'a str>,
210: pub bounds: Vec<(&'a str, ast::Sized, Vec<Path<'a>>)>,
211: }
libsyntax/ext/build.rs:
70: id: ast::Ident,
71: sized: ast::Sized,
72: bounds: OwnedSlice<ast::TyParamBound>,
--
374: id: ast::Ident,
375: sized: ast::Sized,
376: bounds: OwnedSlice<ast::TyParamBound>,
libsyntax/ast.rs:
1061: pub enum Sized {
libsyntax/ast.rs:977:53-977:53 -enum- definition:
pub enum ViewPath_ {
// quux = foo::bar::baz
//
references:- 9978: pub enum ViewPath_ {
libsyntax/ast.rs:150:1-150:1 -NK_AS_STR_TODO- definition:
pub type NodeId = u32;
pub struct DefId {
pub krate: CrateNum,
references:- 109libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/ext/registrar.rs:
libsyntax/ext/build.rs:
libsyntax/visit.rs:
libsyntax/ast.rs:208:60-208:60 -enum- definition:
pub enum MethodProvenance {
FromTrait(DefId),
FromImpl(DefId),
references:- 11216: DefFn(DefId, FnStyle),
217: DefStaticMethod(/* method */ DefId, MethodProvenance, FnStyle),
218: DefSelfTy(/* trait id */ NodeId),
libsyntax/ast.rs:328:60-328:60 -enum- definition:
pub enum BindingMode {
BindByRef(Mutability),
BindByValue(Mutability),
references:- 17329: pub enum BindingMode {
--
344: // set (of "pat_idents that refer to nullary enums")
345: PatIdent(BindingMode, Path, Option<@Pat>),
346: PatEnum(Path, Option<Vec<@Pat> >), /* "none" means a * pattern where
libsyntax/parse/parser.rs:
3010: fn parse_pat_ident(&mut self,
3011: binding_mode: ast::BindingMode)
3012: -> ast::Pat_ {
libsyntax/ext/build.rs:
714: ident: ast::Ident,
715: bm: ast::BindingMode) -> @ast::Pat {
716: let path = self.path_ident(span, ident);
libsyntax/ast.rs:
329: pub enum BindingMode {
libsyntax/ast.rs:359:66-359:66 -enum- definition:
pub enum Mutability {
MutMutable,
MutImmutable,
references:- 29360: pub enum Mutability {
--
900: SelfValue, // `self`
901: SelfRegion(Option<Lifetime>, Mutability), // `&'lt self`, `&'lt mut self`
902: SelfUniq // `~self`
--
1116: pub enum Item_ {
1117: ItemStatic(P<Ty>, Mutability, @Expr),
1118: ItemFn(P<FnDecl>, FnStyle, Abi, Generics, P<Block>),
libsyntax/parse/parser.rs:
1625: // parse mutability declaration (mut/const/imm)
1626: pub fn parse_mutability(&mut self) -> Mutability {
1627: if self.eat_keyword(keywords::Mut) {
libsyntax/print/pprust.rs:
2034: pub fn print_mutability(&mut self,
2035: mutbl: ast::Mutability) -> IoResult<()> {
2036: match mutbl {
libsyntax/ext/deriving/generic.rs:
1024: field_paths: Vec<ast::Path> ,
1025: mutbl: ast::Mutability)
1026: -> Vec<@ast::Pat> {
--
1098: prefix: &str,
1099: mutbl: ast::Mutability)
1100: -> (@ast::Pat, Vec<(Span, Option<Ident>, @Expr)> ) {
libsyntax/ext/deriving/ty.rs:
26: Send, // ~
27: Borrowed(Option<&'a str>, ast::Mutability), // &['lifetime] [mut]
28: }
libsyntax/ext/build.rs:
46: // types
47: fn ty_mt(&self, ty: P<ast::Ty>, mutbl: ast::Mutability) -> ast::MutTy;
--
297: fn ty_mt(&self, ty: P<ast::Ty>, mutbl: ast::Mutability) -> ast::MutTy {
298: ast::MutTy {
--
328: lifetime: Option<ast::Lifetime>,
329: mutbl: ast::Mutability)
330: -> P<ast::Ty> {
libsyntax/ast.rs:
360: pub enum Mutability {
libsyntax/ast.rs:89:12-89:12 -NK_AS_STR_TODO- definition:
// storage.
pub type SyntaxContext = u32;
pub static EMPTY_CTXT : SyntaxContext = 0;
references:- 2490: pub type SyntaxContext = u32;
91: pub static EMPTY_CTXT : SyntaxContext = 0;
92: pub static ILLEGAL_CTXT : SyntaxContext = 1;
--
641: pub enum Mac_ {
642: MacInvocTT(Path, Vec<TokenTree> , SyntaxContext), // new macro-invocation
643: }
libsyntax/ext/mtwt.rs:
35: table: RefCell<Vec<SyntaxContext_>>,
36: mark_memo: RefCell<HashMap<(SyntaxContext,Mrk),SyntaxContext>>,
37: rename_memo: RefCell<HashMap<(SyntaxContext,Ident,Name),SyntaxContext>>,
--
146: type ResolveTable = HashMap<(Name,SyntaxContext),Name>;
--
244: /// FAILS when outside is not a mark.
245: pub fn outer_mark(ctxt: SyntaxContext) -> Mrk {
246: with_sctable(|sctable| {
libsyntax/ast.rs:434:53-434:53 -enum- definition:
pub enum Decl_ {
// a local (let) binding:
DeclLocal(@Local),
references:- 9432: pub type Decl = Spanned<Decl_>;
435: pub enum Decl_ {
libsyntax/ast.rs:270:1-270:1 -NK_AS_STR_TODO- definition:
pub type MetaItem = Spanned<MetaItem_>;
pub enum MetaItem_ {
MetaWord(InternedString),
references:- 69libsyntax/fold.rs:
libsyntax/parse/mod.rs:
libsyntax/parse/token.rs:
libsyntax/parse/attr.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/base.rs:
libsyntax/ext/deriving/mod.rs:
libsyntax/ext/deriving/bounds.rs:
libsyntax/ext/deriving/clone.rs:
libsyntax/ext/deriving/encodable.rs:
libsyntax/ext/deriving/decodable.rs:
libsyntax/ext/deriving/hash.rs:
libsyntax/ext/deriving/rand.rs:
libsyntax/ext/deriving/show.rs:
libsyntax/ext/deriving/zero.rs:
libsyntax/ext/deriving/default.rs:
libsyntax/ext/deriving/primitive.rs:
libsyntax/ext/deriving/cmp/eq.rs:
libsyntax/ext/deriving/cmp/totaleq.rs:
libsyntax/ext/deriving/cmp/ord.rs:
libsyntax/ext/deriving/cmp/totalord.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/build.rs:
libsyntax/attr.rs:
libsyntax/parse/attr.rs:
libsyntax/ast.rs:365:60-365:60 -enum- definition:
pub enum ExprVstore {
ExprVstoreUniq, // ~[1,2,3,4]
ExprVstoreSlice, // &[1,2,3,4]
references:- 14479: pub enum Expr_ {
480: ExprVstore(@Expr, ExprVstore),
481: // First expr is the place; second expr is the value.
libsyntax/print/pprust.rs:
1122: pub fn print_expr_vstore(&mut self, t: ast::ExprVstore) -> IoResult<()> {
1123: match t {
libsyntax/ext/build.rs:
134: fn expr_vstore(&self, sp: Span, expr: @ast::Expr, vst: ast::ExprVstore) -> @ast::Expr;
135: fn expr_vec(&self, sp: Span, exprs: Vec<@ast::Expr> ) -> @ast::Expr;
--
585: fn expr_vstore(&self, sp: Span, expr: @ast::Expr, vst: ast::ExprVstore) -> @ast::Expr {
586: self.expr(sp, ast::ExprVstore(expr, vst))
libsyntax/ast.rs:
366: pub enum ExprVstore {
libsyntax/ast.rs:1012:37-1012:37 -NK_AS_STR_TODO- definition:
// Meta-data associated with an item
pub type Attribute = Spanned<Attribute_>;
// Distinguishes between Attributes that decorate items and Attributes that
references:- 84libsyntax/ast_map.rs:
libsyntax/fold.rs:
libsyntax/parse/mod.rs:
libsyntax/parse/parser.rs:
libsyntax/parse/attr.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/build.rs:
libsyntax/ext/format.rs:
libsyntax/attr.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:116:60-116:60 -struct- definition:
pub struct Lifetime {
pub id: NodeId,
pub span: Span,
references:- 70libsyntax/ast_util.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/deriving/ty.rs:
libsyntax/ext/build.rs:
libsyntax/parse/parser.rs:
libsyntax/ast.rs:263:60-263:60 -struct- definition:
pub struct Crate {
pub module: Mod,
pub attrs: Vec<Attribute>,
references:- 37libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ast.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/mod.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/registrar.rs:
libsyntax/ast_util.rs:
libsyntax/ast.rs:41:55-41:55 -struct- definition:
pub struct Ident {
pub name: Name,
pub ctxt: SyntaxContext
references:- 328libsyntax/parse/token.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/mtwt.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/parse/token.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/base.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/quote.rs:
libsyntax/ext/deriving/decodable.rs:
libsyntax/ext/deriving/rand.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/deriving/ty.rs:
libsyntax/ext/build.rs:
libsyntax/ext/tt/transcribe.rs:
libsyntax/ext/tt/macro_parser.rs:
libsyntax/ext/tt/macro_rules.rs:
libsyntax/ext/mtwt.rs:
libsyntax/ext/format.rs:
libsyntax/ast.rs:
libsyntax/ast.rs:955:60-955:60 -struct- definition:
pub struct Variant_ {
pub name: Ident,
pub attrs: Vec<Attribute>,
references:- 24956: pub struct Variant_ {
libsyntax/fold.rs:
252: };
253: let node = ast::Variant_ {
254: name: v.node.name,
libsyntax/parse/parser.rs:
4456: let vr = ast::Variant_ {
4457: name: ident,
libsyntax/ext/build.rs:
865: respan(span,
866: ast::Variant_ {
867: name: name,
libsyntax/ast.rs:
956: pub struct Variant_ {
--
965: pub type Variant = Spanned<Variant_>;
libsyntax/ast.rs:29:37-29:37 -fn- definition:
/// Construct a P<T> from a T value.
pub fn P<T: 'static>(value: T) -> P<T> {
@value
references:- 34libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/build.rs:
libsyntax/ext/format.rs:
libsyntax/ast.rs:907:53-907:53 -struct- definition:
pub struct Method {
pub ident: Ident,
pub attrs: Vec<Attribute>,
references:- 41libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ast.rs:
libsyntax/ast.rs:840:60-840:60 -struct- definition:
pub struct Arg {
pub ty: P<Ty>,
pub pat: @Pat,
references:- 45libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/build.rs:
libsyntax/parse/parser.rs:
libsyntax/ast.rs:964:1-964:1 -NK_AS_STR_TODO- definition:
pub type Variant = Spanned<Variant_>;
pub struct PathListIdent_ {
pub name: Ident,
references:- 18951: pub struct EnumDef {
952: pub variants: Vec<P<Variant>>,
953: }
libsyntax/ast_map.rs:
124: EntryMethod(NodeId, @Method),
125: EntryVariant(NodeId, P<Variant>),
126: EntryExpr(NodeId, @Expr),
--
286: pub fn expect_variant(&self, id: NodeId) -> P<Variant> {
287: match self.find(id) {
libsyntax/visit.rs:
90: fn visit_struct_field(&mut self, s: &StructField, e: E) { walk_struct_field(self, s, e) }
91: fn visit_variant(&mut self, v: &Variant, g: &Generics, e: E) { walk_variant(self, v, g, e) }
92: fn visit_opt_lifetime_ref(&mut self,
libsyntax/fold.rs:
225: fn fold_variant(&mut self, v: &Variant) -> P<Variant> {
226: let id = self.new_id(v.node.id);
libsyntax/print/pprust.rs:
870: pub fn print_variant(&mut self, v: &ast::Variant) -> IoResult<()> {
871: try!(self.print_visibility(v.node.vis));
libsyntax/ext/deriving/generic.rs:
1096: cx: &mut ExtCtxt,
1097: variant: &ast::Variant,
1098: prefix: &str,
libsyntax/ext/build.rs:
860: fn variant(&self, span: Span, name: Ident, tys: Vec<P<ast::Ty>> ) -> ast::Variant {
861: let args = tys.move_iter().map(|ty| {
libsyntax/visit.rs:
282: pub fn walk_variant<E: Clone, V: Visitor<E>>(visitor: &mut V,
283: variant: &Variant,
284: generics: &Generics,
libsyntax/ast.rs:765:60-765:60 -enum- definition:
pub enum Onceness {
Once,
Many
references:- 14766: pub enum Onceness {
--
771: impl fmt::Show for Onceness {
772: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
--
783: pub fn_style: FnStyle,
784: pub onceness: Onceness,
785: pub decl: P<FnDecl>,
libsyntax/print/pprust.rs:
2075: fn_style: ast::FnStyle,
2076: onceness: ast::Onceness,
2077: decl: &ast::FnDecl,
--
2403: pub fn print_onceness(&mut self, o: ast::Onceness) -> IoResult<()> {
2404: match o {
libsyntax/ast.rs:
766: pub enum Onceness {
libsyntax/ast.rs:1105:60-1105:60 -struct- definition:
pub struct Item {
pub ident: Ident,
pub attrs: Vec<Attribute>,
references:- 137libsyntax/fold.rs:
libsyntax/parse/parser.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/build.rs:
libsyntax/ast.rs:
libsyntax/ast_util.rs:
libsyntax/ast_map.rs:
libsyntax/visit.rs:
libsyntax/fold.rs:
libsyntax/parse/mod.rs:
libsyntax/parse/parser.rs:
libsyntax/parse/token.rs:
libsyntax/print/pprust.rs:
libsyntax/ext/base.rs:
libsyntax/ext/expand.rs:
libsyntax/ext/registrar.rs:
libsyntax/ext/quote.rs:
libsyntax/ext/deriving/mod.rs:
libsyntax/ext/deriving/bounds.rs:
libsyntax/ext/deriving/clone.rs:
libsyntax/ext/deriving/encodable.rs:
libsyntax/ext/deriving/decodable.rs:
libsyntax/ext/deriving/hash.rs:
libsyntax/ext/deriving/rand.rs:
libsyntax/ext/deriving/show.rs:
libsyntax/ext/deriving/zero.rs:
libsyntax/ext/deriving/default.rs:
libsyntax/ext/deriving/primitive.rs:
libsyntax/ext/deriving/cmp/eq.rs:
libsyntax/ext/deriving/cmp/totaleq.rs:
libsyntax/ext/deriving/cmp/ord.rs:
libsyntax/ext/deriving/cmp/totalord.rs:
libsyntax/ext/deriving/generic.rs:
libsyntax/ext/build.rs:
libsyntax/ext/tt/macro_rules.rs:
libsyntax/ext/format.rs:
libsyntax/ext/deriving/cmp/totalord.rs:
libsyntax/ast.rs:718:60-718:60 -enum- definition:
pub enum UintTy {
TyU,
TyU8,
references:- 18719: pub enum UintTy {
--
727: impl fmt::Show for UintTy {
728: fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
--
757: TyInt(IntTy),
758: TyUint(UintTy),
759: TyFloat(FloatTy),
libsyntax/ast_util.rs:
163: // We want to avoid "42uint" in favor of "42u"
164: pub fn uint_ty_to_str(t: UintTy, val: Option<u64>) -> StrBuf {
165: let s = match t {
libsyntax/parse/lexer.rs:
521: if c == 'u' || c == 'i' {
522: enum Result { Signed(ast::IntTy), Unsigned(ast::UintTy) }
523: let signed = c == 'i';
libsyntax/parse/token.rs:
83: LIT_INT(i64, ast::IntTy),
84: LIT_UINT(u64, ast::UintTy),
85: LIT_INT_UNSUFFIXED(i64),
libsyntax/attr.rs:
479: SignedInt(ast::IntTy),
480: UnsignedInt(ast::UintTy)
481: }
libsyntax/ast_util.rs:
180: pub fn uint_ty_max(t: UintTy) -> u64 {
181: match t {
libsyntax/ast.rs:465:60-465:60 -enum- definition:
pub enum UnsafeSource {
CompilerGenerated,
UserProvided,
references:- 11466: pub enum UnsafeSource {