about summary refs log tree commit diff
path: root/compiler/rustc_session/src
AgeCommit message (Collapse)AuthorLines
2023-01-31Use `Edition` methods a bit moreMaybe Waffle-4/+4
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-4/+29
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30session: impl `IntoDiagnosticArg` for `CrateType`David Wood-1/+7
Forward the `Display` implementation for `CrateType` to `IntoDiagnosticArg` so that it can be used in diagnostic structs. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-29Rollup merge of #107006 - b-naber:thir-tree, r=jackh726Matthias Krüger-3/+8
Output tree representation on thir-tree The current output of `-Zunpretty=thir-tree` is really cumbersome to work with, using an actual tree representation should make it easier to see what the thir looks like.
2023-01-29Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obkbors-0/+2
Use stable metric for const eval limit instead of current terminator-based logic This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only. The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made). Also see: #103877
2023-01-27Add `drop_tracking_mir` option.Camille GILLOT-0/+2
2023-01-27Rollup merge of #106856 - vadorovsky:fix-atomic-annotations, r=joshtriplettYuki Okushi-0/+8
core: Support variety of atomic widths in width-agnostic functions Before this change, the following functions and macros were annotated with `#[cfg(target_has_atomic = "8")]` or `#[cfg(target_has_atomic_load_store = "8")]`: * `atomic_int` * `strongest_failure_ordering` * `atomic_swap` * `atomic_add` * `atomic_sub` * `atomic_compare_exchange` * `atomic_compare_exchange_weak` * `atomic_and` * `atomic_nand` * `atomic_or` * `atomic_xor` * `atomic_max` * `atomic_min` * `atomic_umax` * `atomic_umin` However, none of those functions and macros actually depend on 8-bit width and they are needed for all atomic widths (16-bit, 32-bit, 64-bit etc.). Some targets might not support 8-bit atomics (i.e. BPF, if we would enable atomic CAS for it). This change fixes that by removing the `"8"` argument from annotations, which results in accepting the whole variety of widths. Fixes #106845 Fixes #106795 Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2023-01-26previous thir unpretty output through thir-flatb-naber-3/+8
2023-01-26Rollup merge of #106904 - khuey:preserve_debuginfo_for_rlibs, r=davidtwcoMatthias Krüger-12/+0
Preserve split DWARF files when building archives. r? ```@davidtwco```
2023-01-25Add `target_has_atomic*` symbols if any atomic width is supportedMichal Rostecki-0/+8
Atomic operations for different widths (8-bit, 16-bit, 32-bit etc.) are guarded by `target_has_atomic = "value"` symbol (i.e. `target_has_atomic = "8"`) (and the other derivatives), but before this change, there was no width-agnostic symbol indicating a general availability of atomic operations. This change introduces: * `target_has_atomic_load_store` symbol when atomics for any integer width are supported by the target. * `target_has_atomic` symbol when also CAS is supported. Fixes #106845 Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2023-01-23Replace terminator-based const eval limitBryan Garza-0/+2
- Remove logic that limits const eval based on terminators, and use the stable metric instead (back edges + fn calls) - Add unstable flag `tiny-const-eval-limit` to add UI tests that do not have to go up to the regular 2M step limit
2023-01-19Auto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkovbors-16/+41
Various cleanups around pre-TyCtxt queries and functions part of #105462 based on https://github.com/rust-lang/rust/pull/106776 (everything starting at [0e2b39f](https://github.com/rust-lang/rust/pull/106810/commits/0e2b39fd1ffde51b50d45ccbe41de52b85136b8b) is new in this PR) r? `@petrochenkov` I think this should be most of the uncontroversial part of #105462.
2023-01-18Support `true` and `false` as boolean flag paramsNilstrieb-5/+5
Implements MCP 577.
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-7/+7
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-7/+7
2023-01-16Avoid an unnecessary allocationOli Scherer-9/+9
2023-01-16Move compiler input and ouput paths into sessionOli Scherer-12/+19
2023-01-16check -Z query-dep-graph is enabled if -Z dump-dep-graph (#106736)gftea-0/+5
2023-01-16Remove redundant `input_path` field from `Config`Oli Scherer-0/+18
2023-01-15Preserve split DWARF files when building archives.Kyle Huey-12/+0
The optimization that removes artifacts when building libraries is correct from the compiler's perspective but not from a debugger's perspective. Unpacked split debuginfo is referred to by filename and debuggers need the artifact that contains debuginfo to continue to exist at that path. Ironically the test expects the correct behavior but it was not running.
2023-01-14Removed various double spaces in compiler source comments.André Vennberg-1/+1
2023-01-11Rollup merge of #106709 - khuey:disable_split_dwarf_inlining_by_default, ↵nils-1/+1
r=davidtwco Disable "split dwarf inlining" by default. This matches clang's behavior and makes split-debuginfo behave as expected (i.e. actually split the debug info). Fixes #106592
2023-01-12Add log-backtrace option to show backtraces along with loggingYuki Omoto-0/+2
2023-01-10Disable "split dwarf inlining" by default.Kyle Huey-1/+1
This matches clang's behavior and makes split-debuginfo behave as expected (i.e. actually split the debug info). Fixes #106592
2023-01-11Rollup merge of #106671 - tmiasko:opt-bool, r=wesleywiserYuki Okushi-2/+2
Change flags with a fixed default value from Option<bool> to bool
2023-01-10Change type of box_noalias to boolTomasz Miąsko-1/+1
2023-01-10Change type of mutable_noalias to boolTomasz Miąsko-1/+1
2023-01-09Fix help docs for -Zallow-featuresEric Huss-1/+1
2023-01-06Rollup merge of #106542 - sigaloid:master, r=bjorn3Matthias Krüger-2/+8
Add default and latest stable edition to --edition in rustc (attempt 2) Fixes #106041 No longer leaks string like my first attempt PR, #106094 - uses LazyLock to construct a `&'static str` It will now output the default edition and latest stable edition in the help message for the `--edition` flag. Going to request the same reviewer as the first attempt for continuity - r? `@Nilstrieb`
2023-01-06Rollup merge of #106287 - Nilstrieb:its-bugging-me-how-we-dont-have-docs, ↵Matthias Krüger-1/+13
r=jyn514 Add some docs to `bug`, `span_bug` and `delay_span_bug` cc `@mejrs` as you wanted me to do this, does this look good and understandable?
2023-01-06Update compiler/rustc_session/src/config.rsMatthew E-1/+1
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2023-01-06Add default and latest stable edition to --edition in rustcMatthew Esposito-2/+8
2023-01-04Rename stock solver to classicMichael Goulet-6/+8
2023-01-04Split `-Zchalk` flag into `-Ztrait-solver=(stock|chalk|next)` flagMichael Goulet-3/+26
2023-01-04Rollup merge of #106361 - clubby789:int-literal-too-large, r=estebankMatthias Krüger-2/+11
Note maximum integer literal for `IntLiteralTooLarge` Closes #105908 `@rustbot` label +A-diagnostics
2023-01-04Rollup merge of #106274 - jyn514:dump-mono-stats, r=lqdMatthias Krüger-1/+37
Add JSON output to -Zdump-mono-stats Follow-up to https://github.com/rust-lang/rust/pull/105481 r? `@lqd` cc `@wesleywiser`
2023-01-02Add json output to `-Zdump-mono-stats`Joshua Nelson-1/+37
This allows analyzing the output programatically; for example, finding the item with the highest `total_estimate`. I also took the liberty of adding `untracked` tests to `rustc_session` and documentation to the unstable book for `dump-mono-items`.
2023-01-02Auto merge of #84762 - cjgillot:resolve-span-opt, r=petrochenkovbors-1/+8
Encode spans relative to the enclosing item -- enable on nightly Follow-up to #84373 with the flag `-Zincremental-relative-spans` set by default. This PR seeks to remove one of the main shortcomings of incremental: the handling of spans. Changing the contents of a function may require redoing part of the compilation process for another function in another file because of span information is changed. Within one file: all the spans in HIR change, so typechecking had to be re-done. Between files: spans of associated types/consts/functions change, so type-based resolution needs to be re-done (hygiene information is stored in the span). The flag `-Zincremental-relative-spans` encodes local spans relative to the span of an item, stored inside the `source_span` query. Trap: stashed diagnostics are referenced by the "raw" span, so stealing them requires to remove the span's parent. In order to avoid too much traffic in the span interner, span encoding uses the `ctxt_or_tag` field to encode: - the parent when the `SyntaxContext` is 0; - the `SyntaxContext` when the parent is `None`. Even with this, the PR creates a lot of traffic to the Span interner, when a Span has both a LocalDefId parent and a non-root SyntaxContext. They appear in lowering, when we add a parent to all spans, including those which come from macros, and during inlining when we mark inlined spans. The last commit changes how queries of `LocalDefId` manage their cache. I can put this in a separate PR if required. Possible future directions: - validate that all spans are marked in HIR validation; - mark macro-expanded spans relative to the def-site and not the use-site.
2023-01-02Print correct base for too-large literalsclubby789-2/+10
Also update tests
2023-01-02Note maximum integer literal for `IntLiteralTooLarge`clubby789-0/+1
2022-12-30Add some docs to `bug`, `span_bug` and `delay_span_bug`Nilstrieb-1/+13
2022-12-25Rollup merge of #105955 - ↵Matthias Krüger-30/+0
Nilstrieb:no-trivial-opt-wrappers-we-have-field-accesses-for-that, r=cjgillot Remove wrapper functions for some unstable options They are trivial and just forward to the option. Like most other options, we can just access it directly.
2022-12-25Only enable relative span hashing on nightly.Camille GILLOT-0/+9
2022-12-25Enable relative span hashing.Camille GILLOT-2/+0
2022-12-25Mark incremental-ignore-spans as TRACKED.Camille GILLOT-1/+1
Using that options basically changes all stable hashes we may compute. Adding/removing as UNTRACKED it makes everything ICE (unstable fingerprint everywhere). As TRACKED, it can still do its job without ICEing.
2022-12-24Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholkMatthias Krüger-7/+7
rustc: Remove needless lifetimes
2022-12-21Auto merge of #105812 - ojeda:no-jump-tables, r=nikicbors-0/+2
Add `-Zno-jump-tables` This flag mimics GCC/Clang's `-fno-jump-tables` [1][2], which makes the codegen backend avoid generating jump tables when lowering switches. In the case of LLVM, the `"no-jump-tables"="true"` function attribute is added to every function. The kernel currently needs it for x86 when enabling IBT [3], as well as for Alpha (plus VDSO objects in MIPS/LoongArch). [1] https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-jump-tables [2] https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fjump-tables [3] https://github.com/torvalds/linux/blob/v6.1/arch/x86/Makefile#L75-L83
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-7/+7
2022-12-20Add `-Zno-jump-tables`Miguel Ojeda-0/+2
This flag mimics GCC/Clang's `-fno-jump-tables` [1][2], which makes the codegen backend avoid generating jump tables when lowering switches. In the case of LLVM, the `"no-jump-tables"="true"` function attribute is added to every function. The kernel currently needs it for x86 when enabling IBT [3], as well as for Alpha (plus VDSO objects in MIPS/LoongArch). [1] https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-jump-tables [2] https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fjump-tables [3] https://github.com/torvalds/linux/blob/v6.1/arch/x86/Makefile#L75-L83 Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-12-20Remove wrapper functions for some unstable optionsNilstrieb-30/+0
They are trivial and just forward to the option. Like most other options, we can just access it directly.