Skip to content

Make broken MIR a proper lint. #119260

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

cjgillot
Copy link
Contributor

This allows to use expect(rustc::broken_mir) when we actually expect it to fire.

cc @tmiasko

@matthiaskrgr this should address #119077 (comment)

@rustbot
Copy link
Collaborator

rustbot commented Dec 23, 2023

r? @TaKO8Ki

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 23, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 23, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

/// The `broken_mir` statically detects undefined behaviour in the MIR optimization pipeline.
/// This is an internal lint, and not intended to be used directly.
pub rustc::BROKEN_MIR,
Deny,
Copy link
Member

Choose a reason for hiding this comment

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

Forbid maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One use case is to use expect. And you cannot expect a forbidden lint.

Comment on lines +3959 to +3705
crate::declare_tool_lint! {
/// The `broken_mir` statically detects undefined behaviour in the MIR optimization pipeline.
/// This is an internal lint, and not intended to be used directly.
pub rustc::BROKEN_MIR,
Deny,
"broken MIR",
report_in_external_macro: true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Bike-shedding: The term broken MIR is already used when validation fails. It also overstates the severity of what is being reported. Maybe unusual MIR?

Copy link
Member

Choose a reason for hiding this comment

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

I do believe broken is the right term here

Copy link
Contributor

Choose a reason for hiding this comment

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

In what sense is this MIR broken?

The motivation behind moving those checks out of validator was the fact that there is nothing inherently wrong about violating them. Those reports should NOT be treated as bugs. It doesn't even mean that the user provided program has an undefined behaviour, since we don't know whether those instructions are ever executed.

@bors
Copy link
Collaborator

bors commented Dec 30, 2023

☔ The latest upstream changes (presumably #119377) made this pull request unmergeable. Please resolve the merge conflicts.

@cjgillot cjgillot force-pushed the mir-lint branch 2 times, most recently from 1176c87 to 0cbefd5 Compare January 1, 2024 02:43
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jan 5, 2024

☔ The latest upstream changes (presumably #119621) made this pull request unmergeable. Please resolve the merge conflicts.

@compiler-errors
Copy link
Member

@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 Feb 5, 2024
@Dylan-DPC
Copy link
Member

@cjgillot any updates on this? thanks

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Aug 19, 2024

☔ The latest upstream changes (presumably #129261) made this pull request unmergeable. Please resolve the merge conflicts.

@alex-semenyuk alex-semenyuk 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 23, 2024
@JohnCSimon
Copy link
Member

JohnCSimon commented Feb 5, 2025

@cjgillot

ping from triage - can you post your status on this PR? There hasn't been an update in a few months, and there are build and merge conflicts. Thanks!

FYI: when a PR is ready for review, send a message containing
@rustbot ready to switch to S-waiting-on-review so the PR is in the reviewer's backlog.

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 48)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 51)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 68)
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--set', 'gcc.download-ci-gcc=true', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
---- [mir-opt] tests/mir-opt/reference_prop.rs stdout ----

error: compilation failed!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/mir-opt/reference_prop.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=i686-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-O" "-Copt-level=1" "-Zdump-mir=ReferencePropagation | ReferencePropagation | ReferencePropagation | ReferencePropagation | ReferencePropagation | ReferencePropagation | ReferencePropagation | ReferencePropagation | ReferencePropagation | ReferencePropagation | ReferencePropagation" "-Zvalidate-mir" "-Zlint-mir" "-Zdump-mir-exclude-pass-number" "-Zmir-include-spans=false" "--crate-type=rlib" "-Zmir-opt-level=0" "-Zmir-enable-passes=+ReferencePropagation" "-Zdump-mir-dir=/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/reference_prop" "--emit" "mir" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt/reference_prop" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0"
stdout: none
--- stderr -------------------------------
warning: the feature `lint_reasons` has been stable since 1.81.0 and no longer requires an attribute to enable
##[warning] --> /checkout/tests/mir-opt/reference_prop.rs:4:41
  |
---

warning: unused variable: `c`
##[warning]  --> /checkout/tests/mir-opt/reference_prop.rs:21:13
   |
21 |         let c = *b; // This should be optimized.
   |             ^ help: if this is intentional, prefix it with an underscore: `_c`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: value assigned to `b` is never read
##[warning]  --> /checkout/tests/mir-opt/reference_prop.rs:37:17
---

warning: unused variable: `c`
##[warning]  --> /checkout/tests/mir-opt/reference_prop.rs:55:13
   |
55 |         let c = *b; // `b` is immutably borrowed, we know its value, but do not propagate it
   |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `c`
##[warning]  --> /checkout/tests/mir-opt/reference_prop.rs:70:13
   |
70 |         let c = *b; // `b` is mutably borrowed, we cannot know its value.
   |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `c`
##[warning]  --> /checkout/tests/mir-opt/reference_prop.rs:83:13
   |
83 |         let c = *b;
---

warning: unused variable: `b`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:115:13
    |
115 |         let b = *a; // This should be optimized as `*single`.
    |             ^ help: if this is intentional, prefix it with an underscore: `_b`

warning: value assigned to `multiple` is never read
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:128:9
    |
128 |         multiple = &*single;
    |         ^^^^^^^^
    |
help: you might have meant to mutate the pointed at value being passed in, instead of changing the reference in the local binding
    |
9   ~ fn reference_propagation<'a, T: Copy>(single: &'a T, multiple: &'a  mut T) {
10  |     // CHECK-LABEL: fn reference_propagation(
...
127 |         let a = &*multiple;
128 ~         *multiple = *single;
    |

warning: unused variable: `b`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:129:13
    |
129 |         let b = *a; // This should not be optimized.
    |             ^ help: if this is intentional, prefix it with an underscore: `_b`

warning: unused variable: `d`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:143:13
    |
143 |         let d = &b; // first round promotes debuginfo for `d`
    |             ^ help: if this is intentional, prefix it with an underscore: `_d`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:144:13
    |
144 |         let c = *b; // second round propagates this dereference
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `d`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:159:13
    |
159 |         let d = &mut b; // first round promotes debuginfo for `d`
    |             ^ help: if this is intentional, prefix it with an underscore: `_d`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:160:13
    |
160 |         let c = *b; // second round propagates this dereference
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:177:13
    |
177 |         let c = *b; // This should be optimized.
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: value assigned to `b` is never read
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:193:17
    |
193 |         let mut b = &mut a;
---

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:211:13
    |
211 |         let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed.
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:226:13
    |
226 |         let c = *b; // `b` is mutably borrowed, we cannot know its value.
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:239:13
    |
239 |         let c = *b;
---

warning: unused variable: `b`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:271:13
    |
271 |         let b = *a; // This should be optimized as `*single`.
    |             ^ help: if this is intentional, prefix it with an underscore: `_b`

warning: value assigned to `multiple` is never read
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:284:9
    |
284 |         multiple = &mut *single;
    |         ^^^^^^^^
    |
help: you might have meant to mutate the pointed at value being passed in, instead of changing the reference in the local binding
    |
165 ~ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, multiple: &'a mut T) {
166 |     // CHECK-LABEL: fn reference_propagation_mut(
...
283 |         let a = &mut *multiple;
284 ~         *multiple = *single;
    |

warning: unused variable: `b`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:285:13
    |
285 |         let b = *a; // This should not be optimized.
    |             ^ help: if this is intentional, prefix it with an underscore: `_b`

warning: unused variable: `d`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:300:13
    |
300 |         let d = &b; // first round promotes debuginfo for `d`
    |             ^ help: if this is intentional, prefix it with an underscore: `_d`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:301:13
    |
301 |         let c = *b; // second round propagates this dereference
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `d`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:316:13
    |
316 |         let d = &mut b; // first round promotes debuginfo for `d`
    |             ^ help: if this is intentional, prefix it with an underscore: `_d`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:317:13
    |
317 |         let c = *b; // second round propagates this dereference
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:334:13
    |
334 |         let c = *b; // This should be optimized.
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: value assigned to `b` is never read
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:350:17
    |
350 |         let mut b = &raw const a;
---

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:368:13
    |
368 |         let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed.
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:383:13
    |
383 |         let c = *b; // `b` is mutably borrowed, we cannot know its value.
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:396:13
    |
396 |         let c = *b;
---

warning: unused variable: `b`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:428:13
    |
428 |         let b = *a; // This should be optimized as `*single`.
    |             ^ help: if this is intentional, prefix it with an underscore: `_b`

warning: value assigned to `multiple` is never read
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:441:9
    |
441 |         multiple = &raw const *single;
    |         ^^^^^^^^
    |
    = help: maybe it is overwritten before being read?

warning: unused variable: `b`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:442:13
    |
442 |         let b = *a; // This should not be optimized.
    |             ^ help: if this is intentional, prefix it with an underscore: `_b`

warning: unused variable: `e`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:457:13
    |
457 |         let e = *c;
    |             ^ help: if this is intentional, prefix it with an underscore: `_e`

warning: unused variable: `d`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:471:13
    |
471 |         let d = &b; // first round promotes debuginfo for `d`
    |             ^ help: if this is intentional, prefix it with an underscore: `_d`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:472:13
    |
472 |         let c = *b; // second round propagates this dereference
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `d`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:487:13
    |
487 |         let d = &mut b; // first round promotes debuginfo for `d`
    |             ^ help: if this is intentional, prefix it with an underscore: `_d`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:488:13
    |
488 |         let c = *b; // second round propagates this dereference
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:505:13
    |
505 |         let c = *b; // This should be optimized.
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: value assigned to `b` is never read
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:521:17
    |
521 |         let mut b = &raw mut a;
---

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:539:13
    |
539 |         let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed.
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:554:13
    |
554 |         let c = *b; // `b` is mutably borrowed, we cannot know its value.
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:567:13
    |
567 |         let c = *b;
---

warning: unused variable: `b`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:599:13
    |
599 |         let b = *a; // This should be optimized as `*single`.
    |             ^ help: if this is intentional, prefix it with an underscore: `_b`

warning: value assigned to `multiple` is never read
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:612:9
    |
612 |         multiple = &raw mut *single;
    |         ^^^^^^^^
    |
    = help: maybe it is overwritten before being read?

warning: unused variable: `b`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:613:13
    |
613 |         let b = *a; // This should not be optimized.
    |             ^ help: if this is intentional, prefix it with an underscore: `_b`

warning: unused variable: `d`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:628:13
    |
628 |         let d = &b; // first round promotes debuginfo for `d`
    |             ^ help: if this is intentional, prefix it with an underscore: `_d`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:629:13
    |
629 |         let c = *b; // second round propagates this dereference
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: unused variable: `d`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:644:13
    |
644 |         let d = &mut b; // first round promotes debuginfo for `d`
    |             ^ help: if this is intentional, prefix it with an underscore: `_d`

warning: unused variable: `c`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:645:13
    |
645 |         let c = *b; // second round propagates this dereference
    |             ^ help: if this is intentional, prefix it with an underscore: `_c`

warning: value assigned to `RET` is never read
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:671:13
    |
671 |             RET = *p1;
    |             ^^^
    |
    = help: maybe it is overwritten before being read?

error: broken MIR in Item(DefId(0:17 ~ reference_prop[23d9]::multiple_storage)) (after phase change to runtime-post-cleanup) at bb1[0]:
       local _1 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:700:13
    |
700 |             Return()
    |             ^^^^^^^^
    |
---
733 | |     }
    | |_____^
    = note: this warning originates in the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info)

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after phase change to runtime-post-cleanup) at bb1[0]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:719:13
    |
