Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -Zborrowck-unreachable=no #103356

Closed
wants to merge 4 commits into from
Closed

Add -Zborrowck-unreachable=no #103356

wants to merge 4 commits into from

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Oct 21, 2022

The magic button for when you don't care about whether your code works, you just want it to compile.

Currently, this avoids running borrowck or typeck on dead code that isn't monomorphized. In the future, it could be extended to ignore (but still emit) parse errors, mismatches in generic parameters, uses of private items, as long as the use doesn't need to make it to codegen.

There is precedent for this in Haskell as -f defer-type-errors: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/defer_type_errors.html
Build systems also commonly have this as --keep-going, which ignores failed builds while continuing to run other builds that aren't dependent on the one that failed.

Some example motivations:

  • When making a large refactor, run a single test that doesn't affect the rest of the codebase. In essence this is a "poor man's workspace", but adhoc and much faster than splitting out a single crate into multiple.
  • Prototype a new application where you're rapidly changing the code and don't need it to be precisely correct, just see if it could eventually be made to compile.

Fixes #104858.

r? @estebank

@jyn514 jyn514 added the S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. label Oct 21, 2022
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 21, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 21, 2022
@adamse
Copy link
Contributor

adamse commented Oct 21, 2022

Your comparison to GHC's typed holes and Agda's holes is not right. These holes are in place of expressions (of course the lines blur in Agda) and their purpose is to cause the compiler to "complain" (with type information and suggestions on how to fill in the missing part).

A more related feature is GHC's https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/defer_type_errors.html

@jyn514

This comment was marked as resolved.

@compiler-errors
Copy link
Member

I think this flag is unnecessarily crudely named, and we really should probably rename it 😕

Though I am also pretty strongly against us landing any flag that intentionally skips checks like this.

Fuzz the codegen backends to make sure they correctly emit an error when passed [type error], rather than an ICE

I don't think this should be a motivation to land this flag -- codegen backends should not be designed to handle broken code gracefully.

Post-monomorphization code should be designed assuming that it's getting code that has been validated and should ICE when it gets something like [type error], since that usually is the last case where we can discover some really glaring bugs in the frontend of Rust.

@rust-log-analyzer

This comment was marked as resolved.

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Oct 21, 2022

suggestion: -Zyolo?

@scottmcm
Copy link
Member

Like unleash-the-miri-inside-of-you, things like this that are for testing unusual things and shouldn't usually be used should have a verbose and scary name, and a description making it clear that its use is unsound.

Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming bikeshedding aside, and agreeing with scottmcm on the intent, this should never even approach the appearance of being usable by end users. I'm honestly shocked at how little code was necessary to get this working. The bigger version of this would also replace bodies containing [type error] with panics, so as to simplify the code-generation of invalid items.

Comment on lines 3 to 10
fn dead_code(s: &str) -> &'static str {
s
}

