about summary refs log tree commit diff
path: root/compiler/rustc_session/src/session.rs
AgeCommit message (Collapse)AuthorLines
2021-10-06Enable AutoFDO.Michael Benfield-0/+10
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-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-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-9/+21
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-08Use Lrc instead of Option to avoid duplication of a SearchPathbjorn3-8/+8
2021-09-08Move get_tools_search_paths from FileSearch to Sessionbjorn3-1/+13
It only uses fields of FileSearch that are stored in Session too
2021-09-08Revert "Remove optimization_fuel_crate from Session"bjorn3-1/+6
This reverts commit 5464b2e713d5366b3aec5c6eebbe1b84a782c51e.
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-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-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/+1
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-10Replace #[plugin_registrar] with exporting __rustc_plugin_registrarbjorn3-6/+0
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-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-07-29Remove unused field `Session.system_library_path`Aaron Hill-5/+0
2021-07-23Rename `known_attrs` to `expanded_inert_attrs` and move to rustc_expandAaron Hill-10/+0
There's no need for this to be (untracked) global state.
2021-07-20Allow combining -Cprofile-generate and -Cpanic=unwind when targetingMichael Woerister-20/+1
MSVC. The LLVM limitation that previously prevented this has been fixed in LLVM 9 which is older than the oldest LLVM version we currently support. See https://github.com/rust-lang/rust/issues/61002.
2021-07-11Simplify future incompatible reporting.Eric Huss-19/+2
2021-07-06Auto merge of #86572 - rylev:force-warnings-always, r=nikomatsakisbors-1/+11
Force warnings even when can_emit_warnings == false Fixes an issue mentioned in #85512 with --cap-lints overriding --force-warnings. Fixes https://github.com/rust-lang/rust/issues/86751 r? `@ehuss`
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-13/+13
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-07-04Combine individual limit queries into single `limits` queryAaron Hill-0/+14
2021-07-04Query-ify global limit attribute handlingAaron Hill-38/+2
2021-07-01New force_warn diagnostic builder and ensure cap-lints doesn't reduce ↵Ryan Levick-0/+10
force_warn level
2021-06-30Add support for leaf fn frame pointer eliminationSimonas Kazlauskas-12/+0
This PR adds ability for the target specifications to specify frame pointer emission type that's not just “always” or “whatever cg decides”. In particular there's a new mode that allows omission of the frame pointer for leaf functions (those that don't call any other functions). We then set this new mode for Aarch64-based Apple targets. Fixes #86196
2021-06-30Force warnings even when can_emit_warnings == falseRyan Levick-1/+1
2021-06-17Emit warnings for unused fields in custom targets.Adam Bratschi-Kaye-1/+4
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-13/+13
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-02Miscellaneous inlining improvementsTomasz Miąsko-0/+2
2021-05-30Auto merge of #85559 - 12101111:sanitizer-crt-static, r=nagisabors-0/+8
Diagnose use sanitizers with crt-static Fix: https://github.com/rust-lang/rust/issues/85459
2021-05-30Merge CrateDisambiguator into StableCrateIdbjorn3-13/+13
2021-05-29Diagnose use sanitizers with crt-static12101111-0/+8
2021-05-12Auto merge of #83813 - cbeuw:remap-std, r=michaelwoeristerbors-5/+9
Fix `--remap-path-prefix` not correctly remapping `rust-src` component paths and unify handling of path mapping with virtualized paths This PR fixes #73167 ("Binaries end up containing path to the rust-src component despite `--remap-path-prefix`") by preventing real local filesystem paths from reaching compilation output if the path is supposed to be remapped. `RealFileName::Named` introduced in #72767 is now renamed as `LocalPath`, because this variant wraps a (most likely) valid local filesystem path. `RealFileName::Devirtualized` is renamed as `Remapped` to be used for remapped path from a real path via `--remap-path-prefix` argument, as well as real path inferred from a virtualized (during compiler bootstrapping) `/rustc/...` path. The `local_path` field is now an `Option<PathBuf>`, as it will be set to `None` before serialisation, so it never reaches any build output. Attempting to serialise a non-`None` `local_path` will cause an assertion faliure. When a path is remapped, a `RealFileName::Remapped` variant is created. The original path is preserved in `local_path` field and the remapped path is saved in `virtual_name` field. Previously, the `local_path` is directly modified which goes against its purpose of "suitable for reading from the file system on the local host". `rustc_span::SourceFile`'s fields `unmapped_path` (introduced by #44940) and `name_was_remapped` (introduced by #41508 when `--remap-path-prefix` feature originally added) are removed, as these two pieces of information can be inferred from the `name` field: if it's anything other than a `FileName::Real(_)`, or if it is a `FileName::Real(RealFileName::LocalPath(_))`, then clearly `name_was_remapped` would've been false and `unmapped_path` would've been `None`. If it is a `FileName::Real(RealFileName::Remapped{local_path, virtual_name})`, then `name_was_remapped` would've been true and `unmapped_path` would've been `Some(local_path)`. cc `@eddyb` who implemented `/rustc/...` path devirtualisation
2021-05-12Auto merge of #83610 - bjorn3:driver_cleanup, r=cjgillotbors-1/+5
rustc_driver cleanup Best reviewed one commit at a time.
2021-05-09Auto merge of #83800 - xobs:impl-16351-nightly, r=nagisabors-6/+7
Add default search path to `Target::search()` The function `Target::search()` accepts a target triple and returns a `Target` struct defining the requested target. There is a `// FIXME 16351: add a sane default search path?` comment that indicates it is desirable to include some sort of default. This was raised in https://github.com/rust-lang/rust/issues/16351 which was closed without any resolution. https://github.com/rust-lang/rust/pull/31117 was proposed, however that has platform-specific logic that is unsuitable for systems without `/etc/`. This patch implements the suggestion raised in https://github.com/rust-lang/rust/issues/16351#issuecomment-180878193 where a `target.json` file may be placed in `$(rustc --print sysroot)/lib/rustlib/<target-triple>/target.json`. This allows shipping a toolchain distribution as a single file that gets extracted to the sysroot.
2021-05-08Remove unused `opt_span_warn` functionJoshua Nelson-6/+0
2021-05-08Make `Diagnostic::span_fatal` unconditionally raise an errorJoshua Nelson-2/+2
It had no callers which didn't immediately call `raise()`, and this unifies the behavior with `Session`.
2021-05-05Use RealFileName for Session::working_dir as it may also be remappedAndy Wang-5/+9
2021-05-02Remove dummy_configbjorn3-1/+5
2021-04-27Make `real_rust_path_dir` a TRACKED_NO_CRATE_HASH optionJoshua Nelson-30/+0
This also adds support for doc-comments to Options.
2021-04-25Merge remote-tracking branch 'upstream/master' into impl-16351-nightlySean Cross-120/+51
Signed-off-by: Sean Cross <sean@xobs.io>
2021-04-20Add an attribute to be able to configure the limitOli Scherer-0/+16