summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2017-11-14Backported merge of #45785 - arielb1:unsafe-fixes, r=eddybbors-7/+21
fixes to MIR effectck r? @eddyb beta-nominating because regression (MIR effectck is new)
2017-10-20incr.comp.: Add missing match branch in HashStable impl for ty::RegionKind.Michael Woerister-0/+3
2017-10-09Auto merge of #45075 - alexcrichton:inline-less, r=michaelwoeristerbors-0/+2
rustc: Don't inline in CGUs at -O0 This commit tweaks the behavior of inlining functions into multiple codegen units when rustc is compiling in debug mode. Today rustc will unconditionally treat `#[inline]` functions by translating them into all codegen units that they're needed within, marking the linkage as `internal`. This commit changes the behavior so that in debug mode (compiling at `-O0`) rustc will instead only translate `#[inline]` functions into *one* codegen unit, forcing all other codegen units to reference this one copy. The goal here is to improve debug compile times by reducing the amount of translation that happens on behalf of multiple codegen units. It was discovered in #44941 that increasing the number of codegen units had the adverse side effect of increasing the overal work done by the compiler, and the suspicion here was that the compiler was inlining, translating, and codegen'ing more functions with more codegen units (for example `String` would be basically inlined into all codegen units if used). The strategy in this commit should reduce the cost of `#[inline]` functions to being equivalent to one codegen unit, which is only translating and codegen'ing inline functions once. Collected [data] shows that this does indeed improve the situation from [before] as the overall cpu-clock time increases at a much slower rate and when pinned to one core rustc does not consume significantly more wall clock time than with one codegen unit. One caveat of this commit is that the symbol names for inlined functions that are only translated once needed some slight tweaking. These inline functions could be translated into multiple crates and we need to make sure the symbols don't collideA so the crate name/disambiguator is mixed in to the symbol name hash in these situations. [data]: https://github.com/rust-lang/rust/issues/44941#issuecomment-334880911 [before]: https://github.com/rust-lang/rust/issues/44941#issuecomment-334583384
2017-10-09Auto merge of #45064 - alexcrichton:reduce-codegen-units, r=michaelwoeristerbors-2/+16
rustc: Reduce default CGUs to 16 Rationale explained in the included comment as well as #44941
2017-10-08Auto merge of #45016 - pnkfelix:mir-borrowck-gather-and-signal-move-errors, ↵bors-0/+13
r=nikomatsakis MIR-borrowck: gather and signal any move errors When building up the `MoveData` structure for a given MIR, also accumulate any erroneous actions, and then report all of those errors when the construction is complete. This PR adds a host of move-related error constructor methods to `trait BorrowckErrors`. I think I got the notes right; but we should plan to audit all of the notes before turning MIR-borrowck on by default. Fix #44830
2017-10-08Auto merge of #45012 - Gankro:noalias, r=arielb1bors-0/+2
Add -Zmutable-noalias flag We disabled noalias on mutable references a long time ago when it was clear that llvm was incorrectly handling this in relation to unwinding edges. Since then, a few things have happened: * llvm has cleaned up a bunch of the issues (I'm told) * we've added a nounwind codegen option As such, I would like to add this -Z flag so that we can evaluate if the codegen bugs still exist, and if this significantly affects the codegen of different projects, with an eye towards permanently re-enabling it (or at least making it a stable option).
2017-10-08Auto merge of #45100 - kennytm:rollup, r=kennytmbors-29/+30
Rollup of 10 pull requests - Successful merges: #45018, #45042, #45052, #45053, #45058, #45060, #45081, #45083, #45090, #45094 - Failed merges:
2017-10-08Rollup merge of #45090 - rust-lang:petrochenkov-patch-1, r=alexcrichtonkennytm-1/+2
Document that `-C ar=PATH` doesn't do anything Are there any plans to use an external archiver in the future? IIRC, it was used before, but its use was replaced with LLVM's built-in archive management machinery. I can't found a relevant PR though. EDIT: Found it - https://github.com/rust-lang/rust/pull/26926! The `-C` option is stable so it still can't be removed right away even if there are no plans to use it (but maybe it can be deprecated?). Target specifications have a field for archiver as well, which is unused too (these ones are unstable, so I guess it can be removed). r? @alexcrichton
2017-10-08Rollup merge of #45058 - hunteke:fix_rustc_private_typo_2017Oct, r=shepmasterkennytm-1/+1
Fix typo, per #45057. This looks like a simple string -- one character -- fix. Given that I'm currently running low on battery, I have not actually compiled and tested this. But I am fully confident this passes muster. If not, I'll be maintainer-educated, yes? ;-)
2017-10-08Rollup merge of #45018 - michaelwoerister:fix-dep-node-debug-recursion, r=eddybkennytm-27/+27
incr.comp.: Fix infinite recursion in Debug implementation of DepNode Small bug fix. Depends on #44901 to land first.
2017-10-08Auto merge of #44983 - vitiral:dirty_clean_groups, r=michaelwoeristerbors-0/+19
groundwork for rustc_clean/dirty improvements This is a WIP PR that needs mentoring from @michaelwoerister. There are several TODOs but no outstanding questions (except for the main one -- **is this the right approach?**) This is the plumbing for supporing groups in `rustc_clean(labels="...")`, as well as supporting an `except="..."` which will remove the excepted labels in the "clean" check and then assert that they are dirty (this is still TODO). See the code TODO's and example comments for a rough design. I'd like to know if this is the design you would like to do, and then I can go about actually filling out the groups and implementing the remaining logic.
2017-10-07rustc: Don't inline in CGUs at -O0Alex Crichton-0/+2
This commit tweaks the behavior of inlining functions into multiple codegen units when rustc is compiling in debug mode. Today rustc will unconditionally treat `#[inline]` functions by translating them into all codegen units that they're needed within, marking the linkage as `internal`. This commit changes the behavior so that in debug mode (compiling at `-O0`) rustc will instead only translate `#[inline]` functions into *one* codegen unit, forcing all other codegen units to reference this one copy. The goal here is to improve debug compile times by reducing the amount of translation that happens on behalf of multiple codegen units. It was discovered in #44941 that increasing the number of codegen units had the adverse side effect of increasing the overal work done by the compiler, and the suspicion here was that the compiler was inlining, translating, and codegen'ing more functions with more codegen units (for example `String` would be basically inlined into all codegen units if used). The strategy in this commit should reduce the cost of `#[inline]` functions to being equivalent to one codegen unit, which is only translating and codegen'ing inline functions once. Collected [data] shows that this does indeed improve the situation from [before] as the overall cpu-clock time increases at a much slower rate and when pinned to one core rustc does not consume significantly more wall clock time than with one codegen unit. One caveat of this commit is that the symbol names for inlined functions that are only translated once needed some slight tweaking. These inline functions could be translated into multiple crates and we need to make sure the symbols don't collideA so the crate name/disambiguator is mixed in to the symbol name hash in these situations. [data]: https://github.com/rust-lang/rust/issues/44941#issuecomment-334880911 [before]: https://github.com/rust-lang/rust/issues/44941#issuecomment-334583384
2017-10-07Auto merge of #44841 - alexcrichton:thinlto, r=michaelwoeristerbors-14/+6
rustc: Implement ThinLTO This commit is an implementation of LLVM's ThinLTO for consumption in rustc itself. Currently today LTO works by merging all relevant LLVM modules into one and then running optimization passes. "Thin" LTO operates differently by having more sharded work and allowing parallelism opportunities between optimizing codegen units. Further down the road Thin LTO also allows *incremental* LTO which should enable even faster release builds without compromising on the performance we have today. This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then also implements two forms of ThinLTO: * In one mode we'll *only* perform ThinLTO over the codegen units produced in a single compilation. That is, we won't load upstream rlibs, but we'll instead just perform ThinLTO amongst all codegen units produced by the compiler for the local crate. This is intended to emulate a desired end point where we have codegen units turned on by default for all crates and ThinLTO allows us to do this without performance loss. * In anther mode, like full LTO today, we'll optimize all upstream dependencies in "thin" mode. Unlike today, however, this LTO step is fully parallelized so should finish much more quickly. There's a good bit of comments about what the implementation is doing and where it came from, but the tl;dr; is that currently most of the support here is copied from upstream LLVM. This code duplication is done for a number of reasons: * Controlling parallelism means we can use the existing jobserver support to avoid overloading machines. * We will likely want a slightly different form of incremental caching which integrates with our own incremental strategy, but this is yet to be determined. * This buys us some flexibility about when/where we run ThinLTO, as well as having it tailored to fit our needs for the time being. * Finally this allows us to reuse some artifacts such as our `TargetMachine` creation, where all our options we used today aren't necessarily supported by upstream LLVM yet. My hope is that we can get some experience with this copy/paste in tree and then eventually upstream some work to LLVM itself to avoid the duplication while still ensuring our needs are met. Otherwise I fear that maintaining these bindings may be quite costly over the years with LLVM updates!
2017-10-07Document that `-C ar=PATH` doesn't do anythingVadim Petrochenkov-1/+2
2017-10-07Fix invalid rustdoc rendering for FnTy argsGuillaume Gomez-14/+11
2017-10-07rustc: Implement ThinLTOAlex Crichton-14/+6
This commit is an implementation of LLVM's ThinLTO for consumption in rustc itself. Currently today LTO works by merging all relevant LLVM modules into one and then running optimization passes. "Thin" LTO operates differently by having more sharded work and allowing parallelism opportunities between optimizing codegen units. Further down the road Thin LTO also allows *incremental* LTO which should enable even faster release builds without compromising on the performance we have today. This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then also implements two forms of ThinLTO: * In one mode we'll *only* perform ThinLTO over the codegen units produced in a single compilation. That is, we won't load upstream rlibs, but we'll instead just perform ThinLTO amongst all codegen units produced by the compiler for the local crate. This is intended to emulate a desired end point where we have codegen units turned on by default for all crates and ThinLTO allows us to do this without performance loss. * In anther mode, like full LTO today, we'll optimize all upstream dependencies in "thin" mode. Unlike today, however, this LTO step is fully parallelized so should finish much more quickly. There's a good bit of comments about what the implementation is doing and where it came from, but the tl;dr; is that currently most of the support here is copied from upstream LLVM. This code duplication is done for a number of reasons: * Controlling parallelism means we can use the existing jobserver support to avoid overloading machines. * We will likely want a slightly different form of incremental caching which integrates with our own incremental strategy, but this is yet to be determined. * This buys us some flexibility about when/where we run ThinLTO, as well as having it tailored to fit our needs for the time being. * Finally this allows us to reuse some artifacts such as our `TargetMachine` creation, where all our options we used today aren't necessarily supported by upstream LLVM yet. My hope is that we can get some experience with this copy/paste in tree and then eventually upstream some work to LLVM itself to avoid the duplication while still ensuring our needs are met. Otherwise I fear that maintaining these bindings may be quite costly over the years with LLVM updates!
2017-10-07Add names to BareFnTyGuillaume Gomez-2/+10
2017-10-07Auto merge of #44614 - tschottdorf:pat_adjustments, r=nikomatsakisbors-7/+94
implement pattern-binding-modes RFC See the [RFC] and [tracking issue]. [tracking issue]: #42640 [RFC]: https://github.com/rust-lang/rfcs/blob/491e0af/text/2005-match-ergonomics.md
2017-10-06implement pattern-binding-modes RFCTobias Schottdorf-7/+94
See the [RFC] and [tracking issue]. [tracking issue]: https://github.com/rust-lang/rust/issues/42640 [RFC]: https://github.com/rust-lang/rfcs/blob/491e0af/text/2005-match-ergonomics.md
2017-10-06Auto merge of #45065 - arielb1:not-correct, r=nikomatsakisbors-1/+1
fix logic error in #44269's `prune_cache_value_obligations` We want to retain obligations that *contain* inference variables, not obligations that *don't contain* them, in order to fix #43132. Because of surrounding changes to inference, the ICE doesn't occur in its original case, but I believe it could still be made to occur on master. Maybe I should try to write a new test case? Certainly not right now (I'm mainly trying to get us a beta that we can ship) but maybe before we land this PR on nightly? This seems to cause a 10% performance regression in my imprecise attempt to benchmark item-body checking for #43613, but it's better to be slow and right than fast and wrong. If we want to recover that, I think we can change the constrained-type-parameter code to actually give a list of projections that are important for resolving inference variables and filter everything else out.
2017-10-06fix logic error in #44269's `prune_cache_value_obligations`Ariel Ben-Yehuda-1/+1
We want to retain obligations that *contain* inference variables, not obligations that *don't contain* them, in order to fix #43132. Because of surrounding changes to inference, the ICE doesn't occur in its original case, but I believe it could still be made to occur on master. Maybe I should try to write a new test case? Certainly not right now (I'm mainly trying to get us a beta that we can ship) but maybe before we land this PR on nightly? This seems to cause a 10% performance regression in my imprecise attempt to benchmark item-body checking for #43613, but it's better to be slow and right than fast and wrong. If we want to recover that, I think we can change the constrained-type-parameter code to actually give a list of projections that are important for resolving inference variables and filter everything else out.
2017-10-06rustc: Reduce default CGUs to 16Alex Crichton-2/+16
Rationale explained in the included comment as well as #44941
2017-10-06Auto merge of #44818 - petrochenkov:astymac2, r=jseyfriedbors-15/+26
Improve resolution of associated types in declarative macros 2.0 Make various identifier comparisons for associated types (and sometimes other associated items) hygienic. Now declarative macros 2.0 can use `Self::AssocTy`, `TyParam::AssocTy`, `Trait<AssocTy = u8>` where `AssocTy` is an associated type of a trait `Trait` visible from the macro. Also, `Trait` can now be implemented inside the macro and specialization should work properly (fixes https://github.com/rust-lang/rust/pull/40847#issuecomment-310867299). r? @jseyfried or @eddyb
2017-10-05Fix typo, per #45057.Kevin Hunter Kesling-1/+1
2017-10-06Improve resolution of associated types in macros 2.0Vadim Petrochenkov-15/+26
2017-10-05Auto merge of #44943 - nivkner:fixme_fixup, r=dtolnaybors-2/+98
address some FIXME whose associated issues were marked as closed part of #44366
2017-10-05Auto merge of #44878 - Nashenas88:master, r=nikomatsakisbors-43/+4
Store a new Region value every time we create a new region variable Paired with @spastorino to walk through this and implement #44870.
2017-10-05Rollup merge of #45006 - MaikKlein:patch-2, r=nikomatsakiskennytm-1/+1
Typo in `librustc/README.md`
2017-10-05Fix infinite recursion in <DepNode as Debug>.Michael Woerister-27/+27
2017-10-05Auto merge of #44940 - philipc:remap-path, r=michaelwoeristerbors-3/+2
Don't use remapped path when loading modules and include files Fixes bug reported in https://github.com/rust-lang/rust/issues/41555#issuecomment-327866056. cc @michaelwoerister
2017-10-04Generate SerializedDepNodeIndex using newtype_index macroSantiago Pastorino-18/+2
2017-10-04Generate DepNodeIndexNew using newtype_index macroSantiago Pastorino-1/+2
2017-10-04Move newtype_index to rustc_data_structuresSantiago Pastorino-25/+1
2017-10-04Auto merge of #44901 - michaelwoerister:on-demand-eval, r=nikomatsakisbors-526/+855
incr.comp.: Switch to red/green change tracking, remove legacy system. This PR finally switches incremental compilation to [red/green tracking](https://github.com/rust-lang/rust/issues/42293) and completely removes the legacy dependency graph implementation -- which includes a few quite costly passes that are simply not needed with the new system anymore. There's still some documentation to be done and there's certainly still lots of optimizing and tuning ahead -- but the foundation for red/green is in place with this PR. This has been in the making for a long time `:)` r? @nikomatsakis cc @alexcrichton, @rust-lang/compiler
2017-10-04avoid using match keyword as module nameNiv Kaminer-1/+1
2017-10-04groundwork for #45009: rustc_dirty/clean enhancementsGarrett Berg-0/+19
2017-10-04seperate and move miscellaneous benchmarks to librustcNiv Kaminer-0/+98
2017-10-04Add method to `Mir` that maps a `Location` to its `SourceInfo`.Felix S. Klock II-0/+13
2017-10-04incr.comp.: Address review comments.Michael Woerister-31/+71
2017-10-03Add -Zmutable-noalias flagAlexis Beingessner-0/+2
2017-10-03Typo in `librustc/README.md`Maik Klein-1/+1
2017-10-03Auto merge of #44896 - qmx:move-resolve-to-librustc, r=arielb1bors-0/+211
Move monomorphize::resolve() to librustc this moves `monomorphize::resolve(..)` to librustc, and re-enables inlining for some trait methods, fixing #44389 @nikomatsakis I've kept the calls to the new `ty::Instance::resolve(....)` always `.unwrap()`-ing for the moment, how/do you want to add more debugging info via `.unwrap_or()` or something like this? we still have some related `resolve_*` functions on monomorphize, but I wasn't sure moving them was into the scope for this PR too. @eddyb mind to take a look too?
2017-10-03incr.comp.: Fix some merge fallout.Michael Woerister-1/+1
2017-10-03Rename FileMap::path and change to an OptionPhilip Craig-1/+1
2017-10-02incr.comp.: Do some cleanup.Michael Woerister-1/+4
2017-10-02incr.comp.: Remove legacy dep-graph runtime.Michael Woerister-386/+87
2017-10-02incr.comp.: Remove saving and loading of legacy dep-graph.Michael Woerister-1/+3
2017-10-02incr.comp.: Build DepGraphQuery from new dep-graph impl.Michael Woerister-13/+13
2017-10-02incr.comp.: Use red/green tracking for CGU re-use.Michael Woerister-21/+62
2017-10-02incr.comp.: Add some logging to DepGraph::try_mark_green().Michael Woerister-4/+32