719 |             x = 5;
    |             ^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after phase change to runtime-post-cleanup) at bb1[1]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:720:13
    |
720 |             r = &x;
    |             ^^^^^^

warning: value assigned to `RET` is never read
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:762:18
    |
762 |             Call(RET = opaque(u), ReturnTo(bb2), UnwindContinue())
    |                  ^^^
    |
    = help: maybe it is overwritten before being read?

warning: value assigned to `RET` is never read
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:767:18
    |
767 |             Call(RET = opaque(z), ReturnTo(bb3), UnwindContinue())
    |                  ^^^
    |
    = help: maybe it is overwritten before being read?

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after phase change to runtime-post-cleanup) at bb4[0]:
       local _2 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after phase change to runtime-post-cleanup) at bb4[0]:
       local _3 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

warning: unused variable: `field`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:836:9
    |
836 |     let field = &T(0).0;
    |         ^^^^^ help: if this is intentional, prefix it with an underscore: `_field`

warning: unused variable: `reborrow`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:839:9
    |
839 |     let reborrow = &*ref_mut_u8;
    |         ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_reborrow`

warning: unused variable: `variant_field`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:843:18
    |
843 |         Some(ref variant_field) => {}
    |                  ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_variant_field`

warning: unused variable: `constant_index`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:848:20
    |
