Rollup merge of #119805 - chenyukang:yukang-fix-119530, r=davidtwco
Suggest array::from_fn for array initialization Fixes #119530
This commit is contained in:
commit
dd538b5f05
9 changed files with 40 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue