about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/passes.rs
AgeCommit message (Collapse)AuthorLines
2021-03-29Don't duplicate the extern providers once for each cratebjorn3-8/+1
2021-03-08Rollup merge of #82415 - petrochenkov:modin3, r=davidtwcoDylan DPC-2/+4
expand: Refactor module loading This is an accompanying PR to https://github.com/rust-lang/rust/pull/82399, but they can be landed independently. See individual commits for more details. Anyone should be able to review this equally well because all people actually familiar with this code left the project.
2021-03-08Rollup merge of #82047 - the8472:fast-rename, r=davidtwcoDylan DPC-1/+1
bypass auto_da_alloc for metadata files This saves about 0.7% when rerunning the UI test suite. I.e. when the metadata files exist and will be overwritten. No improvements expected for a clean build. So it might show up in incr-patched perf results. ``` regular rename: Benchmark #1: touch src/tools/compiletest/src/main.rs ; RUSTC_WRAPPER="" schedtool -B -e ./x.py test src/test/ui Time (mean ± σ): 47.305 s ± 0.170 s [User: 1631.540 s, System: 412.648 s] Range (min … max): 47.125 s … 47.856 s 20 runs non-durable rename: Benchmark #1: touch src/tools/compiletest/src/main.rs ; RUSTC_WRAPPER="" schedtool -B -e ./x.py test src/test/ui Time (mean ± σ): 46.930 s ± 0.064 s [User: 1634.344 s, System: 396.038 s] Range (min … max): 46.759 s … 47.043 s 20 runs ``` There are more places that trigger auto_da_alloc behavior by overwriting existing files with O_TRUNC, but those are much harder to locate because `O_TRUNC` is set on `open()` but the writeback is triggered on `close()`. The latter is the part which shows up in profiles.
2021-03-05rustc_interface: Hide some hacky details of early linting from expandVadim Petrochenkov-2/+4
2021-02-25Rollup merge of #82269 - LeSeulArtichaut:cleanup-ppmode, r=spastorinoAaron Hill-1/+1
Cleanup `PpMode` and friends This PR: - Separates `PpSourceMode` and `PpHirMode` to remove invalid states - Renames the variant to remove the redundant `Ppm` prefix - Adds basic documentation for the different pretty-print modes - Cleanups some code to make it more idiomatic Not sure if this is actually useful, but it looks cleaner to me.
2021-02-19Move the query system to rustc_query_impl.Camille GILLOT-4/+4
2021-02-19Make QueryEngine opaque to TyCtxt.Camille GILLOT-9/+17
2021-02-19Cleanup `PpMode` and friendsLeSeulArtichaut-1/+1
2021-02-18Print -Ztime-passes (and misc stats/logs) on stderr, not stdout.Eduard-Mihai Burtescu-3/+3
2021-02-15Index Modules using their LocalDefId.Camille GILLOT-11/+8
2021-02-13bypass auto_da_alloc for metadata filesThe8472-1/+1
2021-01-28Rollup merge of #81284 - jyn514:impl-times, r=wesleywiserYuki Okushi-5/+12
Make `-Z time-passes` less noisy - Add the module name to `pre_AST_expansion_passes` and don't make it a verbose event (since it normally doesn't take very long, and it's emitted many times) - Don't make the following rustdoc events verbose; they're emitted many times. + build_extern_trait_impl + build_local_trait_impl + build_primitive_trait_impl + get_auto_trait_impls + get_blanket_trait_impls - Remove the `get_auto_trait_and_blanket_synthetic_impls` rustdoc event; it's wholly covered by get_{auto,blanket}_trait_impls and not very useful. I found this while working on https://github.com/rust-lang/rust/pull/81275 but it's independent of those changes.
2021-01-23Make `-Z time-passes` less noisyJoshua Nelson-5/+12
- Add the module name to `pre_AST_expansion_passes` and don't make it a verbose event (since it normally doesn't take very long, and it's emitted many times) - Don't make the following rustdoc events verbose; they're emitted many times. + build_extern_trait_impl + build_local_trait_impl + build_primitive_trait_impl + get_auto_trait_impls + get_blanket_trait_impls - Remove `get_auto_trait_and_blanket_synthetic_impls`; it's wholly covered by get_{auto,blanket}_trait_impls and not very useful.
2021-01-23Calculate self-profile strings in `Compiler::enter` instead in codegenJoshua Nelson-7/+0
This avoids each tool having to separately find and call `self_profile_alloc_strings`. - Don't compute the global context if it hasn't yet been computed This avoids giving extraneous errors about unresolved names if an error occurs during parsing.
2021-01-12Remove DepKind::CrateMetadata and pre-allocation of DepNodesTyson Nottingham-6/+0
Remove much of the special-case handling around crate metadata dependency tracking by replacing `DepKind::CrateMetadata` and the pre-allocation of corresponding `DepNodes` with on-demand invocation of the `crate_hash` query.
2021-01-10resolve: Simplify built-in macro tableVadim Petrochenkov-1/+1
2020-12-29Remove `compile-fail` test suiteVadim Petrochenkov-1/+1
2020-12-28Rollup merge of #79662 - bjorn3:move_more_code_out_of_codegen_backend, r=oli-obkDylan DPC-0/+17
Move some more code out of CodegenBackend::{codegen_crate,link} Kind of a follow up to #77795
2020-12-25Auto merge of #80296 - ↵bors-1/+18
wesleywiser:revert_missing_fragment_specifier_hard_error, r=Mark-Simulacrum Revert missing fragment specifier hard error Closes #76605 Reopens #40107 r? `@Mark-Simulacrum`
2020-12-22Add some intra-doc links to compiler docsJoshua Nelson-1/+1
2020-12-22Revert "Promote missing_fragment_specifier to hard error"Wesley Wiser-1/+18
This reverts commit 02eae432e7476a0686633a8c2b7cb1d5aab1bd2c.
2020-12-17Fix testsbjorn3-3/+6
2020-12-17Move some code out of CodegenBackend::{codegen_crate,link}bjorn3-0/+14
2020-12-01Auto merge of #74967 - Aaron1011:feature/incr-def-path-table, r=pnkfelixbors-1/+1
Implement lazy decoding of DefPathTable during incremental compilation PR https://github.com/rust-lang/rust/pull/75813 implemented lazy decoding of the `DefPathTable` from crate metadata. However, it requires decoding the entire `DefPathTable` when incremental compilation is active, so that we can map a decoded `DefPathHash` to a `DefId` from an arbitrary crate. This PR adds support for lazy decoding of dependency `DefPathTable`s when incremental compilation si active. When we load the incremental cache and dep graph, we need the ability to map a `DefPathHash` to a `DefId` in the current compilation session (if the corresponding definition still exists). This is accomplished by storing the old `DefId` (that is, the `DefId` from the previous compilation session) for each `DefPathHash` we need to remap. Since a `DefPathHash` includes the owning crate, the old crate is guaranteed to be the right one (if the definition still exists). We then use the old `DefIndex` as an initial guess, which we validate by comparing the expected and actual `DefPathHash`es. In most cases, foreign crates will be completely unchanged, which means that we our guess will be correct. If our guess is wrong, we fall back to decoding the entire `DefPathTable` for the foreign crate. This still represents an improvement over the status quo, since we can skip decoding the entire `DefPathTable` for other crates (where all of our guesses were correct).
2020-11-25Lazy DefPath decoding for incremental compilationAaron Hill-1/+1
2020-11-25Validate use of parameters in naked functionsTomasz Miąsko-0/+1
* Reject use of parameters inside naked function body. * Reject use of patterns inside function parameters, to emphasize role of parameters a signature declaration (mirroring existing behaviour for function declarations) and avoid generating code introducing specified bindings.
2020-11-19Move `rustc_ty` -> `rustc_ty_utils`LeSeulArtichaut-1/+1
2020-11-15Rollup merge of #79036 - cjgillot:steal, r=oli-obkJonas Schievink-1/+1
Move Steal to rustc_data_structures.
2020-11-14Move Steal to rustc_data_structures.Camille GILLOT-1/+1
2020-11-13cleanup: Remove `ParseSess::injected_crate_name`Vadim Petrochenkov-6/+2
2020-11-02Rollup merge of #78610 - petrochenkov:nostriptok, r=Aaron1011Yuki Okushi-88/+2
Do not remove tokens before AST json serialization `TokenStripper` is error-prone and introduces one more use of `MutVisitor`. It's much simpler to treat serialization as just one more place that wants lazy token stream to turn into a real token stream. Also, no code is better than more code, in general. r? @Aaron1011 (I also merged tests for `TokenStripper` ICEs into one.)
2020-11-01Auto merge of #75534 - Aaron1011:feature/new-future-breakage, r=pnkfelixbors-1/+4
Implement rustc side of report-future-incompat cc https://github.com/rust-lang/rust/issues/71249 This is an alternative to `@pnkfelix's` initial implementation in https://github.com/pnkfelix/rust/commits/prototype-rustc-side-of-report-future-incompat (mainly because I started working before seeing that branch :smile: ). My approach outputs the entire original `Diagnostic`, in a way that is compatible with incremental compilation. This is not yet integrated with compiletest, but can be used manually by passing `-Z emit-future-incompat-report` to `rustc`. Several changes are made to support this feature: * The `librustc_session/lint` module is moved to a new crate `librustc_lint_defs` (name bikesheddable). This allows accessing lint definitions from `librustc_errors`. * The `Lint` struct is extended with an `Option<FutureBreakage>`. When present, it indicates that we should display a lint in the future-compat report. `FutureBreakage` contains additional information that we may want to display in the report (currently, a `date` field indicating when the crate will stop compiling). * A new variant `rustc_error::Level::Allow` is added. This is used when constructing a diagnostic for a future-breakage lint that is marked as allowed (via `#[allow]` or `--cap-lints`). This allows us to capture any future-breakage diagnostics in one place, while still discarding them before they are passed to the `Emitter`. * `DiagnosticId::Lint` is extended with a `has_future_breakage` field, indicating whether or not the `Lint` has future breakage information (and should therefore show up in the report). * `Session` is given access to the `LintStore` via a new `SessionLintStore` trait (since `librustc_session` cannot directly reference `LintStore` without a cyclic dependency). We use this to turn a string `DiagnosticId::Lint` back into a `Lint`, to retrieve the `FutureBreakage` data. Currently, `FutureBreakage.date` is always set to `None`. However, this could potentially be interpreted by Cargo in the future. I've enabled the future-breakage report for the `ARRAY_INTO_ITER` lint, which can be used to test out this PR. The intent is to use the field to allow Cargo to determine the date of future breakage (as described in [RFC 2834](https://github.com/rust-lang/rfcs/blob/master/text/2834-cargo-report-future-incompat.md)) without needing to parse the diagnostic itself. cc `@pnkfelix`
2020-11-01Do not remove tokens before AST json serializationVadim Petrochenkov-88/+2
2020-10-30Implement rustc side of report-future-incompatAaron Hill-1/+4
2020-10-29Strip tokens from trait and impl items before printing AST JSONAaron Hill-0/+11
Fixes #78510
2020-10-26Remove tokens from foreign items in `TokenStripper`Aaron Hill-0/+7
Fixes #78398 I forgot to handle this case in #77255
2020-10-21Strip tokens before printing AST JSONAaron Hill-2/+70
2020-10-05Add -Z codegen-backend dylib to depskhyperia-0/+4
When the codegen-backend dylib changes, the program should be rebuilt.
2020-09-01interface: use `OnceCell` from standard librarymarmeladema-3/+3
2020-08-30Add `-Z proc-macro-backtrace` to allow showing proc-macro panicsAaron Hill-0/+1
Fixes #75050 Previously, we would unconditionally suppress the panic hook during proc-macro execution. This commit adds a new flag -Z proc-macro-backtrace, which allows running the panic hook for easier debugging.
2020-08-30mv compiler to compiler/mark-0/+1004