about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-10-05Rename StringReader::pos as next_pos.Nicholas Nethercote-18/+18
This is a [breaking-change] for libsyntax.
2016-10-05Rename Parser::last_token_kind as prev_token_kind.Nicholas Nethercote-17/+17
Likewise, rename LastTokenKind as PrevTokenKind. This is a [breaking-change] for libsyntax.
2016-10-05Rename Parser::last_span as prev_span.Nicholas Nethercote-167/+163
This is a [breaking-change] for libsyntax.
2016-10-04Rollup merge of #36921 - nnethercote:two-lexer-tweaks, r=nrcManish Goregaokar-8/+2
Two lexer tweaks 19 days later, I haven't received a review of my commits in #36470. In an attempt to make some progress, I'm going to split up the changes. Here are the ones that don't relate to renaming things.
2016-10-03Auto merge of #36767 - jseyfried:enforce_rfc_1560_shadowing, r=nrcbors-3/+8
Enforce the shadowing restrictions from RFC 1560 for today's macros This PR enforces a weakened version of the shadowing restrictions from RFC 1560. More specifically, - If a macro expansion contains a `macro_rules!` macro definition that is used outside of the expansion, the defined macro may not shadow an existing macro. - If a macro expansion contains a `#[macro_use] extern crate` macro import that is used outside of the expansion, the imported macro may not shadow an existing macro. This is a [breaking-change]. For example, ```rust macro_rules! m { () => {} } macro_rules! n { () => { macro_rules! m { () => {} } //< This shadows an existing macro. m!(); //< This is inside the expansion that generated `m`'s definition, so it is OK. } } n!(); m!(); //< This use of `m` is outside the expansion, so it causes the shadowing to be an error. ``` r? @nrc
2016-10-03Simplify `start_bpos` calculation in scan_comment().Nicholas Nethercote-5/+1
The two branches of this `if` compute the same value. This commit gets rid of the first branch, which makes this calculation identical to the one in scan_block_comment().
2016-10-03Streamline StringReader::bump.Nicholas Nethercote-3/+1
First, assert! is redundant w.r.t. the unwrap() immediately afterwards. Second, `byte_offset_diff` is effectively computed as `current_byte_offset + ch.len_utf8() - current_byte_offset` (with `next` as an intermediate) which is silly and can be simplified.
2016-10-02Refactor `ext::base::Resolver::add_ext` to only define macros in the crate root.Jeffrey Seyfried-3/+3
2016-10-02Refactor field `expansion_data` of `Resolver` to use a `Mark` instead of a ↵Jeffrey Seyfried-0/+5
`u32`.
2016-10-01Rollup merge of #34764 - pnkfelix:attrs-on-generic-formals, r=eddybManish Goregaokar-10/+95
First step for #34761
2016-10-01Rollup merge of #36599 - ↵Manish Goregaokar-24/+24
jonas-schievink:whats-a-pirates-favorite-data-structure, r=pnkfelix Contains a syntax-[breaking-change] as a separate commit (cc #31645).nnAlso renames slice patterns from `PatKind::Vec` to `PatKind::Slice`.
2016-10-01Rollup merge of #35874 - CensoredUsername:stmt_let_typed_fix, r=ManishearthManish Goregaokar-4/+4
This commit makes the return type of AstBuilder.stmt_let_typed match the return type of other AstBuilder.stmt* functions. This avoids unnecessary boxing/unboxing whenever Stmt's are stored in a Vec, which is the default use case.nnThis is a potentially plugin breaking change.
2016-09-28Rollup merge of #36789 - jseyfried:non_inline_mod_in_block, r=nikomatsakisJonathan Turner-18/+29
Allow more non-inline modules in blocks Currently, non-inline modules without a `#[path]` attribute are not allowed in blocks. This PR allows non-inline modules that have an ancestor module with a `#[path]` attribute, provided there is not a nearer ancestor block. For example, ```rust fn main() { #[path = "..."] mod foo { mod bar; //< allowed by this PR fn f() { mod bar; //< still an error } } } ``` Fixes #36772. r? @nikomatsakis
2016-09-28Rollup merge of #36787 - jseyfried:fix_test_harness_reexport_errors, r=nrcJonathan Turner-1/+9
Avoid re-export errors in the generated test harness Fixes #36768. r? @nrc
2016-09-28Rollup merge of #36760 - nrc:input2, r=alexcrichtonJonathan Turner-3/+13
Allow supplying an error destination via the compiler driver Allows replacing stderr with a buffer from the client. Also, some refactoring around run_compiler.
2016-09-28Allow non-inline modules in more places.Jeffrey Seyfried-18/+29
2016-09-28libsyntax: clearer names for some AST partsJonas Schievink-24/+24
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-28Allow supplying an error destination via the compiler driverNick Cameron-3/+13
Allows replacing stderr with a buffer from the client. Also, some refactoring around run_compiler.
2016-09-27Auto merge of #36601 - jseyfried:build_reduced_graph_in_expansion, r=nrcbors-46/+44
Assign def ids and build the module graph during expansion r? @nrc
2016-09-27Avoid re-export errors in the generated test harness.Jeffrey Seyfried-1/+9
2016-09-27With `--test`, make `#[test]` functions `pub` in `InvocationCollector`Jeffrey Seyfried-45/+39
and expand the `__test_reexports` in the correct scope.
2016-09-27Avoid aborting after expansion from `BuildReducedGraphVisitor` errors.Jeffrey Seyfried-1/+5
2016-09-26Auto merge of #36764 - jonathandturner:rollup, r=jonathandturnerbors-533/+365
Rollup of 14 pull requests - Successful merges: #36563, #36574, #36586, #36662, #36663, #36669, #36676, #36721, #36723, #36727, #36729, #36742, #36754, #36756 - Failed merges:
2016-09-26Rollup merge of #36727 - kallisti5:master, r=AatchJonathan Turner-0/+2
Haiku: Initial work at OS support These changes should be non-invasive to non-Haiku platforms. These patches were hand reworked from Neil's original Rust 1.9.0 patches. I've done some style cleanup and design updates along the way. There are a few small additional patches to libc, rust-installer and compiler-rt that will be submitted once this one is accepted. Haiku can be compiled on Linux, and a full gcc cross-compiler with a Haiku target is available, which means bootstrapping should be fairly easy. The patches here have already successfully bootstrapped under our haiku x86_gcc2 architecture. http://rust-on-haiku.com/wiki/PortingRust I'll be focusing on our more modern gcc5 x86 and x86 architectures for now. As for support, we're not seeking official support for now. We understand Haiku isn't a top-tier OS choice, however having these patches upstream greatly reduces the amount of patchwork we have to do. Mesa has Haiku code upstream, and we submit patches to keep it going. Mesa doesn't test on Haiku and we're ok with that :-)
2016-09-26Rollup merge of #36721 - TimNN:infinite-emptiness, r=nrcJonathan Turner-1/+38
reject macros with empty repetitions Fixes #5067 by checking the lhs of `macro_rules!` for repetitions which could match an empty token tree.
2016-09-26Rollup merge of #36669 - jseyfried:refactor_tok_result, r=nrcJonathan Turner-280/+103
Unify `TokResult` and `ResultAnyMacro` Fixes #36641. r? @nrc
2016-09-26Rollup merge of #36662 - jseyfried:parse_macro_invoc_paths, r=nrcJonathan Turner-252/+222
parser: support paths in bang macro invocations (e.g. `path::to::macro!()`) r? @nrc
2016-09-26Move `ensure_complete_parse` into `expand.rs`.Jeffrey Seyfried-14/+12
2016-09-26emit feature help in cheat modeTim Neumann-6/+5
2016-09-26make is_nightly_build a method on UnstableFeaturesTim Neumann-0/+7
2016-09-26add unstable_features to ParseSessTim Neumann-0/+21
2016-09-26make emit_feature_err take a ParseSessTim Neumann-13/+15
2016-09-26reject macros with empty repetitionsTim Neumann-1/+38
2016-09-26Refactor `ensure_complete_parse`.Jeffrey Seyfried-45/+31
2016-09-26Remove `TokResult`.Jeffrey Seyfried-161/+29
2016-09-26Refactor `parse_expansion` out of `ResultAnyMacro`.Jeffrey Seyfried-92/+63
2016-09-25Auto merge of #36616 - jseyfried:load_macros_in_resolve, r=nrcbors-108/+45
Load macros from `#[macro_use]` extern crates in `resolve` r? @nrc
2016-09-25Add support for the Haiku operating system on x86 and x86_64 machinesNiels Sascha Reedijk-0/+2
* Hand rebased from Niels original work on 1.9.0
2016-09-24Load macros from `#[macro_use]` extern crates in `resolve`.Jeffrey Seyfried-69/+13
2016-09-24Refactor `ext::tt::macro_rules::compile` to take a `ParseSess` instead of an ↵Jeffrey Seyfried-40/+33
`ExtCtxt`.
2016-09-23ICH: Add ability to test the ICH of exported metadata items.Michael Woerister-0/+10
2016-09-23Added tests and fixed corner case for trailing attributes with no attached ↵Felix S. Klock II-1/+16
binding in generics.
2016-09-23Add attribute support to generic lifetime and type parameters.Felix S. Klock II-10/+80
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-23Fix indents.Jeffrey Seyfried-141/+131
2016-09-23Cleanup.Jeffrey Seyfried-40/+17
2016-09-23Parse paths in item, trait item, and impl item macro invocations.Jeffrey Seyfried-21/+6
2016-09-23Parse paths in statement and pattern macro invocations.Jeffrey Seyfried-31/+46
2016-09-22Auto merge of #36573 - jseyfried:groundwork, r=nrcbors-10/+13
resolve: groundwork for building the module graph during expansion r? @nrc
2016-09-22Auto merge of #36154 - nrc:proc-macro-init, r=@jseyfriedbors-32/+362
Adds a `ProcMacro` form of syntax extension This commit adds syntax extension forms matching the types for procedural macros 2.0 (RFC #1566), these still require the usual syntax extension boiler plate, but this is a first step towards proper implementation and should be useful for macros 1.1 stuff too. Supports both attribute-like and function-like macros. Note that RFC #1566 has not been accepted yet, but I think there is consensus that we want to head in vaguely that direction and so this PR will be useful in any case. It is also fairly easy to undo and does not break any existing programs. This is related to #35957 in that I hope it can be used in the implementation of macros 1.1, however, there is no direct overlap and is more of a complement than a competing proposal. There is still a fair bit of work to do before the two can be combined. r? @jseyfried cc @alexcrichton, @cgswords, @eddyb, @aturon
2016-09-22Use `Resolver::visit_expansion` only with monotonic expansions.Jeffrey Seyfried-10/+13