rust/compiler/rustc_resolve/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
..
late rustc: Remove #[rustc_synthetic] 2021-11-18 14:32:29 +08:00
build_reduced_graph.rs Shorten Span of unused macro lints 2021-11-11 08:04:02 +01:00
check_unused.rs Add ty::Visibility::is_public() 2021-11-09 18:35:00 -08:00
def_collector.rs Record call_site parent for macros. 2021-09-10 20:19:25 +02:00
diagnostics.rs Fix case where ICE #90878 was still triggered by a leading newline 2021-11-16 22:16:47 +01:00
imports.rs Rollup merge of #90628 - ken-matsui:clarify-error-messages-caused-by-reexporting-pub-crate-visibility-to-outside, r=oli-obk 2021-11-20 10:21:13 +01:00
late.rs ast: Fix naming conventions in AST structures 2021-11-07 21:38:17 +08:00
lib.rs Stabilize format_args_capture 2021-11-15 10:14:29 +01:00
macros.rs Shorten Span of unused macro lints 2021-11-11 08:04:02 +01:00