1
Fork 0

Rollup merge of #100590 - TaKO8Ki:suggest-adding-array-length, r=compiler-errors

Suggest adding an array length if possible

fixes #100448
This commit is contained in:
Matthias Krüger 2022-08-16 06:05:59 +02:00 committed by GitHub
commit 76dd1663d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 141 additions and 29 deletions

View file

@ -48,7 +48,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sorted_map::SortedMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::sync::Lrc;
use rustc_errors::{struct_span_err, Applicability, Handler};
use rustc_errors::{struct_span_err, Applicability, Handler, StashKey};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
@ -2235,7 +2235,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
c.value.span,
"using `_` for array lengths is unstable",
)
.emit();
.stash(c.value.span, StashKey::UnderscoreForArrayLengths);
hir::ArrayLen::Body(self.lower_anon_const(c))
}
}