about summary refs log tree commit diff
path: root/src/librustc_driver
AgeCommit message (Collapse)AuthorLines
2016-08-27rustc: pass ty::Region behind an interned 'tcx reference.Eduard Burtescu-13/+14
2016-08-25Refactor away `AttrMetaMethods`.Jeffrey Seyfried-2/+1
2016-08-25Implement RFC#1559: allow all literals in attributes.Sergio Benitez-5/+7
2016-08-25Rollup merge of #35955 - frewsxcv:idiomatic-methods, r=eddybManish Goregaokar-1/+1
Use idiomatic names for string-related methods names. None
2016-08-23Use idiomatic names for string-related methods names.Corey Farwell-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-15/+22
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-17rustc: remove ParamSpace from Substs.Eduard Burtescu-12/+9
2016-08-17rustc: reduce Substs and Generics to a simple immutable API.Eduard Burtescu-7/+7
2016-08-16Auto merge of #35538 - cgswords:libproc_macro, r=nrcbors-1/+2
Kicking off libproc_macro This PR introduces `libproc_macro`, which is currently quite bare-bones (just a few macro construction tools and an initial `quote!` macro). This PR also introduces a few test cases for it, and an additional `shim` file (at `src/libsyntax/ext/proc_macro_shim.rs` to allow a facsimile usage of Macros 2.0 *today*!
2016-08-16Proc_macro is alivecgswords-1/+2
2016-08-16Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakisbors-1/+1
Implement the `!` type This implements the never type (`!`) and hides it behind the feature gate `#[feature(never_type)]`. With the feature gate off, things should build as normal (although some error messages may be different). With the gate on, `!` is usable as a type and diverging type variables (ie. types that are unconstrained by anything in the code) will default to `!` instead of `()`.
2016-08-15Auto merge of #35340 - michaelwoerister:incr-comp-cli-args, r=nikomatsakisbors-22/+38
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-13Remove obsolete divergence related stuffAndrew Cann-1/+1
Replace FnOutput with Ty Replace FnConverging(ty) with ty Purge FnDiverging, FunctionRetTy::NoReturn and FunctionRetTy::None
2016-08-12Auto merge of #35091 - eddyb:impl-trait, r=nikomatsakisbors-2/+2
Implement `impl Trait` in return type position by anonymization. This is the first step towards implementing `impl Trait` (cc #34511). `impl Trait` types are only allowed in function and inherent method return types, and capture all named lifetime and type parameters, being invariant over them. No lifetimes that are not explicitly named lifetime parameters are allowed to escape from the function body. The exposed traits are only those listed explicitly, i.e. `Foo` and `Clone` in `impl Foo + Clone`, with the exception of "auto traits" (like `Send` or `Sync`) which "leak" the actual contents. The implementation strategy is anonymization, i.e.: ```rust fn foo<T>(xs: Vec<T>) -> impl Iterator<Item=impl FnOnce() -> T> { xs.into_iter().map(|x| || x) } // is represented as: type A</*invariant over*/ T> where A<T>: Iterator<Item=B<T>>; type B</*invariant over*/ T> where B<T>: FnOnce() -> T; fn foo<T>(xs: Vec<T>) -> A<T> { xs.into_iter().map(|x| || x): $0 where $0: Iterator<Item=$1>, $1: FnOnce() -> T } ``` `$0` and `$1` are resolved (to `iter::Map<vec::Iter<T>, closure>` and the closure, respectively) and assigned to `A` and `B`, after checking the body of `foo`. `A` and `B` are *never* resolved for user-facing type equality (typeck), but always for the low-level representation and specialization (trans). The "auto traits" exception is implemented by collecting bounds like `impl Trait: Send` that have failed for the obscure `impl Trait` type (i.e. `A` or `B` above), pretending they succeeded within the function and trying them again after type-checking the whole crate, by replacing `impl Trait` with the real type. While passing around values which have explicit lifetime parameters (of the function with `-> impl Trait`) in their type *should* work, regionck appears to assign inference variables in *way* too many cases, and never properly resolving them to either explicit lifetime parameters, or `'static`. We might not be able to handle lifetime parameters in `impl Trait` without changes to lifetime inference, but type parameters can have arbitrary lifetimes in them from the caller, so most type-generic usecases (or not generic at all) should not run into this problem. cc @rust-lang/lang
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-12rustc: rename ProjectionMode and its variant to be more memorable.Eduard Burtescu-2/+2
2016-08-11Remove the 'cfg' field from session::config::Options.Michael Woerister-14/+29
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-8/+9
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-10Auto merge of #34845 - bitshifter:issue-30961, r=alexcrichtonbors-0/+23
Add help for target CPUs, features, relocation and code models. Fix for https://github.com/rust-lang/rust/issues/30961. Requires PR https://github.com/rust-lang/llvm/pull/45 to be accepted first, and the .gitmodules for llvm to be updated before this can be merged.
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-09Auto merge of #35079 - nikomatsakis:incr-comp-ich-32753, r=mwbors-2/+3
Various improvements to the SVH This fixes a few points for the SVH: - incorporate resolve results into the SVH; - don't include nested items. r? @michaelwoerister cc #32753 (not fully fixed I don't think)
2016-08-09incorporate resolve results into hashingNiko Matsakis-2/+3
We now incorporate the `def_map` and `trait_map` results into the SVH.
2016-08-09Auto merge of #35401 - jonathandturner:enable_json_and_new_errors, ↵bors-12/+3
r=jonathandturner Turn on new errors and json mode This PR is a big-switch, but on a well-worn path: * Turns on new errors by default (and removes old skool) * Moves json output from behind a flag The RFC for new errors [landed](https://github.com/rust-lang/rfcs/pull/1644) and as part of that we wanted some bake time. It's now had a few weeks + all the time leading up to the RFC of people banging on it. We've also had [editors updating to the new format](https://github.com/saviorisdead/RustyCode/pull/159) and expect more to follow. We also have an [issue on old skool](https://github.com/rust-lang/rust/issues/35330) that needs to be fixed as more errors are switched to the new style, but it seems silly to fix old skool errors when we fully intend to throw the switch in the near future. This makes it lean towards "why not just throw the switch now, rather than waiting a couple more weeks?" I only know of vim that wanted to try to parse the new format but were not sure how, and I think we can reach out to them and work out something in the 8 weeks before this would appear in a stable release. We've [hashed out](https://github.com/rust-lang/rust/issues/35330) stabilizing JSON output, and it seems like people are relatively happy making what we have v1 and then likely adding to it in the future. The idea is that we'd maintain backward compatibility and just add new fields as needed. We'll also work on a separate output format that'd be better suited for interactive tools like IDES (since JSON message can get a little long depending on the error). This PR stabilizes JSON mode, allowing its use without `-Z unstable-options` Combined, this gives editors two ways to support errors going forward: parsing the new error format or using the JSON mode. By moving JSON to stable, we can also add support to Cargo, which plugin authors tell us does help simplify their support story. r? @nikomatsakis cc @rust-lang/tools Closes https://github.com/rust-lang/rust/issues/34826
2016-08-09Auto merge of #35166 - nikomatsakis:incr-comp-ice-34991-2, r=mwbors-7/+11
Address ICEs running w/ incremental compilation and building glium Fixes for various ICEs I encountered trying to build glium with incremental compilation enabled. Building glium now works. Of the 4 ICEs, I have test cases for 3 of them -- I didn't isolate a test for the last commit and kind of want to go do other things -- most notably, figuring out why incremental isn't saving much *effort*. But if it seems worthwhile and I can come back and try to narrow down the problem. r? @michaelwoerister Fixes #34991 Fixes #32015
2016-08-08track MIR through the dep-graphNiko Matsakis-7/+11
Per the discussion on #34765, we make one `DepNode::Mir` variant and use it to represent both the MIR tracking map as well as passes that operate on MIR. We also track loads of cached MIR (which naturally comes from metadata). Note that the "HAIR" pass adds a read of TypeckItemBody because it uses a myriad of tables that are not individually tracked.
2016-08-07Turn on new errors, json mode. Remove duplicate unicode testJonathan Turner-12/+3
2016-08-06Merge branch 'master' into issue-30961Cameron Hart-39/+45
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-03begin auditing the C++ types in RustWrapperAriel Ben-Yehuda-1/+1
2016-08-01deaggregate structs to enable further optimizationScott A Carr-0/+2
2016-07-31Don't gate methods `Fn(Mut,Once)::call(mut,once)` with feature ↵Vadim Petrochenkov-1/+0
`unboxed_closures` They are already gated with feature `fn_traits`
2016-07-29Auto merge of #34842 - cgswords:attr_enc, r=nrcbors-19/+14
Better attribute and metaitem encapsulation throughout the compiler This PR refactors most (hopefully all?) of the `MetaItem` interactions outside of `libsyntax` (and a few inside) to interact with MetaItems through the provided traits instead of directly creating / destruct / matching against them. This is a necessary first step to eventually converting `MetaItem`s to internally use `TokenStream` representations (which will make `MetaItem` interactions much nicer for macro writers once the new macro system is in place). r? @nrc
2016-07-28Auto merge of #34980 - cardoe:expose-target-options, r=alexcrichtonbors-1/+1
Convert built-in targets to JSON Convert the built-in targets to JSON to ensure that the JSON parser is always fully featured. This follows on #32988 and #32847. The PR includes a number of extra commits that are just intermediate changes necessary for bisectibility and the ability to prove correctness of the change.
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-27librustc_back: filter targets for only valid onesJonathan Creekmore-1/+1
Since we can know which targets are instantiable on a particular host, it does not make sense to list invalid targets in the target print code. Filter the list of targets to only include the targets that can be instantiated.
2016-07-25Adressed PR comments.cgswords-6/+3
2016-07-25General MetaItem encapsulation rewrites.cgswords-19/+17
2016-07-24Tidy ups for code gen options helpCameron Hart-12/+11
Remove duplication code gen options and updated help to reflect changes.
2016-07-19Merge branch 'master' into issue-30961Cameron Hart-34/+47
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-17Auto merge of #34860 - jseyfried:encapsulate_hygiene, r=nrcbors-9/+8
Clean up and encapsulate `syntax::ext::mtwt`, rename `mtwt` to `hygiene` r? @nrc
2016-07-17Rename `mtwt` to `hygiene`Jeffrey Seyfried-6/+6
2016-07-17Clean up and encapsulate `syntax::ext::mtwt`Jeffrey Seyfried-5/+4
2016-07-17Auto merge of #34789 - jonathandturner:simplify_liberror, r=alexcrichtonbors-25/+39
Simplify librustc_errors This is part 2 of the error crate refactor, starting with #34403. In this refactor, I focused on slimming down the error crate to fewer moving parts. As such, I've removed quite a few parts and replaced the with simpler, straight-line code. Specifically, this PR: * Removes BasicEmitter * Remove emit from emitter, leaving emit_struct * Renames emit_struct to emit * Removes CoreEmitter and focuses on a single Emitter * Implements the latest changes to error format RFC (#1644) * Removes (now-unused) code in emitter.rs and snippet.rs * Moves more tests to the UI tester, removing some duplicate tests in the process There is probably more that could be done with some additional refactoring, but this felt like it was getting to a good state. r? @alexcrichton cc: @Manishearth (as there may be breaking changes in stuff I removed/changed)
2016-07-16Merge branch 'master' into issue-30961Cameron Hart-63/+19
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