Rollup merge of #119805 - chenyukang:yukang-fix-119530, r=davidtwco
Suggest array::from_fn for array initialization Fixes #119530
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user