about summary refs log tree commit diff
path: root/src/librustc_metadata
AgeCommit message (Collapse)AuthorLines
2016-11-02rustc: make all read access to tcx.tables go through a method.Eduard Burtescu-4/+4
2016-10-31Changed most vec! invocations to use square bracesiirelu-8/+8
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-30Auto merge of #37431 - jseyfried:refactor_crate_config, r=eddybbors-8/+1
Move `CrateConfig` from `Crate` to `ParseSess` This is a syntax-[breaking-change]. Most breakage can be fixed by removing a `CrateConfig` argument. r? @eddyb
2016-10-30Auto merge of #37401 - eddyb:lazy-2, r=nikomatsakisbors-29/+0
[2/n] rustc_metadata: move is_extern_item to trans. *This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37400) | [next](https://github.com/rust-lang/rust/pull/37402)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well. If any motivation is unclear, please ask for additional PR description clarifications or code comments.* <hr> Minor cleanup missed by #36551: `is_extern_item` is one of, if not the only `CrateStore` method who takes a `TyCtxt` but doesn't produce something cached in it, and such methods are going away.
2016-10-29Auto merge of #37400 - eddyb:lazy-1, r=nikomatsakisbors-17/+12
[1/n] Move the MIR map into the type context. *This is part of a series ([prev]() | [next](https://github.com/rust-lang/rust/pull/37401)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well. If any motivation is unclear, please ask for additional PR description clarifications or code comments.* <hr> The first commit reorganizes the `rustc::mir` module to contain the MIR types directly without an extraneous `repr` module which serves no practical purpose but is rather an eyesore. The second commit performs the actual move of the MIR map into the type context, for the purposes of future integration with requesting analysis/lowering by-products through `TyCtxt`. Local `Mir` bodies need to be mutated by passes (hence `RefCell`), and at least one pass (`qualify_consts`) needs simultaneous access to multiple `Mir` bodies (hence arena-allocation). `Mir` bodies loaded from other crates appear as if immutably borrowed (by `.borrow()`-ing one `Ref` and subsequently "leaking" it) to avoid, at least dynamically, *any* possibility of their local mutation. One caveat is that lint passes can now snoop at the MIR (helpful) or even mutate it (dangerous). However, lints are unstable anyway and we can find a way to deal with this in due time. Future work will result in a tighter API, potentially hiding mutation *completely* outside of MIR passes.
2016-10-29Move `CrateConfig` from `Crate` to `ParseSess`.Jeffrey Seyfried-8/+1
2016-10-28Do not intern filemap to entry w/ mismatched length. Fix #37274 (I think).Felix S. Klock II-0/+4
2016-10-28Debug instrumentation for construction of ImportedFileMap table entries.Felix S. Klock II-0/+14
2016-10-28rustc: move the MIR map into TyCtxt.Eduard Burtescu-13/+8
2016-10-28rustc: move mir::repr::* to mir.Eduard Burtescu-4/+4
2016-10-27Auto merge of #37350 - srinivasreddy:meta_2, r=nrcbors-342/+363
run rustfmt on librustc_metadata folder
2016-10-26Auto merge of #37270 - Mark-Simulacrum:smallvec-optimized-arenas, r=eddybbors-2/+2
Add ArrayVec and AccumulateVec to reduce heap allocations during interning of slices Updates `mk_tup`, `mk_type_list`, and `mk_substs` to allow interning directly from iterators. The previous PR, #37220, changed some of the calls to pass a borrowed slice from `Vec` instead of directly passing the iterator, and these changes further optimize that to avoid the allocation entirely. This change yields 50% less malloc calls in [some cases](https://pastebin.mozilla.org/8921686). It also yields decent, though not amazing, performance improvements: ``` futures-rs-test 4.091s vs 4.021s --> 1.017x faster (variance: 1.004x, 1.004x) helloworld 0.219s vs 0.220s --> 0.993x faster (variance: 1.010x, 1.018x) html5ever-2016- 3.805s vs 3.736s --> 1.018x faster (variance: 1.003x, 1.009x) hyper.0.5.0 4.609s vs 4.571s --> 1.008x faster (variance: 1.015x, 1.017x) inflate-0.1.0 3.864s vs 3.883s --> 0.995x faster (variance: 1.232x, 1.005x) issue-32062-equ 0.309s vs 0.299s --> 1.033x faster (variance: 1.014x, 1.003x) issue-32278-big 1.614s vs 1.594s --> 1.013x faster (variance: 1.007x, 1.004x) jld-day15-parse 1.390s vs 1.326s --> 1.049x faster (variance: 1.006x, 1.009x) piston-image-0. 10.930s vs 10.675s --> 1.024x faster (variance: 1.006x, 1.010x) reddit-stress 2.302s vs 2.261s --> 1.019x faster (variance: 1.010x, 1.026x) regex.0.1.30 2.250s vs 2.240s --> 1.005x faster (variance: 1.087x, 1.011x) rust-encoding-0 1.895s vs 1.887s --> 1.005x faster (variance: 1.005x, 1.018x) syntex-0.42.2 29.045s vs 28.663s --> 1.013x faster (variance: 1.004x, 1.006x) syntex-0.42.2-i 13.925s vs 13.868s --> 1.004x faster (variance: 1.022x, 1.007x) ``` We implement a small-size optimized vector, intended to be used primarily for collection of presumed to be short iterators. This vector cannot be "upsized/reallocated" into a heap-allocated vector, since that would require (slow) branching logic, but during the initial collection from an iterator heap-allocation is possible. We make the new `AccumulateVec` and `ArrayVec` generic over implementors of the `Array` trait, of which there is currently one, `[T; 8]`. In the future, this is likely to expand to other values of N. Huge thanks to @nnethercote for collecting the performance and other statistics mentioned above.
2016-10-25Utilize AccumulateVec to avoid heap allocations in mk_{substs, type_list, ↵Mark-Simulacrum-2/+2
tup} calls.
2016-10-25run rustfmt on librustc_metadata folderSrinivas Reddy Thatiparthy-342/+363
2016-10-25rustc_metadata: move is_extern_item to trans.Eduard Burtescu-29/+0
2016-10-24Auto merge of #37292 - jseyfried:import_macros_in_resolve, r=nrcbors-542/+116
Process `#[macro_use]` imports in `resolve` and clean up macro loading Groundwork macro modularization (cc #35896). r? @nrc
2016-10-24Clean up `CrateLoader::process_item`.Jeffrey Seyfried-62/+32
2016-10-24Refactor away `CrateLoader::load_macros`.Jeffrey Seyfried-27/+16
2016-10-24Refactor away `metadata::creader::Macros`.Jeffrey Seyfried-58/+30
2016-10-24Refactor away fields `MacroDef::{use_locally, export}`.Jeffrey Seyfried-3/+0
2016-10-24Import macros in `resolve` instead of in `metadata::macro_import`.Jeffrey Seyfried-423/+69
2016-10-23Run rustfmt on metadata folder - (1/2)Srinivas Reddy Thatiparthy-261/+336
2016-10-22Rename `loader.rs` -> `locator.rs`.Jeffrey Seyfried-24/+24
2016-10-22Move `Library` into `creader.rs`.Jeffrey Seyfried-10/+11
2016-10-22Rename `csearch.rs` -> `cstore_impl.rs`.Jeffrey Seyfried-1/+1
2016-10-22Remove `CrateReader`, use `CrateLoader` instead.Jeffrey Seyfried-36/+16
2016-10-21Auto merge of #37247 - jseyfried:future_proof_no_link, r=nrcbors-2/+9
macros: Future proof `#[no_link]` This PR future proofs `#[no_link]` for macro modularization (cc #35896). First, we resolve all `#[no_link] extern crate`s. `#[no_link]` crates without `#[macro_use]` or `#[macro_reexport]` are not resolved today, this is a [breaking-change]. For example, ```rust ``` Any breakage can be fixed by simply removing the `#[no_link] extern crate`. Second, `#[no_link] extern crate`s will define an empty module in type namespace to eventually allow importing the crate's macros with `use`. This is a [breaking-change], for example: ```rust mod syntax {} //< This becomes a duplicate error. ``` r? @nrc
2016-10-19Use TypedArena::alloc_slice in rustc.Mark-Simulacrum-2/+2
2016-10-19Future proof `#[no_link]`.Jeffrey Seyfried-2/+9
2016-10-19Rollup merge of #37198 - jseyfried:future_proof_macros_11, r=nrcEduard-Mihai Burtescu-2/+1
macros 1.1: future proofing and cleanup This PR - uses the macro namespace for custom derives (instead of a dedicated custom derive namespace), - relaxes the shadowing rules for `#[macro_use]`-imported custom derives to match the shadowing rules for ordinary `#[macro_use]`-imported macros, and - treats custom derive `extern crate`s like empty modules so that we can eventually allow, for example, `extern crate serde_derive; use serde_derive::Serialize;` backwards compatibly. r? @alexcrichton
2016-10-17Auto merge of #36969 - nnethercote:rename-Parser-fields, r=eddybbors-1/+1
Clarify the positions of the lexer and parser The lexer and parser use unclear names to indicate their positions in the source code. I propose the following renamings. Lexer: ``` pos -> next_pos # it's actually the next pos! last_pos -> pos # it's actually the current pos! curr -> ch # the current char curr_is -> ch_is # tests the current char col (unchanged) # the current column ``` parser ``` - last_span -> prev_span # the previous token's span - last_token_kind -> prev_token_kind # the previous token's kind - LastTokenKind -> PrevTokenKind # ditto (but the type) - token (unchanged) # the current token - span (unchanged) # the current span ``` Things to note: - This proposal removes all uses of "last", which is an unclear word because it could mean (a) previous, (b) final, or (c) most recent, i.e. current. - The "current" things (ch, col, token, span) consistently lack a prefix. The "previous" and "next" things consistently have a prefix.
2016-10-15Use the macro namespace for custom derives.Jeffrey Seyfried-2/+1
2016-10-12Rollup merge of #37064 - nnethercote:read_str, r=eddybAlex Crichton-1/+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-12Stabilise `?`Nick Cameron-1/+1
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-10-10Avoid allocations in `Decoder::read_str`.Nicholas Nethercote-1/+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-07Auto merge of #36945 - alexcrichton:proc-macro-rename, r=nrcbors-20/+20
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-20/+20
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-05Rename Parser::last_span as prev_span.Nicholas Nethercote-1/+1
This is a [breaking-change] for libsyntax.
2016-10-04Remove some unused methods from metadataVadim Petrochenkov-6/+0
Address comments + Fix rebase
2016-10-04Eliminate ty::VariantKind in favor of def::CtorKindVadim Petrochenkov-34/+21
2016-10-04Further cleanup in resolveVadim Petrochenkov-0/+2
`try_define` is not used in build_reduced_graph anymore Collection of field names for error reporting is optimized Some comments added
2016-10-04Fix cross-crate resolution of half-items created by export shadowingVadim Petrochenkov-13/+34
2016-10-03Auto merge of #36767 - jseyfried:enforce_rfc_1560_shadowing, r=nrcbors-20/+30
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-02Record macro import site spans.Jeffrey Seyfried-20/+30
2016-09-30Fix RUSTC_VERSION for 'documenting' build stage.Scott Olson-10/+9
Previously the `env!("RUSTC_VERSION")` requirement would break the "Documenting rustc_metadata" stage of the rustc build, since that environment variable is only defined during the main build.
2016-09-28Rollup merge of #36794 - japaric:target-panic, r=alexcrichtonJonathan Turner-6/+6
add a panic-strategy field to the target specification Now a target can define its panic strategy in its specification. If a user doesn't specify a panic strategy via the command line, i.e. '-C panic', then the compiler will use the panic strategy defined by the target specification. Custom targets can pick their panic strategy via the "panic-strategy" field of their target specification JSON file. If omitted in the specification, the strategy defaults to "unwind". closes #36647 --- I checked that compiling an executable for a custom target with "panic-strategy" set to "abort" doesn't need the "eh_personality" lang item and also that standard crates compiled for that custom target didn't contained undefined symbols to _Unwind_Resume. But this needs an actual unit test, any suggestion on how to test this? Most of the noise in the diff is due to moving `PanicStrategy` from the `rustc` to the `rustc_back` crate. r? @alexcrichton cc @phil-opp
2016-09-27add a panic-strategy field to the target specificationJorge Aparicio-6/+6
Now a target can define its panic strategy in its specification. If a user doesn't specify a panic strategy via the command line, i.e. '-C panic', then the compiler will use the panic strategy defined by the target specification. Custom targets can pick their panic strategy via the "panic-strategy" field of their target specification JSON file. If omitted in the specification, the strategy defaults to "unwind". closes #36647
2016-09-27Fix fallout in tests.Jeffrey Seyfried-6/+6
2016-09-24Load macros from `#[macro_use]` extern crates in `resolve`.Jeffrey Seyfried-5/+5
2016-09-23Load extern crates in `resolve`.Jeffrey Seyfried-134/+82