summary refs log tree commit diff
path: root/src/librustc_driver
AgeCommit message (Collapse)AuthorLines
2016-11-08Auto merge of #36843 - petrochenkov:dotstab, r=nikomatsakisbors-1/+1
Stabilize `..` in tuple (struct) patterns I'd like to nominate `..` in tuple and tuple struct patterns for stabilization. This feature is a relatively small extension to existing stable functionality and doesn't have known blockers. The feature first appeared in Rust 1.10 6 months ago. An example of use: https://github.com/rust-lang/rust/pull/36203 Closes https://github.com/rust-lang/rust/issues/33627 r? @nikomatsakis
2016-11-05Rollup merge of #37583 - michaelwoerister:hir-stats, r=alexcrichtonAlex Crichton-2/+17
Add `-Z hir-stats` for collecting statistics on HIR and AST The data collected will be printed to the commandline and looks like the following: ``` // stats for libcore PRE EXPANSION AST STATS Name Accumulated Size Count Item Size ---------------------------------------------------------------- TypeBinding 2_280 57 40 Mod 3_560 89 40 PathListItem 6_516 181 36 Variant 7_872 82 96 LifetimeDef 21_280 380 56 StructField 22_880 260 88 Lifetime 23_800 1_190 20 Local 30_192 629 48 ForeignItem 31_504 179 176 Arm 42_880 670 64 Mac 46_960 587 80 FnDecl 57_792 1_204 48 TraitItem 69_504 362 192 TyParamBound 98_280 945 104 Block 108_384 2_258 48 Stmt 144_720 3_618 40 ImplItem 230_272 1_028 224 Item 467_456 1_826 256 Pat 517_776 4_623 112 Attribute 745_680 15_535 48 Ty 1_114_848 9_954 112 PathSegment 1_218_528 16_924 72 Expr 3_082_408 20_279 152 ---------------------------------------------------------------- Total 8_095_372 POST EXPANSION AST STATS Name Accumulated Size Count Item Size ---------------------------------------------------------------- MacroDef 1_056 12 88 Mod 3_400 85 40 TypeBinding 4_280 107 40 PathListItem 6_516 181 36 Variant 7_872 82 96 StructField 24_904 283 88 ForeignItem 31_504 179 176 TraitItem 69_504 362 192 Local 85_008 1_771 48 Arm 100_288 1_567 64 Lifetime 123_980 6_199 20 LifetimeDef 126_728 2_263 56 TyParamBound 297_128 2_857 104 FnDecl 305_856 6_372 48 Block 481_104 10_023 48 Stmt 535_120 13_378 40 Item 1_469_952 5_742 256 Attribute 1_629_840 33_955 48 ImplItem 1_732_864 7_736 224 Pat 2_360_176 21_073 112 PathSegment 5_888_448 81_784 72 Ty 6_237_168 55_689 112 Expr 12_013_320 79_035 152 ---------------------------------------------------------------- Total 33_536_016 HIR STATS Name Accumulated Size Count Item Size ---------------------------------------------------------------- MacroDef 864 12 72 Mod 2_720 85 32 TypeBinding 3_424 107 32 PathListItem 5_068 181 28 Variant 6_560 82 80 StructField 20_376 283 72 ForeignItem 27_208 179 152 WherePredicate 43_776 684 64 TraitItem 52_128 362 144 Decl 68_992 2_156 32 Local 89_184 1_858 48 Arm 94_368 1_966 48 LifetimeDef 108_624 2_263 48 Lifetime 123_980 6_199 20 Stmt 168_000 4_200 40 TyParamBound 251_416 2_857 88 FnDecl 254_880 6_372 40 Block 583_968 12_166 48 Item 1_240_272 5_742 216 ImplItem 1_361_536 7_736 176 Attribute 1_620_480 33_760 48 Pat 2_073_120 21_595 96 Path 2_385_856 74_558 32 Ty 4_455_040 55_688 80 PathSegment 5_587_904 87_311 64 Expr 7_588_992 79_052 96 ---------------------------------------------------------------- Total 28_218_736 ```
2016-11-04Rollup merge of #37408 - eddyb:lazy-5, r=nikomatsakisAlex Crichton-1/+1
[5/n] rustc: record the target type of every adjustment. _This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37404) | [next](https://github.com/rust-lang/rust/pull/37412)) 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 rearranges `tcx.tables` so that all users go through `tcx.tables()`. This in preparation for per-body `Tables` where they will be requested for a specific `DefId`. Included to minimize churn. The rest of the changes focus on adjustments, there are some renamings, but the main addition is the target type, always available in all cases (as opposed to just for unsizing where it was previously needed). Possibly the most significant effect of this change is that figuring out the final type of an expression is now _always_ just one successful `HashMap` lookup (either the adjustment or, if that doesn't exist, the node type).
2016-11-04Add -Zhir-stats for collecting statistics on HIR and ASTMichael Woerister-2/+17
2016-11-03Auto merge of #36306 - nagisa:mir-local-cleanup, r=eddybbors-9/+12
A way to remove otherwise unused locals from MIR There is a certain amount of desire for a pass which cleans up the provably unused variables (no assignments or reads). There has been an implementation of such pass by @scottcarr, and another (two!) implementations by me in my own dataflow efforts. PR like https://github.com/rust-lang/rust/pull/35916 proves that this pass is useful even on its own, which is why I cherry-picked it out from my dataflow effort. @nikomatsakis previously expressed concerns over this pass not seeming to be very cheap to run and therefore unsuitable for regular cleanup duties. Turns out, regular cleanup of local declarations is not at all necessary, at least now, because majority of passes simply do not (or should not) care about them. That’s why it is viable to only run this pass once (perhaps a few more times in the future?) per function, right before translation. r? @eddyb or @nikomatsakis
2016-11-03A way to remove otherwise unused locals from MIRSimonas Kazlauskas-9/+12
Replaces the hack where a similar thing is done within trans.
2016-11-03Stabilize `..` in tuple (struct) patternsVadim Petrochenkov-1/+1
2016-11-02rustc: make all read access to tcx.tables go through a method.Eduard Burtescu-1/+1
2016-11-01Rollup merge of #37296 - srinivasreddy:librustc_driver, r=nikomatsakisGuillaume Gomez-188/+191
run rustfmt on librustc_driver folder
2016-10-30Make the crate disambiguator 128 bits instead of 256 bits.Michael Woerister-1/+8
2016-10-30Add rustc_data_structures to rustc_driver dependencies.Michael Woerister-0/+1
2016-10-30Replace all uses of SHA-256 with BLAKE2b.Michael Woerister-10/+14
2016-10-30Auto merge of #37431 - jseyfried:refactor_crate_config, r=eddybbors-43/+24
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-30run rustfmt on librustc_driver folderSrinivas Reddy Thatiparthy-188/+191
2016-10-29Move `CrateConfig` from `Crate` to `ParseSess`.Jeffrey Seyfried-43/+24
2016-10-28rustc: move the MIR map into TyCtxt.Eduard Burtescu-71/+39
2016-10-26Auto merge of #37270 - Mark-Simulacrum:smallvec-optimized-arenas, r=eddybbors-10/+9
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-10/+9
tup} calls.
2016-10-22Rename `loader.rs` -> `locator.rs`.Jeffrey Seyfried-3/+2
2016-10-22Remove `CrateReader`, use `CrateLoader` instead.Jeffrey Seyfried-1/+2
2016-10-19Use TypedArena::alloc_slice in rustc.Mark-Simulacrum-5/+5
2016-10-15include LLVM version in `--version --verbose`Zack M. Davis-0/+4
This is in the matter of #28405.
2016-10-12Rollup merge of #37084 - jseyfried:cleanup_expanded_macro_use_scopes, r=nrcAlex Crichton-3/+9
macros: clean up scopes of expanded `#[macro_use]` imports This PR changes the scope of macro-expanded `#[macro_use]` imports to match that of unexpanded `#[macro_use]` imports. For example, this would be allowed: ```rust example!(); macro_rules! m { () => { #[macro_use(example)] extern crate example_crate; } } m!(); ``` This PR also enforces the full shadowing restrictions from RFC 1560 on `#[macro_use]` imports (currently, we only enforce the weakened restrictions from #36767). This is a [breaking-change], but I believe it is highly unlikely to cause breakage in practice. r? @nrc
2016-10-12Rollup merge of #37066 - nrc:stderr, r=alexcrichtonAlex Crichton-1/+1
Error monitor should emit error to stderr instead of stdout We are pretty consistent about emitting to stderr, except for when there is actually an error, in which case we emit to stdout. This seems a bit backwards. This PR just changes that exception to emit to stderr. This is useful for the RLS since the LS protocol uses stdout (grrr). r? @alexcrichton
2016-10-12Stabilise `?`Nick Cameron-1/+1
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-10-11Merge branch 'persistent_macro_scopes' into cleanup_expanded_macro_use_scopesJeffrey Seyfried-3/+9
2016-10-10Error monitor should emit error to stderr instead of stdoutNick Cameron-1/+1
2016-10-07Refactor away `ext::expand::{expand_crate, expand_crate_with_expander}`.Jeffrey Seyfried-2/+8
2016-10-07Add macros from plugins in `libsyntax_ext::register_builtins`.Jeffrey Seyfried-2/+2
2016-10-06rustc: Rename rustc_macro to proc_macroAlex Crichton-14/+14
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-03Auto merge of #36847 - alexcrichton:rustc-macro-doc, r=nrcbors-12/+17
rustdoc: Fix documenting rustc-macro crates 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-30Change the sigs of set_print/set_panic to allow restoring the default objectsBrian Anderson-2/+2
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-28Rollup merge of #36760 - nrc:input2, r=alexcrichtonJonathan Turner-19/+20
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 supplying an error destination via the compiler driverNick Cameron-19/+20
Allows replacing stderr with a buffer from the client. Also, some refactoring around run_compiler.
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-26appease tidyTim Neumann-1/+2
2016-09-26deduplicate inline is_nightly_build implementationsTim Neumann-4/+1
2016-09-26refactor away get_unstable_features_settingTim Neumann-2/+2
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-21Auto merge of #36551 - eddyb:meta-games, r=nikomatsakisbors-9/+11
Refactor away RBML from rustc_metadata. RBML and `ty{en,de}code` have had their long-overdue purge. Summary of changes: * Metadata is now a tree encoded in post-order and with relative backward references pointing to children nodes. With auto-deriving and type safety, this makes maintenance and adding new information to metadata painless and bug-free by default. It's also more compact and cache-friendly (cache misses should be proportional to the depth of the node being accessed, not the number of siblings as in EBML/RBML). * Metadata sizes have been reduced, for `libcore` it went down 16% (`8.38MB` -> `7.05MB`) and for `libstd` 14% (`3.53MB` -> `3.03MB`), while encoding more or less the same information * Specialization is used in the bundled `libserialize` (crates.io `rustc_serialize` remains unaffected) to customize the encoding (and more importantly, decoding) of various types, most notably those interned in the `TyCtxt`. Some of this abuses a soundness hole pending a fix (cc @aturon), but when that fix arrives, we'll move to macros 1.1 `#[derive]` and custom `TyCtxt`-aware serialization traits. * Enumerating children of modules from other crates is now orthogonal to describing those items via `Def` - this is a step towards bridging crate-local HIR and cross-crate metadata * `CrateNum` has been moved to `rustc` and both it and `NodeId` are now newtypes instead of `u32` aliases, for specializing their decoding. This is `[syntax-breaking]` (cc @Manishearth ). cc @rust-lang/compiler
2016-09-20rustc_metadata: go only through rustc_serialize in astencode.Eduard Burtescu-9/+11
2016-09-20Auto merge of #36388 - pcwalton:copy-propagation, r=nikomatsakisbors-0/+1
librustc_mir: Implement def-use chains and trivial copy propagation on MIR. This only supports trivial cases in which there is exactly one def and one use. Currently, some random unrelated MIR tests are failing, probably just because they haven't been updated. r? @eddyb
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-19Auto merge of #36102 - GuillaumeGomez:rustc_metadata_diagnostics, ↵bors-0/+1
r=jonathandturner Rustc metadata diagnostics r? @jonathandturner
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-16Auto merge of #36444 - jseyfried:macro_rules_ext, r=nrcbors-1/+1
Remove variant `MacroRulesTT` of `SyntaxExtension` r? @nrc