about summary refs log tree commit diff
path: root/compiler/rustc_session
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-12-22 21:41:03 -0500
committerGitHub <noreply@github.com>2023-12-22 21:41:03 -0500
commit7dd095598badf3328877ab31039ade0e31b09c3a (patch)
tree03973483fad03e3779a03db36a64cd1a16c84bd7 /compiler/rustc_session
parentaaff4153229c7d34dcb4eeafb9395169b8768ef3 (diff)
parentba430a36c0edbc24e525cfd53303997d478307c5 (diff)
downloadrust-7dd095598badf3328877ab31039ade0e31b09c3a.tar.gz
rust-7dd095598badf3328877ab31039ade0e31b09c3a.zip
Rollup merge of #119077 - tmiasko:lint, r=cjgillot
Separate MIR lints from validation

Add a MIR lint pass, enabled with -Zlint-mir, which identifies undefined or
likely erroneous behaviour.

The initial implementation mostly migrates existing checks of this nature from
MIR validator, where they did not belong (those checks have false positives and
there is nothing inherently invalid about MIR with undefined behaviour).

Fixes #104736
Fixes #104843
Fixes #116079
Fixes #116736
Fixes #118990
Diffstat (limited to 'compiler/rustc_session')
-rw-r--r--compiler/rustc_session/src/options.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index 06b554e8e63..4626da52850 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -1694,6 +1694,8 @@ options! {
         "link native libraries in the linker invocation (default: yes)"),
     link_only: bool = (false, parse_bool, [TRACKED],
         "link the `.rlink` file generated by `-Z no-link` (default: no)"),
+    lint_mir: bool = (false, parse_bool, [UNTRACKED],
+        "lint MIR before and after each transformation"),
     llvm_module_flag: Vec<(String, u32, String)> = (Vec::new(), parse_llvm_module_flag, [TRACKED],
         "a list of module flags to pass to LLVM (space separated)"),
     llvm_plugins: Vec<String> = (Vec::new(), parse_list, [TRACKED],