about summary refs log tree commit diff
path: root/src/libsyntax/visit.rs
AgeCommit message (Collapse)AuthorLines
2017-01-11syntax: struct field attributes and cfgBenjamin Saunders-0/+2
2016-12-19Optimize `ast::PathSegment`.Jeffrey Seyfried-1/+3
2016-12-18Remove `MacroDef`'s fields `imported_from` and `allow_internal_unstable`,Jeffrey Seyfried-1/+0
remove `export` argument of `resolver.add_macro()`.
2016-12-06annotate stricter lifetimes on LateLintPass methods to allow them to forward ↵Oliver Schneider-81/+94
to a Visitor
2016-11-21Implement the `loop_break_value` feature.Geoffry Song-1/+5
This implements RFC 1624, tracking issue #37339. - `FnCtxt` (in typeck) gets a stack of `LoopCtxt`s, which store the currently deduced type of that loop, the desired type, and a list of break expressions currently seen. `loop` loops get a fresh type variable as their initial type (this logic is stolen from that for arrays). `while` loops get `()`. - `break {expr}` looks up the broken loop, and unifies the type of `expr` with the type of the loop. - `break` with no expr unifies the loop's type with `()`. - When building MIR, `loop` loops no longer construct a `()` value at termination of the loop; rather, the `break` expression assigns the result of the loop. `while` loops are unchanged. - `break` respects contexts in which expressions may not end with braced blocks. That is, `while break { break-value } { while-body }` is illegal; this preserves backwards compatibility. - The RFC did not make it clear, but I chose to make `break ()` inside of a `while` loop illegal, just in case we wanted to do anything with that design space in the future. This is my first time dealing with this part of rustc so I'm sure there's plenty of problems to pick on here ^_^
2016-11-10syntax: don't fake a block around closures' bodies during parsing.Eduard Burtescu-27/+26
2016-10-01Rollup merge of #34764 - pnkfelix:attrs-on-generic-formals, r=eddybManish Goregaokar-0/+2
First step for #34761
2016-09-28libsyntax: clearer names for some AST partsJonas Schievink-3/+3
This applies the HIR changes from the previous commits to the AST, and is thus a syntax-[breaking-change] Renames `PatKind::Vec` to `PatKind::Slice`, since these are called slice patterns, not vec patterns. Renames `TyKind::Vec`, which represents the type `[T]`, to `TyKind::Slice`. Renames `TyKind::FixedLengthVec` to `TyKind::Array`.
2016-09-23Add attribute support to generic lifetime and type parameters.Felix S. Klock II-0/+2
I am using `ThinAttributes` rather than a vector for attributes attached to generics, since I expect almost all lifetime and types parameters to not carry any attributes.
2016-09-17Ensure that macro invocations are folded and visited the same order.Jeffrey Seyfried-5/+5
2016-08-29Future proof the AST for `union`.Jeffrey Seyfried-1/+2
2016-08-28Rollup merge of #35480 - KiChjang:e0379-bonus, r=nikomatsakisJeffrey Seyfried-1/+1
Move E0379 check from typeck to ast validation Part of #35233. Extension of #35338, #35364. Fixes #35404.
2016-08-27Change Constness to Spanned<Constness>Keith Yeung-1/+1
2016-08-21Refactor away variant `ast::PathListItemKind::Mod`Jeffrey Seyfried-2/+2
and refactor `ast::PathListItemKind::Ident` -> `ast::PathListItem_`.
2016-08-13Minor fixup.Andrew Cann-2/+1
2016-08-13Rename empty/bang to neverAndrew Cann-1/+1
Split Ty::is_empty method into is_never and is_uninhabited
2016-08-13Control usage of `!` through a feature gate.Andrew Cann-2/+6
Adds the `bang_type` feature gate. `!` in a non-return-type position now relies on that feature.
2016-08-13Start implementation of RFC 1216 (make ! a type)Andrew Cann-0/+1
Add `TyKind::Empty` and fix resulting build errors.
2016-08-12syntax: add anonymized type syntax, i.e. impl TraitA+TraitB.Eduard Burtescu-0/+3
2016-06-26Rollup merge of #34436 - jseyfried:no_block_expr, r=eddybJeffrey Seyfried-1/+0
To allow these braced macro invocation, this PR removes the optional expression from `ast::Block` and instead uses a `StmtKind::Expr` at the end of the statement list. Currently, braced macro invocations in blocks can expand into statements (and items) except when they are last in a block, in which case they can only expand into expressions. For example, ```rust macro_rules! make_stmt { () => { let x = 0; } } fn f() { make_stmt! {} //< This is OK... let x = 0; //< ... unless this line is commented out. } ``` Fixes #34418.
2016-06-26Rollup merge of #34339 - jseyfried:thin_vec, r=petrochenkov,ManishearthJeffrey Seyfried-4/+3
Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>`.
2016-06-26Rollup merge of #34316 - jseyfried:refactor_ast_stmt, r=eddybJeffrey Seyfried-12/+6
Refactor away `ast::Decl`, refactor `ast::Stmt`, and rename `ast::ExprKind::Again` to `ast::ExprKind::Continue`.
2016-06-26Rollup merge of #33943 - jseyfried:libsyntax_cleanup, r=nrcJeffrey Seyfried-109/+90
Miscellaneous low priority cleanup in `libsyntax`.
2016-06-25Rollup merge of #34403 - jonathandturner:move_liberror, r=alexcrichtonJeffrey Seyfried-1/+2
This PR refactors the 'errors' part of libsyntax into its own crate (librustc_errors). This is the first part of a few refactorings to simplify error reporting and potentially support more output formats (like a standardized JSON output and possibly an --explain mode that can work with the user's code), though this PR stands on its own and doesn't assume further changes. As part of separating out the errors crate, I have also refactored the code position portion of codemap into its own crate (libsyntax_pos). While it's helpful to have the common code positions in a separate crate for the new errors crate, this may also enable further simplifications in the future.
2016-06-25Rollup merge of #34368 - petrochenkov:astqpath, r=ManishearthJeffrey Seyfried-5/+4
The AST part of https://github.com/rust-lang/rust/pull/34365 plugin-[breaking-change] cc https://github.com/rust-lang/rust/issues/31645
2016-06-25Rollup merge of #34213 - josephDunne:trait_item_macros, r=jseyfriedJeffrey Seyfried-0/+3
**syntax-[breaking-change]** cc #31645 New `TraitItemKind::Macro` variant This change adds support for macro expansion inside trait items by adding the new `TraitItemKind::Macro` and associated parsing code.
2016-06-23Remove field `expr` of `ast::Block`Jeffrey Seyfried-1/+0
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-1/+2
2016-06-20Merge PatKind::QPath into PatKind::Path in ASTVadim Petrochenkov-5/+4
2016-06-19Generalize and abstract `ThinAttributes`Jeffrey Seyfried-4/+3
2016-06-17Rename `ast::ExprKind::Again` -> `ast::ExprKind::Continue`Jeffrey Seyfried-1/+1
2016-06-17Fix falloutJeffrey Seyfried-11/+5
2016-06-14Remove the type parameter from `syntax::visit::Visitor`Jeffrey Seyfried-109/+90
2016-06-13Add support for macro expansion inside trait itemsJoseph Dunne-0/+3
2016-06-10Visit statement and expression attributesJeffrey Seyfried-0/+6
2016-05-28Rollup merge of #33854 - petrochenkov:prefvis, r=eddybManish Goregaokar-11/+4
Apply visit_path to import prefixes by default Overriding `visit_path` is not enough to visit all paths, some import prefixes are not visited and `visit_path_list_item` need to be overridden as well. This PR removes this catch, it should be less error prone this way. Also, the prefix is visited once now, not repeatedly for each path list item. r? @eddyb
2016-05-27Rollup merge of #33644 - petrochenkov:selfast, r=nrcManish Goregaokar-24/+1
The AST part of https://github.com/rust-lang/rust/pull/33505. https://github.com/rust-lang/rust/pull/33505 isn't landed yet, so this PR is based on top of it. r? @nrc plugin-[breaking-change] cc #31645 @Manishearth
2016-05-27Rollup merge of #33639 - petrochenkov:dotdot, r=nmatsakisManish Goregaokar-5/+3
cc https://github.com/rust-lang/rust/issues/33627 r? @nikomatsakis plugin-[breaking-change] cc https://github.com/rust-lang/rust/issues/31645 @Manishearth
2016-05-26Implement `..` in tuple (struct) patternsVadim Petrochenkov-5/+3
2016-05-25Add a new AST-only type variant `ImplicitSelf`Vadim Petrochenkov-1/+1
2016-05-25Remove ExplicitSelf from ASTVadim Petrochenkov-23/+0
2016-05-24Apply visit_path to import prefixes by defaultVadim Petrochenkov-11/+4
2016-05-24syntax/hir: give loop labels a spanGeorg Brandl-14/+19
This makes the "shadowing labels" warning *not* print the entire loop as a span, but only the lifetime. Also makes #31719 go away, but does not fix its root cause (the span of the expanded loop is still wonky, but not used anymore).
2016-04-24thread tighter span for closures aroundNiko Matsakis-1/+1
Track the span corresponding to the `|...|` part of the closure.
2016-04-14Visit visibilities in the ast visitor's `walk_*` functionsJeffrey Seyfried-3/+6
2016-04-06Move span into `StructField`Vadim Petrochenkov-3/+3
2016-04-06Get rid of ast::StructFieldKindVadim Petrochenkov-1/+1
2016-04-02Add `Crate` and `Restricted` variants to `ast::Visibility`Jeffrey Seyfried-0/+10
2016-04-02Make `ast::Visibility` non-copyableJeffrey Seyfried-5/+5
2016-03-07implement the `?` operatorJorge Aparicio-0/+3
The `?` postfix operator is sugar equivalent to the try! macro, but is more amenable to chaining: `File::open("foo")?.metadata()?.is_dir()`. `?` is accepted on any *expression* that can return a `Result`, e.g. `x()?`, `y!()?`, `{z}?`, `(w)?`, etc. And binds more tightly than unary operators, e.g. `!x?` is parsed as `!(x?)`. cc #31436