1
Fork 0

review comments: inline bindings and fix typo

This commit is contained in:
Esteban Küber 2022-11-11 16:57:01 -08:00
parent 53a711fdeb
commit 3c905d4ccd
16 changed files with 28 additions and 24 deletions

View file

@ -721,11 +721,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
let tcx = self.infcx.tcx;
// Try to find predicates on *generic params* that would allow copying `ty`
let infcx = tcx.infer_ctxt().build();
let clone_did = tcx.lang_items().clone_trait().unwrap();
let params = ty::List::empty();
let ty = tcx.erase_regions(ty);
let env = self.param_env;
if infcx.type_implements_trait(clone_did, ty, params, env).must_apply_modulo_regions() {
if infcx
.type_implements_trait(
tcx.lang_items().clone_trait().unwrap(),
tcx.erase_regions(ty),
ty::List::empty(),
self.param_env,
)
.must_apply_modulo_regions()
{
err.span_suggestion_verbose(
span.shrink_to_hi(),
"consider cloning the value if the performance cost is acceptable",