rust/compiler/rustc_span/src
Matthias Krüger 79935714f3
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
2021-11-20 10:21:14 +01:00
..
analyze_source_file
lev_distance Suggest a case insensitive match name regardless of levenshtein distance 2021-10-17 04:51:22 +09:00
source_map
symbol Move the Lock into symbol::Interner 2021-09-15 18:46:45 +02:00
analyze_source_file.rs
caching_source_map_view.rs Convert debug_assert to assert in CachingSourceMapView 2021-09-17 12:01:29 -05:00
def_id.rs
edition.rs Update LATEST_STABLE_EDITION to 2021. 2021-08-30 15:33:09 +02:00
fatal_error.rs
hygiene.rs Don't suggest importing items with hygienic names 2021-10-21 23:36:51 +01:00
lev_distance.rs Suggest a case insensitive match name regardless of levenshtein distance 2021-10-17 04:51:22 +09:00
lib.rs Fix non-constant value ICE (#90878) 2021-11-15 20:40:29 +01:00
source_map.rs Add SourceMap::indentation_before. 2021-11-16 19:52:58 +01:00
span_encoding.rs Rename decode to data_untracked. 2021-09-10 20:18:22 +02:00
symbol.rs rustc: Remove #[rustc_synthetic] 2021-11-18 14:32:29 +08:00
tests.rs