about summary refs log tree commit diff
path: root/src/librustc_driver/driver.rs
AgeCommit message (Collapse)AuthorLines
2016-09-30rustdoc: Fix documenting rustc-macro cratesAlex Crichton-12/+17
This commit adds a "hack" to the session to track whether we're a rustdoc session or not. If we're rustdoc then we skip the expansion to add the rustc-macro infrastructure. Closes #36820
2016-09-27Build the reduced graph during expansion.Jeffrey Seyfried-7/+6
2016-09-27Peform def id assignment during expansion.Jeffrey Seyfried-3/+0
2016-09-24Load macros from `#[macro_use]` extern crates in `resolve`.Jeffrey Seyfried-0/+3
2016-09-23Load extern crates in `resolve`.Jeffrey Seyfried-11/+3
2016-09-22Refactor `no_implicit_prelude: Cell<bool>` -> `no_implicit_prelude: bool`.Jeffrey Seyfried-1/+2
2016-09-19librustc: Implement def-use chains and trivial copy propagation on MIR.Patrick Walton-0/+1
This only supports trivial cases in which there is exactly one def and one use.
2016-09-17Auto merge of #36504 - pcwalton:and-star, r=eddybbors-0/+3
librustc_mir: Remove `&*x` when `x` has a reference type. This introduces a new `InstCombine` pass for us to place such peephole optimizations. r? @eddyb
2016-09-16librustc_mir: Remove `&*x` when `x` has a reference type.Patrick Walton-0/+3
This introduces a new `InstCombine` pass for us to place such peephole optimizations.
2016-09-15Move fields `single_step` and `keep_macs` from `MacroExpander` to ↵Jeffrey Seyfried-1/+1
`ExpansionConfig`.
2016-09-13Expand generated test harnesses and macro registries.Jeffrey Seyfried-0/+2
2016-09-13Perform node id assignment and `macros_at_scope` construction duringJeffrey Seyfried-2/+0
the `InvocationCollector` and `PlaceholderExpander` folds.
2016-09-13Move macro resolution into `librustc_resolve`.Jeffrey Seyfried-6/+3
2016-09-13Refactor `ExtCtxt` to use a `Resolver` instead of a `MacroLoader`.Jeffrey Seyfried-8/+7
2016-09-07Auto merge of #36214 - jseyfried:stackless_expansion, r=nrcbors-16/+4
macros: stackless expansion After this PR, macro expansion cannot overflow the stack unless the expanded crate is too deep to fold. Everything but the stackless placeholder expansion commit is also groundwork for macro modularization. r? @nrc or @eddyb
2016-09-06Auto merge of #36025 - michaelwoerister:incr-comp-hash-spans, r=nikomatsakisbors-0/+4
incr. comp.: Take spans into account for ICH This PR makes the ICH (incr. comp. hash) take spans into account when debuginfo is enabled. A side-effect of this is that the SVH (which is based on the ICHs of all items in the crate) becomes sensitive to the tiniest change in a code base if debuginfo is enabled. Since we are not trying to model ABI compatibility via the SVH anymore (this is done via the crate disambiguator now), this should be not be a problem. Fixes #33888. Fixes #32753.
2016-09-05Remove `syntax::config::strip_unconfigured`, add `syntax::config::features`.Jeffrey Seyfried-16/+4
2016-09-04Auto merge of #36240 - leeopop:master, r=jseyfriedbors-4/+9
Allow CompilerControllers to access rustc_plugin::registry::Registry fixes #36064 I chose to put ructc_plugin::registry::Registry structure into CompilerState structure, instead of Session structure. This will preserve dependencies among librustc, libructc_driver, and libructc_plugin. @jseyfried @sanxiyn
2016-09-04Auto merge of #36132 - nrc:save-std, r=@eddybbors-1/+2
Add --Zsave-analysis-api This is a save-analysis variation which can be used with libraries distributed without their source (e.g., libstd). It will allow IDEs and other tools to get info about types and create URLs to docs and source, without the unnecessary clutter of internal-only save-analysis info. I'm sure we'll iterate somewhat on the design, but this is a first draft.
2016-09-04Allow CompilerControllers to access rustc_plugin::registry::Registry structure.Keunhong Lee-4/+9
2016-09-02rustc: Implement custom derive (macros 1.1)Alex Crichton-0/+18
This commit is an implementation of [RFC 1681] which adds support to the compiler for first-class user-define custom `#[derive]` modes with a far more stable API than plugins have today. [RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md The main features added by this commit are: * A new `rustc-macro` crate-type. This crate type represents one which will provide custom `derive` implementations and perhaps eventually flower into the implementation of macros 2.0 as well. * A new `rustc_macro` crate in the standard distribution. This crate will provide the runtime interface between macro crates and the compiler. The API here is particularly conservative right now but has quite a bit of room to expand into any manner of APIs required by macro authors. * The ability to load new derive modes through the `#[macro_use]` annotations on other crates. All support added here is gated behind the `rustc_macro` feature gate, both for the library support (the `rustc_macro` crate) as well as the language features. There are a few minor differences from the implementation outlined in the RFC, such as the `rustc_macro` crate being available as a dylib and all symbols are `dlsym`'d directly instead of having a shim compiled. These should only affect the implementation, however, not the public interface. This commit also ended up touching a lot of code related to `#[derive]`, making a few notable changes: * Recognized derive attributes are no longer desugared to `derive_Foo`. Wasn't sure how to keep this behavior and *not* expose it to custom derive. * Derive attributes no longer have access to unstable features by default, they have to opt in on a granular level. * The `derive(Copy,Clone)` optimization is now done through another "obscure attribute" which is just intended to ferry along in the compiler that such an optimization is possible. The `derive(PartialEq,Eq)` optimization was also updated to do something similar. --- One part of this PR which needs to be improved before stabilizing are the errors and exact interfaces here. The error messages are relatively poor quality and there are surprising spects of this such as `#[derive(PartialEq, Eq, MyTrait)]` not working by default. The custom attributes added by the compiler end up becoming unstable again when going through a custom impl. Hopefully though this is enough to start allowing experimentation on crates.io! syntax-[breaking-change]
2016-09-01Add some infrastructure for timing things where time_passes can't be used.Michael Woerister-0/+4
2016-09-01save-analysis: add parent info to api dumpsNick Cameron-1/+2
The parent id is used for constructing rustdoc URLs by clients
2016-08-31Auto merge of #35718 - michaelwoerister:incr-comp-dir-locking, r=alexcrichtonbors-8/+12
Implement synchronization scheme for incr. comp. directory This PR implements a copy-on-write-based synchronization scheme for the incremental compilation cache directory. For technical details, see the documentation at the beginning of `rustc_incremental/persist/fs.rs`. The PR contains unit tests for some functions but for testing whether the scheme properly handles races, a more elaborate test setup would be needed. It would probably involve a small tool that allows to manipulate the incremental compilation directory in a controlled way and then letting a compiler instance run against directories in different states. I don't know if it's worth the trouble of adding another test category to `compiletest`, but I'd be happy to do so. Fixes #32754 Fixes #34957
2016-08-29Implement copy-on-write scheme for managing the incremental compilation cache.Michael Woerister-8/+12
2016-08-25Refactor away `AttrMetaMethods`.Jeffrey Seyfried-1/+1
2016-08-23pacify the mercilous tidyNiko Matsakis-2/+10
2016-08-23rename HashesMap to IncrementalHashesMapNiko Matsakis-15/+15
2016-08-20compute and cache HIR hashes at beginningNiko Matsakis-13/+20
This avoids the compile-time overhead of computing them twice. It also fixes an issue where the hash computed after typeck is differen than the hash before, because typeck mutates the def-map in place. Fixes #35549. Fixes #35593.
2016-08-15Auto merge of #35340 - michaelwoerister:incr-comp-cli-args, r=nikomatsakisbors-7/+9
Take commandline arguments into account for incr. comp. Implements the conservative strategy described in https://github.com/rust-lang/rust/issues/33727. From now one, every time a new commandline option is added, one has to specify if it influences the incremental compilation cache. I've tried to implement this as automatic as possible: One just has to added either the `[TRACKED]` or the `[UNTRACKED]` marker next to the field. The `Options`, `CodegenOptions`, and `DebuggingOptions` definitions in `session::config` show plenty of examples. The PR removes some cruft from `session::config::Options`, mostly unnecessary copies of flags also present in `DebuggingOptions` or `CodeGenOptions` in the same struct. One notable removal is the `cfg` field that contained the values passed via `--cfg` commandline arguments. I chose to remove it because (1) its content is only a subset of what later is stored in `hir::Crate::config` and it's pretty likely that reading the cfgs from `Options` would not be what you wanted, and (2) we could not incorporate it into the dep-tracking hash of the `Options` struct because of how the test framework works, leaving us with a piece of untracked but vital data. It is now recommended (just as before) to access the crate config via the `krate()` method in the HIR map. Because the `cfg` field is not present in the `Options` struct any more, some methods in the `CompilerCalls` trait now take the crate config as an explicit parameter -- which might constitute a breaking change for plugin authors.
2016-08-11Auto merge of #34811 - DanielJCampbell:Expander, r=jseyfriedbors-4/+2
Extended expand.rs to support alternate expansion behaviours (eg. stepwise expansion) r? nrc
2016-08-11Remove the 'cfg' field from session::config::Options.Michael Woerister-1/+4
The 'cfg' in the Options struct is only the commandline-specified subset of the crate configuration and it's almost always wrong to read that instead of the CrateConfig in HIR crate node.
2016-08-11Add the notion of a dependency tracking status to commandline arguments.Michael Woerister-6/+5
Commandline arguments influence whether incremental compilation can use its compilation cache and thus their changes relative to previous compilation sessions need to be taking into account. This commit makes sure that one has to specify for every commandline argument whether it influences incremental compilation or not.
2016-08-10Extended expand.rs to support alternate expansion behavioursDaniel Campbell-4/+2
Added single_step & keep_macs flags and functionality to expander
2016-08-09incorporate resolve results into hashingNiko Matsakis-2/+2
We now incorporate the `def_map` and `trait_map` results into the SVH.
2016-08-04Auto merge of #35168 - scottcarr:deaggregation, r=nikomatsakisbors-0/+2
[MIR] Deaggregate structs to enable further optimizations Currently, we generate MIR like: ``` tmp0 = ...; tmp1 = ...; tmp3 = Foo { a: ..., b: ... }; ``` This PR implements "deaggregation," i.e.: ``` tmp3.0 = ... tmp3.1 = ... ``` Currently, the code only deaggregates structs, not enums. My understanding is that we do not have MIR to set the discriminant of an enum.
2016-08-01deaggregate structs to enable further optimizationScott A Carr-0/+2
2016-07-28Address mw nitsNiko Matsakis-12/+12
2016-07-28Code to save/load the work-products map from diskNiko Matsakis-3/+8
Work products are deleted if any of their inputs are dirty.
2016-07-28Store `crate_disambiguator` as an `InternedString`Niko Matsakis-1/+2
We used to use `Name`, but the session outlives the tokenizer, which means that attempts to read this field after trans has complete otherwise panic. All reads want an `InternedString` anyhow.
2016-07-18Add `librustc_driver::driver::reset_thread_local_state` andJeffrey Seyfried-4/+8
remove the thread local state reset at the beginning of `phase_1_parse_input`.
2016-07-17Rename `mtwt` to `hygiene`Jeffrey Seyfried-6/+6
2016-07-17Clean up and encapsulate `syntax::ext::mtwt`Jeffrey Seyfried-4/+3
2016-07-15Auto merge of #34570 - jseyfried:no_rename, r=nrcbors-57/+13
Simplify the macro hygiene algorithm This PR removes renaming from the hygiene algorithm and treats differently marked identifiers as unequal. This change makes the scope of identifiers in `macro_rules!` items empty. That is, identifiers in `macro_rules!` definitions do not inherit any semantics from the `macro_rules!`'s scope. Since `macro_rules!` macros are items, the scope of their identifiers "should" be the same as that of other items; in particular, the scope should contain only items. Since all items are unhygienic today, this would mean the scope should be empty. However, the scope of an identifier in a `macro_rules!` statement today is the scope that the identifier would have if it replaced the `macro_rules!` (excluding anything unhygienic, i.e. locals only). To continue to support this, this PR tracks the scope of each `macro_rules!` and uses it in `resolve` to ensure that an identifier expanded from a `macro_rules!` gets a chance to resolve to the locals in the `macro_rules!`'s scope. This PR is a pure refactoring. After this PR, - `syntax::ext::expand` is much simpler. - We can expand macros in any order without causing problems for hygiene (needed for macro modularization). - We can deprecate or remove today's `macro_rules!` scope easily. - Expansion performance improves by 25%, post-expansion memory usage decreases by ~5%. - Expanding a block is no longer quadratic in the number of `let` statements (fixes #10607). r? @nrc
2016-07-14Move node id assigning into `resolve`Jeffrey Seyfried-57/+13
2016-07-11Refactor `get_ident_interner` -> `with_ident_interner`.Jeffrey Seyfried-2/+2
2016-07-08Adapt backend to trans::partitioning dictating the codegen-unit setup.Michael Woerister-1/+1
2016-07-04Renamed phase to compilation_doneWill Crichton-5/+5
2016-07-04Added new compilation phase and testWill Crichton-0/+18
2016-07-04Moved LLVM cleanup to after `after_llvm` phaseWill Crichton-0/+2