fn main() {
println!("he he he")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we actually call dead_code, this will be UB but "work" as long as it is called with a static string, right? The "fully built version" of this would ideally have a way of catching misuses at runtime. It'd be useful to also emit the compile errors even though they are ignored, maybe marking them as such (but that can be worked around by calling rustc twice 🤷).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, borrowck will still run when creating the MIR for the function. This is pretty much unavoidable as one of the outputs of borrowck is the list of upvars for closures, which is necessary for building the MIR for closures and their callers.

@estebank
Copy link
Contributor

An use case that you're not mentioning (but I would like to eventually support), is being able to run a project's test suite even in the face of compilation errors. Any tests that can execute, would do so, while those that encountered compile errors would appear as test failures.

@the8472
Copy link
Member

the8472 commented Oct 21, 2022

additional prior art: The eclipse compiler for java (ecj) will attempt to build broken code by replacing the invalid method bodies with exception-throwing stubs so one can still run tests and debug incomplete code.

@ssokolow
Copy link

I think this flag is unnecessarily crudely named, and we really should probably rename it

No mention of how it's insufficiently self-descriptive? (eg. -Zreplace-invalid-code-with-panic)

@bjorn3
Copy link
Member

bjorn3 commented Oct 27, 2022

Hmm, it turns out this is slightly harder than I imagined: today, we'll still codegen and emit all items even if they're unreachable; without -Zfuckit and fixing the compile errors, rustc no-borrowck-dead-code.rs emits a binary with the dead_code symbol, even with -Copt-level=3:

; nm no-borrowck-dead-code | grep dead_code
0000000000007cb0 t _ZN21no_borrowck_dead_code4main17hf39a00956f904bbeE

Is that intentional? It seems strange to emit code that will never be called.

I don't see that at all locally. For rustc object files contain dead code when using incr comp, but not when disabling incr comp. It is included for incr comp to improve cache reuse as changes to what functions are used by one cgu won't cause another cgu to include it or not this way.

@bors

This comment was marked as resolved.

@jyn514 jyn514 changed the title Add -Zfuckit Add -Zborrowck-unreachable=no Nov 25, 2022
The magic button for when you don't care about whether your code works, you just want it to compile.

Currently, this avoids running borrowck or typeck on dead code that isn't monomorphized.
In the future, it could be extended to ignore (but still emit) parse errors, mismatches in generic parameters, uses of private items, as long as the use doesn't need to make it to codegen.
However, I don't propose to put them under the same flag.

There is precedent for this in Haskell as -f defer-type-errors: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/defer_type_errors.html
Build systems also commonly have this as --keep-going, which ignores failed builds while continuing to run other builds that aren't dependent on the one that failed.

Some example motivations:

- When making a large refactor, run a single test that doesn't affect the rest of the codebase. In essence this is a "poor man's workspace", but adhoc and much faster than splitting out a single crate into multiple.
- Prototype a new application where you're rapidly changing the code and don't need it to be precisely correct, just see if it could eventually be made to compile.
@jyn514 jyn514 removed the S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. label Nov 25, 2022
@jyn514
Copy link
Member Author

jyn514 commented Nov 25, 2022

I think this flag is unnecessarily crudely named, and we really should probably rename it

Done; it's now called -Zborrowck-unreachable=no, which hopefully also addresses @ssokolow's concerns.

Fuzz the codegen backends to make sure they correctly emit an error when passed [type error], rather than an ICE

I don't think this should be a motivation to land this flag -- codegen backends should not be designed to handle broken code gracefully.

I agree, I removed that motivation. I still think the remaining motivations are real world use cases though.

I don't see that at all locally. For rustc object files contain dead code when using incr comp, but not when disabling incr comp. It is included for incr comp to improve cache reuse as changes to what functions are used by one cgu won't cause another cgu to include it or not this way.

Oops, that's my bad - the function name I was looking for was also part of the crate name, which misled me. Yes, dead code doesn't end up in the final binary (cc #104858).

jyn514 added a commit to jyn514/rust that referenced this pull request Nov 25, 2022
This is the internal-facing portion of rust-lang#103356; it should not be user-visible in any way.
@rust-log-analyzer

This comment has been minimized.

not all processed items will actually be instantiated; wait to borrowck them until it actually happens
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-13 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [ui] src/test/rustdoc-ui/z-help.rs stdout ----
diff of stdout:

4     -Z                       assert-incr-state=val -- assert that the incremental cache is in given state: either `loaded` or `not-loaded`.
5     -Z               assume-incomplete-release=val -- make cfg(version) treat the current version as incomplete (default: no)
6     -Z                      binary-dep-depinfo=val -- include artifacts (sysroot, crate dependencies) used during compilation in dep-info (default: no)
+     -Z                    borrowck-unreachable=val -- force borrowck to run even on functions that are never used
7     -Z                             box-noalias=val -- emit noalias metadata for box (default: yes)
8     -Z                       branch-protection=val -- set options for branch target identification and pointer authentication on AArch64
9     -Z                           cf-protection=val -- instrument control-flow architecture protection

The actual stdout differed from the expected stdout.
The actual stdout differed from the expected stdout.
Actual stdout saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/z-help/z-help.stdout
To only update this specific test, also pass `--test-args z-help.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
status: exit status: 0
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "/checkout/src/test/rustdoc-ui/z-help.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/z-help" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/z-help/auxiliary" "-Zhelp"
--- stdout -------------------------------
-Z                          allow-features=val -- only allow the listed language features to be enabled in code (space separated)
    -Z                       always-encode-mir=val -- encode MIR of all functions into the crate metadata (default: no)
    -Z                            asm-comments=val -- generate comments into the assembly (may change behavior) (default: no)
    -Z                       assert-incr-state=val -- assert that the incremental cache is in given state: either `loaded` or `not-loaded`.
    -Z               assume-incomplete-release=val -- make cfg(version) treat the current version as incomplete (default: no)
    -Z                      binary-dep-depinfo=val -- include artifacts (sysroot, crate dependencies) used during compilation in dep-info (default: no)
    -Z                    borrowck-unreachable=val -- force borrowck to run even on functions that are never used
    -Z                             box-noalias=val -- emit noalias metadata for box (default: yes)
    -Z                       branch-protection=val -- set options for branch target identification and pointer authentication on AArch64
    -Z                           cf-protection=val -- instrument control-flow architecture protection
    -Z               cgu-partitioning-strategy=val -- the codegen unit partitioning strategy to use
    -Z                                   chalk=val -- enable the experimental Chalk-based trait solving engine
    -Z                         codegen-backend=val -- the backend to use
    -Z                             combine-cgu=val -- combine CGUs into a single one
    -Z                              crate-attr=val -- inject the given attribute in the crate
    -Z                debug-info-for-profiling=val -- emit discriminators and other data necessary for AutoFDO
    -Z                            debug-macros=val -- emit line numbers debug info inside macros (default: no)
    -Z                 deduplicate-diagnostics=val -- deduplicate identical diagnostics (default: yes)
    -Z                  dep-info-omit-d-target=val -- in dep-info output, omit targets for tracking dependencies of the dep-info files themselves (default: no)
    -Z                               dep-tasks=val -- print tasks that execute and the color their dep node gets (requires debug build) (default: no)
    -Z                        diagnostic-width=val -- set the current output width for diagnostic truncation
    -Z                                 dlltool=val -- import library generation tool (windows-gnu only)
    -Z                 dont-buffer-diagnostics=val -- emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) (default: no)
    -Z                           drop-tracking=val -- enables drop tracking in generators (default: no)
    -Z                        dual-proc-macros=val -- load proc macros for both target and host, but only link to the target (default: no)
    -Z                          dump-dep-graph=val -- dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv) (default: no)
    -Z                  dump-drop-tracking-cfg=val -- dump drop-tracking control-flow graph as a `.dot` file (default: no)
    -Z                                dump-mir=val -- dump MIR state to file.
        `val` is used to select which passes and functions to dump. For example:
        `all` matches all passes and functions,
        `foo` matches all passes for functions whose name contains 'foo',
        `foo & ConstProp` only the 'ConstProp' pass for function names containing 'foo',
        `foo | bar` all passes for function names containing 'foo' or 'bar'.
    -Z                       dump-mir-dataflow=val -- in addition to `.mir` files, create graphviz `.dot` files with dataflow results (default: no)
    -Z                            dump-mir-dir=val -- the directory the MIR is dumped into (default: `mir_dump`)
    -Z            dump-mir-exclude-pass-number=val -- exclude the pass number when dumping MIR (used in tests) (default: no)
    -Z                       dump-mir-graphviz=val -- in addition to `.mir` files, create graphviz `.dot` files (and with `-Z instrument-coverage`, also create a `.dot` file for the MIR-derived coverage graph) (default: no)
    -Z                       dump-mir-spanview=val -- in addition to `.mir` files, create `.html` files to view spans for all `statement`s (including terminators), only `terminator` spans, or computed `block` spans (one span encompassing a block's terminator and all statements). If `-Z instrument-coverage` is also enabled, create an additional `.html` file showing the computed coverage spans.
    -Z                           dwarf-version=val -- version of DWARF debug information to emit (default: 2 or 4, depending on platform)
    -Z                               dylib-lto=val -- enables LTO for dylib crate type
    -Z                        emit-stack-sizes=val -- emit a section containing stack size metadata (default: no)
    -Z                           emit-thin-lto=val -- emit the bc module with thin LTO info (default: yes)
    -Z               export-executable-symbols=val -- export symbols from executables, as if they were dynamic libraries
    -Z                   extra-const-ub-checks=val -- turns on more checks to detect const UB, which can be slow (default: no)
    -Z                             fewer-names=val -- reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) (default: no)
    -Z              force-unstable-if-unmarked=val -- force all crates to be `rustc_private` unstable (default: no)
    -Z                                    fuel=val -- set the optimization fuel quota for a crate
    -Z                       function-sections=val -- whether each function should go in its own section
    -Z                    future-incompat-test=val -- forces all lints to be future incompatible, used for internal testing (default: no)
    -Z                                  gcc-ld=val -- implementation of ld used by cc
    -Z                      graphviz-dark-mode=val -- use dark-themed colors in graphviz output (default: no)
    -Z                           graphviz-font=val -- use the given `fontname` in graphviz output; can be overridden by setting environment variable `RUSTC_GRAPHVIZ_FONT` (default: `Courier, monospace`)
    -Z                               hir-stats=val -- print some statistics about AST and HIR (default: no)
    -Z                human-readable-cgu-names=val -- generate human-readable, predictable names for codegen units (default: no)
    -Z                        identify-regions=val -- display unnamed regions as `'<id>`, using a non-ident unique id (default: no)
    -Z                incremental-ignore-spans=val -- ignore spans during ICH computation -- used for testing (default: no)
    -Z                        incremental-info=val -- print high-level information about incremental reuse (or the lack thereof) (default: no)
    -Z              incremental-relative-spans=val -- hash spans relative to their parent item for incr. comp. (default: no)
    -Z                  incremental-verify-ich=val -- verify incr. comp. hashes of green query instances (default: no)
    -Z                      inline-in-all-cgus=val -- control whether `#[inline]` functions are in all CGUs
    -Z                             inline-llvm=val -- enable LLVM inlining (default: yes)
    -Z                              inline-mir=val -- enable MIR inlining (default: no)
    -Z               inline-mir-hint-threshold=val -- inlining threshold for functions with inline hint (default: 100)
    -Z                    inline-mir-threshold=val -- a default MIR inlining threshold (default: 50)
    -Z                             input-stats=val -- gather statistics about the input (default: no)
    -Z                     instrument-coverage=val -- instrument the generated code to support LLVM source-based code coverage reports (note, the compiler build config must include `profiler = true`); implies `-C symbol-mangling-version=v0`. Optional values are:
        `=all` (implicit value)
        `=except-unused-generics`
        `=except-unused-functions`
        `=off` (default)
    -Z                       instrument-mcount=val -- insert function instrument code for mcount-based tracing (default: no)
    -Z                       keep-hygiene-data=val -- keep hygiene data after analysis (default: no)
    -Z                             layout-seed=val -- seed layout randomization
    -Z                   link-native-libraries=val -- link native libraries in the linker invocation (default: yes)
    -Z                               link-only=val -- link the `.rlink` file generated by `-Z no-link` (default: no)
    -Z                            llvm-plugins=val -- a list LLVM plugins to enable (space separated)
    -Z                         llvm-time-trace=val -- generate JSON tracing data file from LLVM data (default: no)
    -Z                         location-detail=val -- what location details should be tracked when using caller_location, either `none`, or a comma separated list of location details, for which valid options are `file`, `line`, and `column` (default: `file,line,column`)
    -Z                                      ls=val -- list the symbols defined by a library crate (default: no)
    -Z                         macro-backtrace=val -- show macro backtraces (default: no)
    -Z                         merge-functions=val -- control the operation of the MergeFunctions LLVM pass, taking the same values as the target option of the same name
    -Z                              meta-stats=val -- gather metadata statistics (default: no)
    -Z                          mir-emit-retag=val -- emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 (default: no)
    -Z                       mir-enable-passes=val -- use like `-Zmir-enable-passes=+DestProp,-InstCombine`. Forces the specified passes to be enabled, overriding all other checks. Passes that are not specified are enabled or disabled by other flags as usual.
    -Z                           mir-opt-level=val -- MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)
    -Z        mir-pretty-relative-line-numbers=val -- use line numbers relative to the function in mir pretty printing
    -Z                         move-size-limit=val -- the size at which the `large_assignments` lint starts to be emitted
    -Z                         mutable-noalias=val -- emit noalias metadata for mutable references (default: yes)
    -Z                               nll-facts=val -- dump facts from NLL analysis into side files (default: no)
    -Z                           nll-facts-dir=val -- the directory the NLL facts are dumped into (default: `nll-facts`)
    -Z                             no-analysis=val -- parse and expand the source, but run no analysis
    -Z                              no-codegen=val -- run all passes except codegen; no output
    -Z              no-generate-arange-section=val -- omit DWARF address ranges that give faster lookups
    -Z                     no-interleave-lints=val -- execute lints separately; allows benchmarking individual lints
    -Z                           no-leak-check=val -- disable the 'leak check' for subtyping; unsound, but useful for tests
    -Z                                 no-link=val -- compile without linking
    -Z                        no-parallel-llvm=val -- run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)
    -Z                     no-profiler-runtime=val -- prevent automatic injection of the profiler_builtins crate
    -Z                 no-unique-section-names=val -- do not use unique names for text and data sections when -Z function-sections is used
    -Z                          normalize-docs=val -- normalize associated items in rustdoc when generating documentation
    -Z                                     oom=val -- panic strategy for out-of-memory handling
    -Z                  osx-rpath-install-name=val -- pass `-install_name @rpath/...` to the macOS linker (default: no)
    -Z                     packed-bundled-libs=val -- change rlib format to store native libraries as archives
    -Z                       panic-abort-tests=val -- support compiling tests with panic=abort (default: no)
    -Z                           panic-in-drop=val -- panic strategy for panics in drops
    -Z                              parse-only=val -- parse only; do not compile, assemble, or link (default: no)
    -Z                              perf-stats=val -- print some performance-related statistics (default: no)
    -Z pick-stable-methods-before-any-unstable=val -- try to pick stable methods first before picking any unstable methods (default: yes)
    -Z                                     plt=val -- whether to use the PLT when calling into shared libraries;
        only has effect for PIC code on systems with ELF binaries
        (default: PLT is disabled if full relro is enabled)
    -Z                                polonius=val -- enable polonius-based borrow-checker (default: no)
    -Z                            polymorphize=val -- perform polymorphization analysis
    -Z                            pre-link-arg=val -- a single extra argument to prepend the linker invocation (can be used several times)
    -Z                           pre-link-args=val -- extra arguments to prepend to the linker invocation (space separated)
    -Z           precise-enum-drop-elaboration=val -- use a more precise version of drop elaboration for matches on enums (default: yes). This results in better codegen, but has caused miscompilations on some tier 2 platforms. See #77382 and #74551.
    -Z                              print-fuel=val -- make rustc print the total optimization fuel used by a crate
    -Z                       print-llvm-passes=val -- print the LLVM optimization passes being run (default: no)
    -Z                        print-mono-items=val -- print the result of the monomorphization collection pass
    -Z                        print-type-sizes=val -- print layout information for each type encountered (default: no)
    -Z                    proc-macro-backtrace=val -- show backtraces for panics during proc-macro execution (default: no)
    -Z           proc-macro-execution-strategy=val -- how to run proc-macro code (default: same-thread)
    -Z                                 profile=val -- insert profiling code (default: no)
    -Z                        profile-closures=val -- profile size of closures
    -Z                            profile-emit=val -- file path to emit profiling data at runtime when using 'profile' (default based on relative source path)
    -Z                      profile-sample-use=val -- use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO)
    -Z                        profiler-runtime=val -- name of the profiler runtime crate to automatically inject (default: `profiler_builtins`)
    -Z                         query-dep-graph=val -- enable queries of the dependency graph for regression testing (default: no)
    -Z                        randomize-layout=val -- randomize the layout of types (default: no)
    -Z                   relax-elf-relocations=val -- whether ELF relocations can be relaxed
    -Z                             relro-level=val -- choose which RELRO level to use
    -Z                        remap-cwd-prefix=val -- remap paths under the current working directory to this path prefix
    -Z                     report-delayed-bugs=val -- immediately print bugs registered with `delay_span_bug` (default: no)
    -Z                               sanitizer=val -- use a sanitizer
    -Z          sanitizer-memory-track-origins=val -- enable origins tracking in MemorySanitizer
    -Z                       sanitizer-recover=val -- enable recovery for selected sanitizers
    -Z                  saturating-float-casts=val -- make float->int casts UB-free: numbers outside the integer type's range are clipped to the max/min integer respectively, and NaN is mapped to 0 (default: yes)
    -Z                           save-analysis=val -- write syntax and type analysis (in JSON format) information, in addition to normal output (default: no)
    -Z                            self-profile=val -- run the self profiler and output the raw event data
    -Z                    self-profile-counter=val -- counter used by the self profiler (default: `wall-time`), one of:
        `wall-time` (monotonic clock, i.e. `std::time::Instant`)
        `instructions:u` (retired instructions, userspace-only)
        `instructions-minus-irqs:u` (subtracting hardware interrupt counts for extra accuracy)
    -Z                     self-profile-events=val -- specify the events recorded by the self profiler;
        for example: `-Z self-profile-events=default,query-keys`
        all options: none, all, default, generic-activity, query-provider, query-cache-hit
                     query-blocked, incr-cache-load, incr-result-hashing, query-keys, function-args, args, llvm, artifact-sizes
    -Z                          share-generics=val -- make the current crate share its generic instantiations
    -Z                               show-span=val -- show spans for compiler debugging (expr|pat|ty)
    -Z         simulate-remapped-rust-src-base=val -- simulate the effect of remap-debuginfo = true at bootstrapping by remapping path to rust's source base directory. only meant for testing purposes
    -Z                              span-debug=val -- forward proc_macro::Span's `Debug` impl to `Span`
    -Z                       span-free-formats=val -- exclude spans when debug-printing compiler state (default: no)
    -Z                    split-dwarf-inlining=val -- provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF
    -Z                        split-dwarf-kind=val -- split dwarf variant (only if -Csplit-debuginfo is enabled and on relevant platform)
        (default: `split`)

        `split`: sections which do not require relocation are written into a DWARF object (`.dwo`)
                 file which is ignored by the linker
        `single`: sections which do not require relocation are written into object file but ignored
                  by the linker
    -Z                      src-hash-algorithm=val -- hash algorithm of source files in debug info (`md5`, `sha1`, or `sha256`)
    -Z                         stack-protector=val -- control stack smash protection strategy (`rustc --print stack-protector-strategies` for details)
    -Z                      strict-init-checks=val -- control if mem::uninitialized and mem::zeroed panic on more UB
    -Z                                   strip=val -- tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`)
    -Z                 symbol-mangling-version=val -- which mangling version to use for symbol names ('legacy' (default) or 'v0')
    -Z                                   teach=val -- show extended diagnostic help (default: no)
    -Z                               temps-dir=val -- the directory the intermediate files are written to
    -Z                                 thinlto=val -- enable ThinLTO when possible
    -Z                           thir-unsafeck=val -- use the THIR unsafety checker (default: no)
    -Z                                 threads=val -- use a thread pool with N threads
    -Z                        time-llvm-passes=val -- measure time of each LLVM pass (default: no)
    -Z                             time-passes=val -- measure time of each rustc pass (default: no)
    -Z                               tls-model=val -- choose the TLS model to use (`rustc --print tls-models` for details)
    -Z                            trace-macros=val -- for every macro invocation, print its name and arguments (default: no)
    -Z                       track-diagnostics=val -- tracks where in rustc a diagnostic was emitted
    -Z                translate-additional-ftl=val -- additional fluent translation to preferentially use (for testing translation)
    -Z        translate-directionality-markers=val -- emit directionality isolation markers in translated diagnostics
    -Z                          translate-lang=val -- language identifier for diagnostic output
    -Z   translate-remapped-path-to-local-path=val -- translate remapped paths into local paths when possible (default: yes)
    -Z                        trap-unreachable=val -- generate trap instructions for unreachable intrinsics (default: use target setting, usually yes)
    -Z                        treat-err-as-bug=val -- treat error number `val` that occurs as bug
    -Z                   trim-diagnostic-paths=val -- in diagnostics, use heuristics to shorten paths referring to items
    -Z                                tune-cpu=val -- select processor to schedule for (`rustc --print target-cpus` for details)
    -Z                              ui-testing=val -- emit compiler diagnostics in a form suitable for UI testing (default: no)
    -Z            uninit-const-chunk-threshold=val -- allow generating const initializers with mixed init/uninit chunks, and set the maximum number of chunks for which this is allowed (default: 16)
    -Z          unleash-the-miri-inside-of-you=val -- take the brakes off const evaluation. NOTE: this is unsound (default: no)
    -Z                                unpretty=val -- present the input source, unstable (and less-pretty) variants;
        `normal`, `identified`,
        `expanded`, `expanded,identified`,
        `expanded,hygiene` (with internal representations),
        `ast-tree` (raw AST before expansion),
        `ast-tree,expanded` (raw AST after expansion),
        `hir` (the HIR), `hir,identified`,
        `hir,typed` (HIR with types for each node),
        `hir-tree` (dump the raw HIR),
        `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)
    -Z                        unsound-mir-opts=val -- enable unsound and buggy MIR optimizations (default: no)
    -Z                        unstable-options=val -- adds unstable command line options to rustc interface (default: no)
    -Z                       use-ctors-section=val -- use legacy .ctors section for initializers rather than .init_array
    -Z                            validate-mir=val -- validate MIR after each transformation
    -Z                                 verbose=val -- in general, enable more debug printouts (default: no)
    -Z                          verify-llvm-ir=val -- verify LLVM IR (default: no)
    -Z            virtual-function-elimination=val -- enables dead virtual function elimination optimization. Requires `-Clto[=[fat,yes]]`
    -Z                         wasi-exec-model=val -- whether to build a wasi command or reactor
stderr: none



@apiraino
Copy link
Contributor

By looking at the activity I infer that this is still in flux, so switching to waiting on author and to request a new review with @rustbot ready.

By the way: do we really want to land this? I'm not a fan of "emoji-voting" :) I just wonder if this should get a wider explicit consensus.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 29, 2022
@jyn514
Copy link
Member Author

jyn514 commented Dec 20, 2022

@apiraino this is waiting on me to make an MCP, I think

@jyn514
Copy link
Member Author

jyn514 commented Dec 22, 2022

I am not planning to drive this forward at this time.

@jyn514 jyn514 closed this Dec 22, 2022
@workingjubilee workingjubilee added the A-CLI Area: Command-line interface (CLI) to the compiler label Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: Command-line interface (CLI) to the compiler S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't codegen items that are statically unreachable