about summary refs log tree commit diff
path: root/src/librustc_driver
AgeCommit message (Collapse)AuthorLines
2016-05-30Move driver::Resolutions::def_map out of its RefCell.Ms2ger-7/+8
2016-05-28Auto merge of #33821 - sanxiyn:cfg-test, r=nikomatsakisbors-1/+4
Do not inject test harness for --cfg test Fix #33670.
2016-05-27Auto merge of #33706 - jseyfried:refactor_cfg, r=nrcbors-9/+0
Perform `cfg` attribute processing during macro expansion and fix bugs This PR refactors `cfg` attribute processing and fixes bugs. More specifically: - It merges gated feature checking for stmt/expr attributes, `cfg_attr` processing, and `cfg` processing into a single fold. - This allows feature gated `cfg` variables to be used in `cfg_attr` on unconfigured items. All other feature gated attributes can already be used on unconfigured items. - It performs `cfg` attribute processing during macro expansion instead of after expansion so that macro-expanded items are configured the same as ordinary items. In particular, to match their non-expanded counterparts, - macro-expanded unconfigured macro invocations are no longer expanded, - macro-expanded unconfigured macro definitions are no longer usable, and - feature gated `cfg` variables on macro-expanded macro definitions/invocations are now errors. This is a [breaking-change]. For example, the following would break: ```rust macro_rules! m { () => { #[cfg(attr)] macro_rules! foo { () => {} } foo!(); // This will be an error macro_rules! bar { () => { fn f() {} } } #[cfg(attr)] bar!(); // This will no longer be expanded ... fn g() { f(); } // ... so that `f` will be unresolved. #[cfg(target_thread_local)] // This will be a gated feature error macro_rules! baz { () => {} } } } m!(); ``` r? @nrc
2016-05-27Rollup merge of #33839 - kamalmarhubi:codemape-get-filemap-option, r=nmatsakisManish Goregaokar-0/+1
This is more idiomatic, putting the caller in charge of whether or not to panic.
2016-05-27Strip unconfigured items during macro expansionJeffrey Seyfried-9/+0
2016-05-25trans: save metadata even with -Z no-trans.Eduard Burtescu-4/+0
2016-05-24syntax: Make codemap::get_filemap() return an OptionKamal Marhubi-0/+1
This is more idiomatic, putting the caller in charge of whether or not to panic.
2016-05-24Remove unused field and argumentSeo Sanghyeon-1/+0
2016-05-24Do not inject test harness for --cfg testSeo Sanghyeon-1/+5
2016-05-20Auto merge of #33553 - alexcrichton:cdylibs, r=brsonbors-0/+3
rustc: Add a new crate type, cdylib This commit is an implementation of [RFC 1510] which adds a new crate type, `cdylib`, to the compiler. This new crate type differs from the existing `dylib` crate type in a few key ways: * No metadata is present in the final artifact * Symbol visibility rules are the same as executables, that is only reachable `extern` functions are visible symbols * LTO is allowed * All libraries are always linked statically This commit is relatively simple by just plubming the compiler with another crate type which takes different branches here and there. The only major change is an implementation of the `Linker::export_symbols` function on Unix which now actually does something. This helps restrict the public symbols from a cdylib on Unix. With this PR a "hello world" `cdylib` is 7.2K while the same `dylib` is 2.4MB, which is some nice size savings! [RFC 1510]: https://github.com/rust-lang/rfcs/pull/1510 Closes #33132
2016-05-19rustc: Add a new crate type, cdylibAlex Crichton-0/+3
This commit is an implementation of [RFC 1510] which adds a new crate type, `cdylib`, to the compiler. This new crate type differs from the existing `dylib` crate type in a few key ways: * No metadata is present in the final artifact * Symbol visibility rules are the same as executables, that is only reachable `extern` functions are visible symbols * LTO is allowed * All libraries are always linked statically This commit is relatively simple by just plubming the compiler with another crate type which takes different branches here and there. The only major change is an implementation of the `Linker::export_symbols` function on Unix which now actually does something. This helps restrict the public symbols from a cdylib on Unix. With this PR a "hello world" `cdylib` is 7.2K while the same `dylib` is 2.4MB, which is some nice size savings! [RFC 1510]: https://github.com/rust-lang/rfcs/pull/1510 Closes #33132
2016-05-18ignore dep-graph in resolve and lower_crateNiko Matsakis-1/+1
This got removed at some point, it seems.
2016-05-18thread the DepGraph to session/crate-storeNiko Matsakis-15/+22
This is a [breaking-change] for plugin authors. You must now create a dep-graph earlier.
2016-05-14Rollup merge of #33544 - dotdash:baby_dont_break_me_no_more, r=AatchManish Goregaokar-1/+1
Only break critical edges where actually needed Currently, to prepare for MIR trans, we break _all_ critical edges, although we only actually need to do this for edges originating from a call that gets translated to an invoke instruction in LLVM. This has the unfortunate effect of undoing a bunch of the things that SimplifyCfg has done. A particularly bad case arises when you have a C-like enum with N variants and a derived PartialEq implementation. In that case, the match on the (&lhs, &rhs) tuple gets translated into nested matches with N arms each and a basic block each, resulting in N² basic blocks. SimplifyCfg reduces that to roughly 2*N basic blocks, but breaking the critical edges means that we go back to N². In nickel.rs, there is such an enum with roughly N=800. So we get about 640K basic blocks or 2.5M lines of LLVM IR. LLVM takes a while to reduce that to the final "disr_a == disr_b". So before this patch, we had 2.5M lines of IR with 640K basic blocks, which took about about 3.6s in LLVM to get optimized and translated. After this patch, we get about 650K lines with about 1.6K basic blocks and spent a little less than 0.2s in LLVM. cc #33111 r? @Aatch
2016-05-13Auto merge of #33538 - Ms2ger:LocalCrateReader, r=arielb1bors-14/+12
Refactor code around LocalCrateReader.
2016-05-13Auto merge of #33532 - jseyfried:mutable_lowering_context, r=nrcbors-3/+2
Clean up `hir::lowering` Clean up `hir::lowering`: - give lowering functions mutable access to the lowering context - refactor the `lower_*` functions and other functions that take a lowering context into methods - simplify the API that `hir::lowering` exposes to `driver` - other miscellaneous cleanups r? @nrc
2016-05-12Auto merge of #33450 - SiegeLord:dep_info_no_analysis, r=nrcbors-45/+74
Make --emit dep-info work correctly with -Z no-analysis again. Previously, it would attempt to resolve some external crates that weren't necessary for dep-info output. Fixes #33231.
2016-05-11Only break critical edges where actually neededBjörn Steinbrink-1/+1
Currently, to prepare for MIR trans, we break _all_ critical edges, although we only actually need to do this for edges originating from a call that gets translated to an invoke instruction in LLVM. This has the unfortunate effect of undoing a bunch of the things that SimplifyCfg has done. A particularly bad case arises when you have a C-like enum with N variants and a derived PartialEq implementation. In that case, the match on the (&lhs, &rhs) tuple gets translated into nested matches with N arms each and a basic block each, resulting in N² basic blocks. SimplifyCfg reduces that to roughly 2*N basic blocks, but breaking the critical edges means that we go back to N². In nickel.rs, there is such an enum with roughly N=800. So we get about 640K basic blocks or 2.5M lines of LLVM IR. LLVM takes a while to reduce that to the final "disr_a == disr_b". So before this patch, we had 2.5M lines of IR with 640K basic blocks, which took about about 3.6s in LLVM to get optimized and translated. After this patch, we get about 650K lines with about 1.6K basic blocks and spent a little less than 0.2s in LLVM. cc #33111
2016-05-11Make LocalCrateReader private to creader.Ms2ger-5/+4
2016-05-11Hand ownership of the Definitions to map_crate.Ms2ger-3/+0
2016-05-10Also rename the print_from_ast.Pavel Sountsov-22/+22
2016-05-11rustc: Split local type contexts interners from the global one.Eduard Burtescu-5/+5
2016-05-11rustc: More interning for data used in Ty<'tcx>.Eduard Burtescu-2/+2
2016-05-11rustc: Wrap users of InferCtxt in an anonymous scope.Eduard Burtescu-19/+19
2016-05-11rustc: Split 'tcx into 'gcx and 'tcx for InferCtxt and its users.Eduard Burtescu-18/+18
2016-05-11rustc: Replace &'a TyCtxt<'tcx> with a TyCtxt<'a, 'tcx> wrapper.Eduard Burtescu-15/+19
2016-05-11rustc: Avoid free functions taking &TyCtxt and &InferCtxt.Eduard Burtescu-5/+2
2016-05-11infer: Use methods for creating an InferCtxt.Eduard Burtescu-4/+2
2016-05-10Delay wrapping Definitions into a RefCell around LocalCrateReader.Ms2ger-10/+12
2016-05-10Rename after_ast to after_hir_lowering.Pavel Sountsov-19/+19
2016-05-10Fix funky formatting.Pavel Sountsov-11/+10
2016-05-10Make --emit dep-info work correctly with -Z no-analysis again.Pavel Sountsov-40/+70
Previously, it would attempt to resolve some external crates that weren't necessary for dep-info output. Fixes #33231.
2016-05-10Store a reference rather than a RefCell in LocalCrateReader.Ms2ger-2/+2
2016-05-10Refactor `hir::lowering` APIJeffrey Seyfried-3/+2
2016-05-10Refactor the `hir::lowering::lower_*` functions into methods of ↵Jeffrey Seyfried-3/+3
`LoweringContext`
2016-05-10Give lowering functions mutable access to the lowering contextJeffrey Seyfried-2/+2
2016-05-09Fix fallout in `librustdoc` and in testsJeffrey Seyfried-11/+12
2016-05-09Refactor out `driver::lower_and_resolve`Jeffrey Seyfried-24/+34
2016-05-09Reimplement pretty printingJeffrey Seyfried-11/+29
2016-05-09Resolve paths generated in the ast->hir lowererJeffrey Seyfried-10/+11
2016-05-09Refactor the interface that `resolve` exposes to `driver`Jeffrey Seyfried-32/+36
2016-05-09Move resolution to before loweringJeffrey Seyfried-27/+36
2016-05-09Temporarily unimplement pretty printingJeffrey Seyfried-0/+6
2016-05-08Auto merge of #33091 - sanxiyn:unused-trait-import-3, r=nrcbors-3/+4
Warn unused trait imports, rebased Rebase of #30021. Fix #25730.
2016-05-08Auto merge of #33130 - eddyb:mir-const, r=nikomatsakisbors-5/+2
Implement constant support in MIR. All of the intended features in `trans::consts` are now supported by `mir::constant`. The implementation is considered a temporary measure until `miri` replaces it. A `-Z orbit` bootstrap build will only translate LLVM IR from AST for `#[rustc_no_mir]` functions. Furthermore, almost all checks of constant expressions have been moved to MIR. In non-`const` functions, trees of temporaries are promoted, as per RFC 1414 (rvalue promotion). Promotion before MIR borrowck would allow reasoning about promoted values' lifetimes. The improved checking comes at the cost of four `[breaking-change]`s: * repeat counts must contain a constant expression, e.g.: `let arr = [0; { println!("foo"); 5 }];` used to be allowed (it behaved like `let arr = [0; 5];`) * dereference of a reference to a `static` cannot be used in another `static`, e.g.: `static X: [u8; 1] = [1]; static Y: u8 = (&X)[0];` was unintentionally allowed before * the type of a `static` *must* be `Sync`, irrespective of the initializer, e.g. `static FOO: *const T = &BAR;` worked as `&T` is `Sync`, but it shouldn't because `*const T` isn't * a `static` cannot wrap `UnsafeCell` around a type that *may* need drop, e.g. `static X: MakeSync<UnsafeCell<Option<String>>> = MakeSync(UnsafeCell::new(None));` was previously allowed based on the fact `None` alone doesn't need drop, but in `UnsafeCell` it can be later changed to `Some(String)` which *does* need dropping The drop restrictions are relaxed by RFC 1440 (#33156), which is implemented, but feature-gated. However, creating `UnsafeCell` from constants is unstable, so users can just enable the feature gate.
2016-05-07mir: qualify and promote constants.Eduard Burtescu-5/+2
2016-05-03Fix more testsSeo Sanghyeon-1/+0
2016-05-03Warn unused trait importsSeo Sanghyeon-1/+4
2016-05-03Remove unused trait imports flagged by lintSeo Sanghyeon-1/+0
2016-05-02Auto merge of #33119 - nrc:pretty, r=pnkfelixbors-332/+398
Refactor pretty printing to use the compiler API