about summary refs log tree commit diff
path: root/src/librustc_driver
AgeCommit message (Collapse)AuthorLines
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-10/+11
2016-11-21TestsNick Cameron-0/+3
2016-11-21Read in rmeta cratesNick Cameron-1/+0
2016-11-21Add --crate-type metadataNick Cameron-0/+1
With the same semantics as -Zno-trans
2016-11-20Move `MetaItemKind`'s `Name` to a field of `MetaItem`.Jeffrey Seyfried-1/+2
2016-11-20Refactor `CrateConfig`.Jeffrey Seyfried-48/+22
2016-11-20Refactor `MetaItemKind` to use `Name`s instead of `InternedString`s.Jeffrey Seyfried-4/+3
2016-11-20Avoid clearing the string interner.Jeffrey Seyfried-3/+0
2016-11-19Auto merge of #37826 - keeperofdakeys:proc-macro-test, r=alexcrichtonbors-0/+2
Show a better error when using --test with #[proc_macro_derive] Fixes https://github.com/rust-lang/rust/issues/37480 Currently using `--test` with a crate that contains a `#[proc_macro_derive]` attribute causes an error. This PR doesn't attempt to fix the issue itself, or determine what tesing of a proc_macro_derive crate should be - just to provide a better error message.
2016-11-17Auto merge of #37660 - nikomatsakis:incremental-36349, r=eddybbors-3/+7
Separate impl items from the parent impl This change separates impl item bodies out of the impl itself. This gives incremental more resolution. In so doing, it refactors how the visitors work, and cleans up a bit of the collect/check logic (mostly by moving things out of collect that didn't really belong there, because they were just checking conditions). However, this is not as effective as I expected, for a kind of frustrating reason. In particular, when invoking `foo.bar()` you still wind up with dependencies on private items. The problem is that the method resolution code scans that list for methods with the name `bar` -- and this winds up touching *all* the methods, even private ones. I can imagine two obvious ways to fix this: - separating fn bodies from fn sigs (#35078, currently being pursued by @flodiebold) - a more aggressive model of incremental that @michaelwoerister has been advocating, in which we hash the intermediate results (e.g., the outputs of collect) so that we can see that the intermediate result hasn't changed, even if a particular impl item has changed. So all in all I'm not quite sure whether to land this or not. =) It still seems like it has to be a win in some cases, but not with the test cases we have just now. I can try to gin up some test cases, but I'm not sure if they will be totally realistic. On the other hand, some of the early refactorings to the visitor trait seem worthwhile to me regardless. cc #36349 -- well, this is basically a fix for that issue, I guess r? @michaelwoerister NB: Based atop of @eddyb's PR https://github.com/rust-lang/rust/pull/37402; don't land until that lands.
2016-11-17Auto merge of #37732 - jseyfried:use_extern_macros, r=nrcbors-2/+0
Support `use`ing externally defined macros behind `#![feature(use_extern_macros)]` With `#![feature(use_extern_macros)]`, - A name collision between macros from different upstream crates is much less of an issue since we can `use` the macros in different submodules or rename with `as`. - We can reexport macros with `pub use`, so `#![feature(macro_reexport)]` is no longer needed. - These reexports are allowed in any module, so crates can expose a macro-modular interface. If a macro invocation can resolve to both a `use` import and a `macro_rules!` or `#[macro_use]`, it is an ambiguity error. r? @nrc
2016-11-17Show a better error when using --test with #[proc_macro_derive]Josh Driver-0/+2
2016-11-17Auto merge of #37717 - nikomatsakis:region-obligations-pre, r=eddybbors-4/+3
Refactoring towards region obligation Two refactorings towards the intermediate goal of propagating region obligations through the `InferOk` structure (which in turn leads to the possibility of lazy normalization). 1. Remove `TypeOrigin` and add `ObligationCause` - as we converge subtyping and obligations and so forth, the ability to keep these types distinct gets harder 2. Propagate obligations from `InferOk` into the surrounding fulfillment context After these land, I have a separate branch (which still needs a bit of work) that can make the actual change to stop directly adding subregion edges and instead propagate obligations. (This should also make it easier to fix the unsoundness in specialization around lifetimes.) r? @eddyb
2016-11-17Resolve imports during expansion.Jeffrey Seyfried-2/+0
2016-11-16fallout from separating impl-items from implsNiko Matsakis-0/+4
Basically adding `visit_impl_item` in various places and so forth.
2016-11-16refactor Visitor into ItemLikeVisitor and intravisit::VisitorNiko Matsakis-3/+3
There are now three patterns (shallow, deep, and nested visit). These are described in detail on the docs in `itemlikevisit::ItemLikeVisitor`.
2016-11-16rustc: Implement #[link(cfg(..))] and crt-staticAlex Crichton-0/+29
This commit is an implementation of [RFC 1721] which adds a new target feature to the compiler, `crt-static`, which can be used to select how the C runtime for a target is linked. Most targets dynamically linke the C runtime by default with the notable exception of some of the musl targets. [RFC 1721]: https://github.com/rust-lang/rfcs/blob/master/text/1721-crt-static.md This commit first adds the new target-feature, `crt-static`. If enabled, then the `cfg(target_feature = "crt-static")` will be available. Targets like musl will have this enabled by default. This feature can be controlled through the standard target-feature interface, `-C target-feature=+crt-static` or `-C target-feature=-crt-static`. Next this adds an gated and unstable `#[link(cfg(..))]` feature to enable the `crt-static` semantics we want with libc. The exact behavior of this attribute is a little squishy, but it's intended to be a forever-unstable implementation detail of the liblibc crate. Specifically the `#[link(cfg(..))]` annotation means that the `#[link]` directive is only active in a compilation unit if that `cfg` value is satisfied. For example when compiling an rlib, these directives are just encoded and ignored for dylibs, and all staticlibs are continued to be put into the rlib as usual. When placing that rlib into a staticlib, executable, or dylib, however, the `cfg` is evaluated *as if it were defined in the final artifact* and the library is decided to be linked or not. Essentially, what'll happen is: * On MSVC with `-C target-feature=-crt-static`, the `msvcrt.lib` library will be linked to. * On MSVC with `-C target-feature=+crt-static`, the `libcmt.lib` library will be linked to. * On musl with `-C target-feature=-crt-static`, the object files in liblibc.rlib are removed and `-lc` is passed instead. * On musl with `-C target-feature=+crt-static`, the object files in liblibc.rlib are used and `-lc` is not passed. This commit does **not** include an update to the liblibc module to implement these changes. I plan to do that just after the 1.14.0 beta release is cut to ensure we get ample time to test this feature. cc #37406
2016-11-15remove TypeOrigin and use ObligationCause insteadNiko Matsakis-4/+3
In general having all these different structs for "origins" is not great, since equating types can cause obligations and vice-versa. I think we should gradually collapse these things. We almost certainly also need to invest a big more energy into the `error_reporting` code to rationalize it: this PR does kind of the minimal effort in that direction.
2016-11-14don't build an object file for emit=asm,llvm-irJorge Aparicio-1/+5
2016-11-12use write::run_assemblerJorge Aparicio-1/+12
2016-11-10rustc_typeck: correctly track "always-diverges" and "has-type-errors".Eduard Burtescu-2/+0
2016-11-10rustc: use an Expr instead of a Block for function bodies.Eduard Burtescu-6/+5
2016-11-09Rollup merge of #37636 - karpinski:issue-34915, r=nikomatsakisEduard-Mihai Burtescu-1/+6
Marking the 'no-stack-check' codegen option as deprecated (Issue #34915) Attempts to finish resolving issue #34915. Based on pull request #35156, which was closed due to inactivity.
2016-11-08Adding a deprecation warning for no-stack-check codegen option.karpinski-1/+6
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