1
Fork 0

Suggest arry::from_fn for array initialization

This commit is contained in:
yukang 2024-01-05 10:25:20 +08:00
parent 4cb17b4e78
commit 3ed96e35c4
9 changed files with 40 additions and 0 deletions

View file

@ -3152,6 +3152,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
],
Applicability::MachineApplicable,
);
} else {
// FIXME: we may suggest array::repeat instead
err.help("consider using `core::array::from_fn` to initialize the array");
err.help("see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html# for more information");
}
if self.tcx.sess.is_nightly_build()