848 |     if let [_, ref constant_index, subslice @ .., ref constant_index_from_end] = &[6; 10][..] {}
    |                    ^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_constant_index`

warning: unused variable: `subslice`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:848:36
    |
848 |     if let [_, ref constant_index, subslice @ .., ref constant_index_from_end] = &[6; 10][..] {}
    |                                    ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_subslice`

warning: unused variable: `constant_index_from_end`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:848:55
    |
848 |     if let [_, ref constant_index, subslice @ .., ref constant_index_from_end] = &[6; 10][..] {}
    |                                                       ^^^^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_constant_index_from_end`

warning: unused variable: `multiple_borrow`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:850:9
    |
850 |     let multiple_borrow = &&&mut T(6).0;
    |         ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_multiple_borrow`

warning: unused variable: `many_borrow`
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:861:9
    |
861 |     let many_borrow =
    |         ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_many_borrow`

error: broken MIR in Item(DefId(0:17 ~ reference_prop[23d9]::multiple_storage)) (after pass ForceInline) at bb1[0]:
       local _1 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:700:13
    |
700 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:17 ~ reference_prop[23d9]::multiple_storage)) (after pass RemoveUnneededDrops) at bb1[0]:
       local _1 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:700:13
    |
700 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:17 ~ reference_prop[23d9]::multiple_storage)) (after pass ReferencePropagation) at bb1[0]:
       local _1 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:700:13
    |
700 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:17 ~ reference_prop[23d9]::multiple_storage)) (after pass AddCallGuards) at bb1[0]:
       local _1 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:700:13
    |
700 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:17 ~ reference_prop[23d9]::multiple_storage)) (after pass PreCodegen) at bb1[0]:
       local _1 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:700:13
    |
700 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:17 ~ reference_prop[23d9]::multiple_storage)) (after phase change to runtime-optimized) at bb1[0]:
       local _1 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:700:13
    |
700 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after pass ForceInline) at bb1[0]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:719:13
    |
719 |             x = 5;
    |             ^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after pass ForceInline) at bb1[1]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:720:13
    |
720 |             r = &x;
    |             ^^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after pass RemoveUnneededDrops) at bb1[0]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:719:13
    |
719 |             x = 5;
    |             ^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after pass RemoveUnneededDrops) at bb1[1]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:720:13
    |
720 |             r = &x;
    |             ^^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after pass ReferencePropagation) at bb1[0]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:719:13
    |
719 |             x = 5;
    |             ^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after pass ReferencePropagation) at bb1[1]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:720:13
    |
720 |             r = &x;
    |             ^^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after pass AddCallGuards) at bb1[0]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:719:13
    |
719 |             x = 5;
    |             ^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after pass AddCallGuards) at bb1[1]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:720:13
    |
720 |             r = &x;
    |             ^^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after pass PreCodegen) at bb1[0]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:719:13
    |
719 |             x = 5;
    |             ^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after pass PreCodegen) at bb1[1]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:720:13
    |
720 |             r = &x;
    |             ^^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after phase change to runtime-optimized) at bb1[0]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:719:13
    |
719 |             x = 5;
    |             ^^^^^

error: broken MIR in Item(DefId(0:19 ~ reference_prop[23d9]::dominate_storage)) (after phase change to runtime-optimized) at bb1[1]:
       use of local _1, which has no storage here
   --> /checkout/tests/mir-opt/reference_prop.rs:720:13
    |
720 |             r = &x;
    |             ^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after pass ForceInline) at bb4[0]:
       local _2 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after pass ForceInline) at bb4[0]:
       local _3 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after pass RemoveUnneededDrops) at bb4[0]:
       local _2 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after pass RemoveUnneededDrops) at bb4[0]:
       local _3 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after pass ReferencePropagation) at bb4[0]:
       local _2 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after pass ReferencePropagation) at bb4[0]:
       local _3 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after pass AddCallGuards) at bb4[0]:
       local _2 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after pass AddCallGuards) at bb4[0]:
       local _3 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after pass PreCodegen) at bb4[0]:
       local _2 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after pass PreCodegen) at bb4[0]:
       local _3 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after phase change to runtime-optimized) at bb4[0]:
       local _2 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

error: broken MIR in Item(DefId(0:21 ~ reference_prop[23d9]::maybe_dead)) (after phase change to runtime-optimized) at bb4[0]:
       local _3 still has storage when returning from function
   --> /checkout/tests/mir-opt/reference_prop.rs:776:13
    |
776 |             Return()
    |             ^^^^^^^^

---

warning: function `reference_propagation` is never used
##[warning] --> /checkout/tests/mir-opt/reference_prop.rs:9:4
  |
9 | fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
  |    ^^^^^^^^^^^^^^^^^^^^^

warning: function `reference_propagation_mut` is never used
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:165:4
    |
165 | fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a mut T) {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `reference_propagation_const_ptr` is never used
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:322:4
    |
322 | fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *const T) {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `reference_propagation_mut_ptr` is never used
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:493:4
    |
493 | fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function `read_through_raw` is never used
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:651:4
    |
---

warning: function `maybe_dead` is never used
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:738:4
    |
738 | fn maybe_dead(m: bool) {
    |    ^^^^^^^^^^

warning: function `mut_raw_then_mut_shr` is never used
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:781:4
    |
781 | fn mut_raw_then_mut_shr() -> (i32, i32) {
    |    ^^^^^^^^^^^^^^^^^^^^

warning: function `unique_with_copies` is never used
##[warning]   --> /checkout/tests/mir-opt/reference_prop.rs:797:4
    |

@cjgillot cjgillot marked this pull request as draft July 14, 2025 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

10 participants