about summary refs log tree commit diff
path: root/compiler/rustc_session/src
AgeCommit message (Collapse)AuthorLines
2021-10-07Rollup merge of #89476 - cjgillot:expn-id, r=petrochenkovJubilee-1/+8
Correct decoding of foreign expansions during incr. comp. Fixes https://github.com/rust-lang/rust/issues/74946 The original issue was due to a wrong assertion in `expn_hash_to_expn_id`. The secondary issue was due to a mismatch between the encoding and decoding paths for expansions that are created after the TyCtxt is created.
2021-10-06Enable AutoFDO.Michael Benfield-0/+23
This largely involves implementing the options debug-info-for-profiling and profile-sample-use and forwarding them on to LLVM. AutoFDO can be used on x86-64 Linux like this: rustc -O -Cdebug-info-for-profiling main.rs -o main perf record -b ./main create_llvm_prof --binary=main --out=code.prof rustc -O -Cprofile-sample-use=code.prof main.rs -o main2 Now `main2` will have feedback directed optimization applied to it. The create_llvm_prof tool can be obtained from this github repository: https://github.com/google/autofdo Fixes #64892.
2021-10-06Access Session while decoding expn_id.Camille GILLOT-1/+8
2021-10-05Auto merge of #89266 - cjgillot:session-ich, r=michaelwoeristerbors-1/+202
Move ICH to rustc_query_system Based on https://github.com/rust-lang/rust/pull/89183 The StableHashingContext does not need to be in rustc_middle. This PR moves it to rustc_query_system. This will avoid a dependency between rustc_ast_lowering and rustc_middle in https://github.com/rust-lang/rust/pull/89124.
2021-10-03Add some inlining.Camille GILLOT-0/+4
2021-10-03Move ICH to rustc_query_system.Camille GILLOT-0/+1
2021-10-03Move rustc_middle::middle::cstore to rustc_session.Camille GILLOT-1/+197
2021-10-03Practice diagnostic message conventionHirochika Matsumoto-1/+1
2021-10-01Rollup merge of #89322 - tmiasko:rm-optimization-fuel, r=michaelwoeristerManish Goregaokar-6/+1
Reapply "Remove optimization_fuel_crate from Session"
2021-09-30Implemented -Z randomize-layoutChase Wilson-0/+2
2021-09-28Reapply "Remove optimization_fuel_crate from Session"bjorn3-6/+1
2021-09-28rustc_session: Remove lint store from `Session`Vadim Petrochenkov-16/+1
2021-09-21Fix ICE with `--cap-lints=allow` and `-Zfuel=...=0`Fabian Wolff-1/+6
2021-09-17Rollup merge of #88751 - bjorn3:move_filesearch, r=oli-obkYuki Okushi-37/+37
Couple of changes to FileSearch and SearchPath * Turn a couple of regular comments into doc comments * Move `get_tools_search_paths` from `FileSearch` to `Session` * Use Lrc instead of Option to avoid duplication of a `SearchPath`
2021-09-15Rollup merge of #87320 - danakj:debug-compilation-dir, r=michaelwoeristerManish Goregaokar-3/+14
Introduce -Z remap-cwd-prefix switch This switch remaps any absolute paths rooted under the current working directory to a new value. This includes remapping the debug info in `DW_AT_comp_dir` and `DW_AT_decl_file`. Importantly, this flag does not require passing the current working directory to the compiler, such that the command line can be run on any machine (with the same input files) and produce the same results. This is critical property for debugging compiler issues that crop up on remote machines. This is based on adetaylor's https://github.com/rust-lang/rust/commit/dbc4ae7cba0ba8d650b91ddd459b86a02a2d05c5 Major Change Proposal: https://github.com/rust-lang/compiler-team/issues/450 Discussed on #38322. Would resolve issue #87325.
2021-09-12Auto merge of #88759 - Amanieu:panic_in_drop, r=nagisa,eddybbors-2/+14
Add -Z panic-in-drop={unwind,abort} command-line option This PR changes `Drop` to abort if an unwinding panic attempts to escape it, making the process abort instead. This has several benefits: - The current behavior when unwinding out of `Drop` is very unintuitive and easy to miss: unwinding continues, but the remaining drops in scope are simply leaked. - A lot of unsafe code doesn't expect drops to unwind, which can lead to unsoundness: - https://github.com/servo/rust-smallvec/issues/14 - https://github.com/bluss/arrayvec/issues/3 - There is a code size and compilation time cost to this: LLVM needs to generate extra landing pads out of all calls in a drop implementation. This can compound when functions are inlined since unwinding will then continue on to process drops in the callee, which can itself unwind, etc. - Initial measurements show a 3% size reduction and up to 10% compilation time reduction on some crates (`syn`). One thing to note about `-Z panic-in-drop=abort` is that *all* crates must be built with this option for it to be sound since it makes the compiler assume that dropping `Box<dyn Any>` will never unwind. cc https://github.com/rust-lang/lang-team/issues/97
2021-09-10Give spans their parent item during lowering.Camille GILLOT-0/+2
We only do this operation when incremental compilation is enabled. This avoids pessimizing the span handling for non-incremental compilation.
2021-09-09Add -Z panic-in-drop={unwind,abort} command-line optionAmanieu d'Antras-2/+14
2021-09-08Use Lrc instead of Option to avoid duplication of a SearchPathbjorn3-8/+8
2021-09-08Move get_tools_search_paths from FileSearch to Sessionbjorn3-13/+13
It only uses fields of FileSearch that are stored in Session too
2021-09-08Doc commentsbjorn3-17/+17
2021-09-08Revert "Remove optimization_fuel_crate from Session"bjorn3-1/+6
This reverts commit 5464b2e713d5366b3aec5c6eebbe1b84a782c51e.
2021-09-07remap-cwd-prefixdanakj-3/+14
2021-09-06Move `confused_type_with_std_module` to `ResolverOutputs`Aaron Hill-5/+0
This eliminates untracked global state from `Session`.
2021-09-02Add explanation for ctfe_backtrace lockbjorn3-0/+3
2021-09-02Remove print_fuel_crate field of Sessionbjorn3-6/+1
2021-09-02Remove optimization_fuel_crate from Sessionbjorn3-6/+1
2021-08-27Remove `Session.if_let_suggestions`Aaron Hill-4/+0
We can instead if either the LHS or RHS types contain `TyKind::Error`. In addition to covering the case where we would have previously updated `if_let_suggestions`, this might also prevent redundant errors in other cases as well.
2021-08-25don't generate partially-undef constsErik Desjardins-0/+3
2021-08-25Rollup merge of #88218 - Aaron1011:missing-method-dyn, r=nagisaLéo Lanteri Thauvin-4/+0
Remove `Session.trait_methods_not_found` Instead, avoid registering the problematic well-formed obligation to begin with. This removes global untracked mutable state, and avoids potential issues with incremental compilation.
2021-08-24Stabilize `force-warn`inquisitivecrystal-11/+1
2021-08-24Tidy up lint command line flagsinquisitivecrystal-11/+5
2021-08-24Auto merge of #87739 - Aaron1011:remove-used-attrs, r=wesleywiserbors-33/+5
Remove `Session.used_attrs` and move logic to `CheckAttrVisitor` Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-23Do not mark `-Z thir-unsafeck` as unsound anymoreLéo Lanteri Thauvin-1/+1
2021-08-21Remove `Session.trait_methods_not_found`Aaron Hill-4/+0
Instead, avoid registering the problematic well-formed obligation to begin with. This removes global untracked mutable state, and avoids potential issues with incremental compilation.
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-33/+5
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-15Include (potentially remapped) working dir in crate hashAaron Hill-14/+22
Fixes #85019 A `SourceFile` created during compilation may have a relative path (e.g. if rustc itself is invoked with a relative path). When we write out crate metadata, we convert all relative paths to absolute paths using the current working direction. However, the working directory is not included in the crate hash. This means that the crate metadata can change while the crate hash remains the same. Among other problems, this can cause a fingerprint mismatch ICE, since incremental compilation uses the crate metadata hash to determine if a foreign query is green. This commit moves the field holding the working directory from `Session` to `Options`, including it as part of the crate hash.
2021-08-12Auto merge of #85296 - bjorn3:plugin_cleanup, r=petrochenkovbors-6/+0
Plugin interface cleanup The first commit performs two uncontroversial cleanups. The second commit removes `#[plugin_registrar]` and instead requires you to export a `__rustc_plugin_registrar` function, this will require a change to servo's script_plugins (cc `@jdm)`
2021-08-10Replace #[plugin_registrar] with exporting __rustc_plugin_registrarbjorn3-6/+0
2021-08-09Auto merge of #87619 - 12101111:fix-native_link_modifiers_bundle, r=petrochenkovbors-19/+48
Fix feature gate checking of static-nobundle and native_link_modifiers Feature native_link_modifiers_bundle don't need feature static-nobundle to work. Also check the feature gates when using native_link_modifiers from command line options. Current nighly compiler don't check those feature gate. ``` > touch lib.rs > rustc +nightly lib.rs -L /usr/lib -l static:+bundle=dl --crate-type=rlib > rustc +nightly lib.rs -L /usr/lib -l dylib:+as-needed=dl --crate-type=dylib -Ctarget-feature=-crt-static > rustc +nightly lib.rs -L /usr/lib -l static:-bundle=dl --crate-type=rlib error[E0658]: kind="static-nobundle" is unstable | = note: see issue #37403 <https://github.com/rust-lang/rust/issues/37403> for more information = help: add `#![feature(static_nobundle)]` to the crate attributes to enable error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. ``` First found this in https://github.com/rust-lang/rust/pull/85600#discussion_r676612655
2021-08-08 Fix feature gate checking of static-nobundle and native_link_modifiers12101111-19/+48
2021-08-07Rollup merge of #87761 - rusticstuff:rustc_error_overflow, r=Mark-SimulacrumYuki Okushi-2/+1
Fix overflow in rustc happening if the `err_count()` is reduced in a stage. This can happen if stashed diagnostics are removed or replaced with fewer errors. The semantics stay the same if built without overflow checks. Fixes #84219. Background: I came across this independently by running `RUSTFLAGS="-C overflow-checks=on" ./x.py test`. Fixing this will allow us to move on and find further overflow errors with testing or fuzzing.
2021-08-06Rollup merge of #87756 - Amanieu:no_profiler_runtime, r=jackh726Yuki Okushi-2/+4
Add back -Zno-profiler-runtime This was removed by #85284 in favor of `-Zprofiler-runtime=<name>`.However the suggested `-Zprofiler-runtime=None` doesn't work because`None` is treated as a crate name.
2021-08-05Remove warnings/errors from compiler when using typeck_body in rustdoc span ↵Guillaume Gomez-0/+4
map builder
2021-08-04Fix overflow in rustc happening if the `err_count()` is reduced in a stage.Hans Kratz-2/+1
This can happen if stashed diagnostics are removed or replaced with fewer errors. The semantics stay the same if built without overflow. Fixes #84219.
2021-08-04Add back -Zno-profiler-runtimeAmanieu d'Antras-2/+4
This was removed by #85284 in favor of -Zprofiler-runtime=<name>. However the suggested -Zprofiler-runtime=None doesn't work because "None" is treated as a crate name.
2021-08-02Rollup merge of #87608 - Aaron1011:remove-system-library, r=Mark-SimulacrumYuki Okushi-5/+0
Remove unused field `Session.system_library_path`
2021-08-01Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisabors-2/+2
more clippy::complexity fixes (also a couple of clippy::perf fixes)
2021-07-30Use multispan suggestions more oftenEsteban Küber-14/+6
* Use more accurate span for `async move` suggestion * Use more accurate span for deref suggestion * Use `multipart_suggestion` more often
2021-07-29Remove unused field `Session.system_library_path`Aaron Hill-5/+0