about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/tests.rs
AgeCommit message (Collapse)AuthorLines
2023-04-18Stablize raw-dylib, link_ordinal and -CdlltoolDaniel Paoliello-1/+1
2023-04-17Update test.Mara Bos-1/+1
2023-04-16Rename -Zoom=panic to -Zoom=unwindAmanieu d'Antras-1/+1
2023-03-31Preserve, clarify, and extend debug informationJulia Tatz-1/+2
`-Cdebuginfo=1` was never line tables only and can't be due to backwards compatibility issues. This was clarified and an option for line tables only was added. Additionally an option for line info directives only was added, which is well needed for some targets. The debug info options should now behave the same as clang's debug info options.
2023-03-21Add `-Z time-passes-format` to allow specifying a JSON output for `-Z ↵John Kåre Alsaker-0/+2
time-passes`
2023-03-16Gate fmt args flattening behind -Zflatten-format-args.Mara Bos-0/+1
2023-02-25Rollup merge of #107675 - jsgf:link-directives, r=davidtwcoMichael Goulet-0/+1
Implement -Zlink-directives=yes/no `-Zlink-directives=no` will ignored `#[link]` directives while compiling a crate, so nothing is emitted into the crate's metadata. The assumption is that the build system already knows about the crate's native dependencies and can provide them at link time without these directives. This is another way to address issue # #70093, which is currently addressed by `-Zlink-native-libraries` (implemented in #70095). The latter is implemented at link time, which has the effect of ignoring `#[link]` in *every* crate. This makes it a very large hammer as it requires all native dependencies to be known to the build system to be at all usable, including those in sysroot libraries. I think this means its effectively unused, and definitely under-used. Being able to control this on a crate-by-crate basis should make it much easier to apply when needed. I'm not sure if we need both mechanisms, but we can decide that later. cc `@pcwalton` `@cramertj`
2023-02-22Implement -Zlink-directives=yes/noJeremy Fitzhardinge-0/+1
`-Zlink-directives=no` will ignored `#[link]` directives while compiling a crate, so nothing is emitted into the crate's metadata. The assumption is that the build system already knows about the crate's native dependencies and can provide them at link time without these directives. This is another way to address issue # #70093, which is currently addressed by `-Zlink-native-libraries` (implemented in #70095). The latter is implemented at link time, which has the effect of ignoring `#[link]` in *every* crate. This makes it a very large hammer as it requires all native dependencies to be known to the build system to be at all usable, including those in sysroot libraries. I think this means its effectively unused, and definitely under-used. Being able to control this on a crate-by-crate basis should make it much easier to apply when needed. I'm not sure if we need both mechanisms, but we can decide that later.
2023-02-22various: translation resources from cg backendDavid Wood-1/+1
Extend `CodegenBackend` trait with a function returning the translation resources from the codegen backend, which can be added to the complete list of resources provided to the emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22errors: generate typed identifiers in each crateDavid Wood-1/+1
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-20remove flagBoxy-1/+0
2023-02-16Remove save-analysis.Nicholas Nethercote-1/+0
Most tests involving save-analysis were removed, but I kept a few where the `-Zsave-analysis` was an add-on to the main thing being tested, rather than the main thing being tested. For `x.py install`, the `rust-analysis` target has been removed. For `x.py dist`, the `rust-analysis` target has been kept in a degenerate form: it just produces a single file `reduced.json` indicating that save-analysis has been removed. This is necessary for rustup to keep working. Closes #43606.
2023-02-10Auto merge of #102963 - ilammy:xray-basic, r=estebankbors-0/+2
Add `-Z instrument-xray` flag Implement MCP https://github.com/rust-lang/compiler-team/issues/561, adding `-Z instrument-xray` flag which enables XRay instrumentation in LLVM.
2023-02-09Parse "-Z instrument-xray" codegen optionOleksii Lozovskyi-0/+2
Recognize all bells and whistles that LLVM's XRay pass is capable of. The always/never settings are a bit dumb without attributes but they're still there. The default instruction count is chosen by the compiler, not LLVM pass. We'll do it later.
2023-02-07Replace a command line flag with an env var to allow tools to initialize the ↵Oli Scherer-1/+0
tracing loggers at their own discretion
2023-01-23Replace terminator-based const eval limitBryan Garza-0/+1
- 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-16Move compiler input and ouput paths into sessionOli Scherer-1/+11
2023-01-12Add log-backtrace option to show backtraces along with loggingYuki Omoto-0/+1
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-04Split `-Zchalk` flag into `-Ztrait-solver=(stock|chalk|next)` flagMichael Goulet-1/+2
2023-01-04Rollup merge of #106274 - jyn514:dump-mono-stats, r=lqdMatthias Krüger-5/+7
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-5/+7
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`.
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-20Add `-Zno-jump-tables`Miguel Ojeda-0/+1
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-10compiler: remove unnecessary imports and qualified pathsKaDiWa-1/+0
2022-12-04Add -Z maximal-hir-to-mir-coverage flagWill Crichton-0/+1
2022-12-02Remove `-Zno-interleave-lints`.Nicholas Nethercote-1/+0
Because it complicates lint implementation greatly.
2022-11-01Auto merge of #103217 - mejrs:track, r=eholkbors-0/+1
Track where diagnostics were created. This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`. For example, the following code... ```rust struct A; struct B; fn main(){ let _: A = B; } ``` ...now emits the following error message: ``` error[E0308]: mismatched types --> src\main.rs:5:16 | 5 | let _: A = B; | - ^ expected struct `A`, found struct `B` | | | expected due to this -Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31 ```
2022-10-26fix tracking hash testmejrs-1/+1
2022-10-24Address some commentsmejrs-0/+1
2022-10-23Introduce dedicated `-Zdylib-lto` flag for enabling LTO on `dylib`sJakub Beránek-0/+1
2022-10-18Remove `RunCompiler::emitter`.Nicholas Nethercote-11/+2
It's no longer used.
2022-10-12Use `tidy-alphabetical` in the compilerNilstrieb-11/+16
2022-10-06Remove `-Ztime` option.Nicholas Nethercote-1/+0
The compiler currently has `-Ztime` and `-Ztime-passes`. I've used `-Ztime-passes` for years but only recently learned about `-Ztime`. What's the difference? Let's look at the `-Zhelp` output: ``` -Z time=val -- measure time of rustc processes (default: no) -Z time-passes=val -- measure time of each rustc pass (default: no) ``` The `-Ztime-passes` description is clear, but the `-Ztime` one is less so. Sounds like it measures the time for the entire process? No. The real difference is that `-Ztime-passes` prints out info about passes, and `-Ztime` does the same, but only for a subset of those passes. More specifically, there is a distinction in the profiling code between a "verbose generic activity" and an "extra verbose generic activity". `-Ztime-passes` prints both kinds, while `-Ztime` only prints the first one. (It took me a close reading of the source code to determine this difference.) In practice this distinction has low value. Perhaps in the past the "extra verbose" output was more voluminous, but now that we only print stats for a pass if it exceeds 5ms or alters the RSS, `-Ztime-passes` is less spammy. Also, a lot of the "extra verbose" cases are for individual lint passes, and you need to also use `-Zno-interleave-lints` to see those anyway. Therefore, this commit removes `-Ztime` and the associated machinery. One thing to note is that the existing "extra verbose" activities all have an extra string argument, so the commit adds the ability to accept an extra argument to the "verbose" activities.
2022-09-18Remove -Znew-llvm-pass-managerJosh Stone-1/+0
2022-09-12change rlib format to discern native dependenciesDaniil Belov-0/+1
2022-09-01rustc_target: Refactor internal linker flavors slightlyVadim Petrochenkov-5/+3
Remove one unstable user-facing linker flavor (l4-bender)
2022-08-12Adjust cfgsMark Rousskov-1/+1
2022-07-29proc_macro: use crossbeam channels for the proc_macro cross-thread bridgeNika Layzell-1/+2
This is done by having the crossbeam dependency inserted into the proc_macro server code from the server side, to avoid adding a dependency to proc_macro. In addition, this introduces a -Z command-line option which will switch rustc to run proc-macros using this cross-thread executor. With the changes to the bridge in #98186, #98187, #98188 and #98189, the performance of the executor should be much closer to same-thread execution. In local testing, the crossbeam executor was substantially more performant than either of the two existing CrossThread strategies, so they have been removed to keep things simple.
2022-07-28Use line numbers relative to function in mir opt testsNilstrieb-0/+1
This adds a new option, `-Zmir-pretty-relative-line-numbers`, that is then used in compiletest for the mir-opt tests.
2022-07-27lint: add bad opt access internal lintDavid Wood-0/+1
Some command-line options accessible through `sess.opts` are best accessed through wrapper functions on `Session`, `TyCtxt` or otherwise, rather than through field access on the option struct in the `Session`. Adds a new lint which triggers on those options that should be accessed through a wrapper function so that this is prohibited. Options are annotated with a new attribute `rustc_lint_opt_deny_field_access` which can specify the error message (i.e. "use this other function instead") to be emitted. A simpler alternative would be to simply rename the options in the option type so that it is clear they should not be used, however this doesn't prevent uses, just discourages them. Another alternative would be to make the option fields private, and adding accessor functions on the option types, however the wrapper functions sometimes rely on additional state from `Session` or `TyCtxt` which wouldn't be available in an function on the option type, so the accessor would simply make the field available and its use would be discouraged too. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-25feat: impl export-executable-symbolscsmoe-0/+1
2022-07-21Auto merge of #98162 - nextsilicon:support_lto_embed_bitcode, r=davidtwcobors-0/+1
Allow to disable thinLTO buffer to support lto-embed-bitcode lld feature Hello This change is to fix issue (https://github.com/rust-lang/rust/issues/84395) in which passing "-lto-embed-bitcode=optimized" to lld when linking rust code via linker-plugin-lto doesn't produce the expected result. Instead of emitting a single unified module into a llvmbc section of the linked elf, it emits multiple submodules. This is caused because rustc emits the BC modules after running llvm `createWriteThinLTOBitcodePass` pass. Which in turn triggers a thinLTO linkage and causes the said issue. This patch allows via compiler flag (-Cemit-thin-lto=<bool>) to select between running `createWriteThinLTOBitcodePass` and `createBitcodeWriterPass`. Note this pattern of selecting between those 2 passes is common inside of LLVM code. The default is to match the old behavior.
2022-07-19Add flag to configure `noalias` on `Box<T>`nils-0/+1
To aid making an informed decision about the aliasing rules of box, give users an option to remove `noalias` from box.
2022-07-14rustc: add ability to output regular LTO bitcode modulesZiv Dunkelman-0/+1
Adding the option to control from rustc CLI if the resulted ".o" bitcode module files are with thinLTO info or regular LTO info. Allows using "-lto-embed-bitcode=optimized" during linkage correctly. Signed-off-by: Ziv Dunkelman <ziv.dunkelman@nextsilicon.com>
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-7/+7
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-08Implement support for DWARF version 5.Patrick Walton-0/+1
DWARF version 5 brings a number of improvements over version 4. Quoting from the announcement [1]: > Version 5 incorporates improvements in many areas: better data compression, > separation of debugging data from executable files, improved description of > macros and source files, faster searching for symbols, improved debugging > optimized code, as well as numerous improvements in functionality and > performance. On platforms where DWARF version 5 is supported (Linux, primarily), this commit adds support for it behind a new `-Z dwarf-version=5` flag. [1]: https://dwarfstd.org/Public_Review.php
2022-07-08Rollup merge of #98533 - jyn514:drop-tracking-debugging, r=eholkDylan DPC-0/+1
Add a `-Zdump-drop-tracking-cfg` debugging flag This is useful for debugging drop-tracking; previously, you had to recompile rustc from source and manually add a call to `write_graph_to_file`. This makes the option more discoverable and configurable at runtime. I also took the liberty of making the labels for the CFG nodes much easier to read: previously, they looked like `id(2), local_id: 48`, now they look like ``` expr from_config (hir_id=HirId { owner: DefId(0:10 ~ default_struct_update[79f9]::foo), local_id: 2}) ``` r? ``@eholk``
2022-07-06sess: stabilize `--terminal-width`David Wood-1/+0
Formerly `-Zterminal-width`, `--terminal-width` allows the user or build tool to inform rustc of the width of the terminal so that diagnostics can be truncated. Signed-off-by: David Wood <david.wood@huawei.com>