about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-11-20 10:21:14 +0100
committerGitHub <noreply@github.com>2021-11-20 10:21:14 +0100
commit79935714f39e55cdbb2e524b3b228c783b58daa9 (patch)
tree9497d608f6633f4ba3cc95fa3a550c1f8e512f89 /compiler/rustc_codegen_llvm/src/llvm_util.rs
parent81f3ae8997e9e5806dadc5c2ef2786407c1f795d (diff)
parent96c37c8a6a4bbfe34a81754e174bfc2e41d194f6 (diff)
downloadrust-79935714f39e55cdbb2e524b3b228c783b58daa9.tar.gz
rust-79935714f39e55cdbb2e524b3b228c783b58daa9.zip
Rollup merge of #90930 - Nilstrieb:fix-non-const-value-ice, r=estebank
Fix `non-constant value` ICE (#90878)

This also fixes the same suggestion, which was kind of broken, because it just searched for the last occurence of `const` to replace with a `let`. This works great in some cases, but when there is no const and a leading space to the file, it doesn't work and panic with overflow because it thought that it had found a const.

I also changed the suggestion to only trigger if the `const` and the non-constant value are on the same line, because if they aren't, the suggestion is very likely to be wrong.

Also don't trigger the suggestion if the found `const` is on line 0, because that triggers the ICE.

Asking Esteban to review since he was the last one to change the relevant code.

r? ``@estebank``

Fixes #90878
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
0 files changed, 0 insertions, 0 deletions