Rollup merge of #128110 - veera-sivarajan:bugfix-80173, r=cjgillot
Suggest Replacing Comma with Semicolon in Incorrect Repeat Expressions Fixes #80173 This PR detects typos in repeat expressions like `["_", 10]` and `vec![String::new(), 10]` and suggests replacing comma with semicolon. Also, improves code in other place by adding doc comments and making use of a helper function to check if a type implements `Clone`. References: 1. For `vec![T; N]`: https://doc.rust-lang.org/std/macro.vec.html 2. For `[T; N]`: https://doc.rust-lang.org/std/primitive.array.html
This commit is contained in:
commit
e4e2d9ceb8
9 changed files with 324 additions and 11 deletions
|
@ -47,6 +47,12 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, copy_def_id)
|
||||
}
|
||||
|
||||
fn type_is_clone_modulo_regions(&self, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
let ty = self.resolve_vars_if_possible(ty);
|
||||
let clone_def_id = self.tcx.require_lang_item(LangItem::Clone, None);
|
||||
traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, clone_def_id)
|
||||
}
|
||||
|
||||
fn type_is_sized_modulo_regions(&self, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
let lang_item = self.tcx.require_lang_item(LangItem::Sized, None);
|
||||
traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, lang_item)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue