review comments: inline bindings and fix typo
This commit is contained in:
parent
53a711fdeb
commit
3c905d4ccd
16 changed files with 28 additions and 24 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue