about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-10-12Rollup merge of #37064 - nnethercote:read_str, r=eddybAlex Crichton-2/+2
Avoid allocations in `Decoder::read_str`. `opaque::Decoder::read_str` is very hot within `rustc` due to its use in the reading of crate metadata, and it currently returns a `String`. This commit changes it to instead return a `Cow<str>`, which avoids a heap allocation. This change reduces the number of calls to `malloc` by almost 10% in some benchmarks. This is a [breaking-change] to libserialize.
2016-10-12Rollup merge of #36995 - nrc:stable, r=@nikomatsakisAlex Crichton-10/+5
stabilise ?, attributes on stmts, deprecate Reflect r? @nikomatsakis
2016-10-12Stabilise attributes on statements.Nick Cameron-3/+2
Note that attributes on expressions are still unstable and are behind the `stmt_expr_attributes` flag. cc [Tracking issue](https://github.com/rust-lang/rust/issues/15701)
2016-10-12Stabilise `?`Nick Cameron-7/+3
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-10-11Rollup merge of #37065 - nnethercote:opt-mk_printer, r=nikomatsakisGuillaume Gomez-38/+31
Merge `Printer::token` and `Printer::size`. Logically, it's a vector of pairs, so might as well represent it that way. The commit also changes `scan_stack` so that it is initialized with the default size, instead of the excessive `55 * linewidth` size, which it usually doesn't get even close to reaching.
2016-10-11Add feature gate for `dropck_eyepatch` feature (RFC 1327).Felix S. Klock II-0/+8
2016-10-11Add support for undetermined macro invocations.Jeffrey Seyfried-6/+37
2016-10-11Merge branch 'persistent_macro_scopes' into cleanup_expanded_macro_use_scopesJeffrey Seyfried-65/+34
2016-10-10Include attributes on generic parameter bindings in pretty printer.Felix S. Klock II-0/+3
2016-10-10Merge `Printer::token` and `Printer::size`.Nicholas Nethercote-38/+31
Logically, it's a vector of pairs, so might as well represent it that way. The commit also changes `scan_stack` so that it is initialized with the default size, instead of the excessive `55 * linewidth` size, which it usually doesn't get even close to reaching.
2016-10-10Avoid allocations in `Decoder::read_str`.Nicholas Nethercote-2/+2
`opaque::Decoder::read_str` is very hot within `rustc` due to its use in the reading of crate metadata, and it currently returns a `String`. This commit changes it to instead return a `Cow<str>`, which avoids a heap allocation. This change reduces the number of calls to `malloc` by almost 10% in some benchmarks. This is a [breaking-change] to libserialize.
2016-10-07Cleanup `depth`s.Jeffrey Seyfried-8/+11
2016-10-07Refactor away `ext::expand::{expand_crate, expand_crate_with_expander}`.Jeffrey Seyfried-31/+10
2016-10-07Add macros from plugins in `libsyntax_ext::register_builtins`.Jeffrey Seyfried-14/+5
2016-10-07Combine `std_inject::{no_core, no_std}` into `std_inject::injected_crate_name`.Jeffrey Seyfried-18/+14
2016-10-07Auto merge of #36945 - alexcrichton:proc-macro-rename, r=nrcbors-7/+7
rustc: Rename rustc_macro to proc_macro This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`, which reflects the general consensus of #35900. A follow up PR to Cargo will be required to purge the `rustc-macro` name as well.
2016-10-06rustc: Rename rustc_macro to proc_macroAlex Crichton-7/+7
This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`, which reflects the general consensus of #35900. A follow up PR to Cargo will be required to purge the `rustc-macro` name as well.
2016-10-05Clarify StringReader::bump.Nicholas Nethercote-13/+16
This commit renames the variables to make it clearer which char each one refers to. It also slightly reorders and rearranges some statements.
2016-10-05Rename StringReader::curr as ch.Nicholas Nethercote-99/+99
Likewise, rename StringReader::curr_is as ch_is. This is a [breaking-change] for libsyntax.
2016-10-05Rename StringReader::last_pos as pos.Nicholas Nethercote-100/+100
This is a [breaking-change] for libsyntax.
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