about summary refs log tree commit diff
path: root/src/libsyntax/ext/build.rs
AgeCommit message (Collapse)AuthorLines
2017-01-11syntax: struct field attributes and cfgBenjamin Saunders-1/+7
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-5/+9
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-22Refactor how global paths are represented (for both ast and hir).Jeffrey Seyfried-2/+6
2016-12-20Rollup merge of #38171 - jseyfried:cleanup, r=nrcAlex Crichton-17/+14
Miscellaneous cleanup/refactoring in `resolve` and `syntax::ext` r? @nrc
2016-12-19Optimize `ast::PathSegment`.Jeffrey Seyfried-17/+14
2016-12-06Don't perform span mangling when building field/tup access nodesSean Griffin-15/+3
There are no guarantees that the two spans used to create the new one come from the same place or are even valid. Fixes #36081.
2016-11-21Implement the `loop_break_value` feature.Geoffry Song-1/+1
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-21Use `Symbol` instead of `InternedString` in the AST, HIR, and various other ↵Jeffrey Seyfried-9/+7
places.
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-3/+2
2016-11-20Refactor `P<ast::MetaItem>` -> `ast::MetaItem`.Jeffrey Seyfried-8/+8
2016-11-20Refactor `MetaItemKind` to use `Name`s instead of `InternedString`s.Jeffrey Seyfried-8/+8
2016-11-10syntax: don't fake a block around closures' bodies during parsing.Eduard Burtescu-30/+15
2016-10-31Changed most vec! invocations to use square bracesiirelu-16/+16
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-10-27Implement field shorthands in struct literal expressions.Eduard Burtescu-1/+1
2016-10-01Rollup merge of #34764 - pnkfelix:attrs-on-generic-formals, r=eddybManish Goregaokar-0/+6
First step for #34761
2016-09-23Add attribute support to generic lifetime and type parameters.Felix S. Klock II-0/+6
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-17Make the return type of AstBuilder.stmt_let_typed match the return type of ↵CensoredUsername-4/+4
other AstBuilder.stmt* functions
2016-09-10Improve `Eq` derivingVadim Petrochenkov-0/+18
2016-08-28Rollup merge of #35850 - SergioBenitez:master, r=nrcJeffrey Seyfried-2/+11
Implement RFC#1559: allow all literals in attributes Implemented rust-lang/rfcs#1559, tracked by #34981.
2016-08-28Rollup merge of #35728 - petrochenkov:empderive, r=manishearthJeffrey Seyfried-20/+20
Fix #[derive] for empty tuple structs/variants This was missing from https://github.com/rust-lang/rust/pull/35138
2016-08-28Rollup merge of #35480 - KiChjang:e0379-bonus, r=nikomatsakisJeffrey Seyfried-2/+2
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-2/+2
2016-08-25Implement RFC#1559: allow all literals in attributes.Sergio Benitez-2/+11
2016-08-21Refactor away variant `ast::PathListItemKind::Mod`Jeffrey Seyfried-1/+1
and refactor `ast::PathListItemKind::Ident` -> `ast::PathListItem_`.
2016-08-18Split `AstBuilder::pat_enum` into `pat_tuple_struct` and `pat_path`Vadim Petrochenkov-20/+20
2016-08-18Fix #[derive] for empty tuple structs/variantsVadim Petrochenkov-1/+1
2016-07-25General MetaItem encapsulation rewrites.cgswords-17/+6
2016-06-26Rollup merge of #34436 - jseyfried:no_block_expr, r=eddybJeffrey Seyfried-26/+26
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-3/+3
Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>`.
2016-06-26Rollup merge of #34316 - jseyfried:refactor_ast_stmt, r=eddybJeffrey Seyfried-7/+20
Refactor away `ast::Decl`, refactor `ast::Stmt`, and rename `ast::ExprKind::Again` to `ast::ExprKind::Continue`.
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-24Add `ecx.stmt_semi()` and fix issues with the pretty-printerJeffrey Seyfried-0/+5
2016-06-23Refactor away duplicate method `ecx.block_all()`Jeffrey Seyfried-7/+2
2016-06-23Remove field `expr` of `ast::Block`Jeffrey Seyfried-25/+20
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-1/+2
2016-06-20Merge PatKind::QPath into PatKind::Path in ASTVadim Petrochenkov-1/+1
2016-06-19Generalize and abstract `ThinAttributes`Jeffrey Seyfried-3/+3
2016-06-17Fix falloutJeffrey Seyfried-7/+20
2016-05-26Implement `..` in tuple (struct) patternsVadim Petrochenkov-2/+2
2016-05-09rustc: Implement custom panic runtimesAlex Crichton-1/+1
This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account).
2016-04-25Rollup merge of #33041 - petrochenkov:path, r=nrc,ManishearthManish Goregaokar-5/+3
Paths are mostly parsed without taking whitespaces into account, e.g. `std :: vec :: Vec :: new ()` parses successfully, however, there are some special cases involving keywords `super`, `self` and `Self`. For example, `self::` is considered a path start only if there are no spaces between `self` and `::`. These restrictions probably made sense when `self` and friends weren't keywords, but now they are unnecessary. The first two commits remove this special treatment of whitespaces by removing `token::IdentStyle` entirely and therefore fix https://github.com/rust-lang/rust/issues/14109. This change also affects naked `self` and `super` (which are not tightly followed by `::`, obviously) they can now be parsed as paths, however they are still not resolved correctly in imports (cc @jseyfried, see `compile-fail/use-keyword.rs`), so https://github.com/rust-lang/rust/issues/29036 is not completely fixed. The third commit also makes `super`, `self`, `Self` and `static` keywords nominally (before this they acted as keywords for all purposes) and removes most of remaining \"special idents\". The last commit (before tests) contains some small improvements - some qualified paths with type parameters are parsed correctly, `parse_path` is not used for parsing single identifiers, imports are sanity checked for absence of type parameters - such type parameters can be generated by syntax extensions or by macros when https://github.com/rust-lang/rust/issues/10415 is fixed (~~soon!~~already!). This patch changes some pretty basic things in `libsyntax`, like `token::Token` and the keyword list, so it's a plugin-[breaking-change]. r? @eddyb
2016-04-24syntax: Merge keywords and remaining special idents in one listVadim Petrochenkov-5/+3
Simplify the macro used for generation of keywords Make `Keyword::ident` private
2016-04-24syntax: Make static/super/self/Self keywords + special ident cleanupVadim Petrochenkov-3/+3
2016-04-24thread tighter span for closures aroundNiko Matsakis-8/+29
Track the span corresponding to the `|...|` part of the closure.
2016-04-06Move span into `StructField`Vadim Petrochenkov-2/+3
2016-04-06Get rid of ast::StructFieldKindVadim Petrochenkov-1/+2
2016-02-13Split ast::PatKind::Enum into tuple struct and path patternsVadim Petrochenkov-1/+5
2016-02-13Rename ast::Pat_ and its variantsVadim Petrochenkov-9/+9
2016-02-11Remove some unnecessary indirection from AST structuresVadim Petrochenkov-23/+23
2016-02-11[breaking-change] don't glob export ast::PathListItem_ variantsOliver 'ker' Schneider-1/+6