hack to avoid incorrect suggestion

This commit is contained in:
Esteban Küber 2019-09-20 15:02:36 -07:00
parent d201e278ba
commit 3ea0d10979
2 changed files with 9 additions and 8 deletions

View File

@ -1055,6 +1055,13 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
.filter(|c| !c.is_whitespace())
.take_while(|c| *c == '&')
.count();
if let Some('\'') = snippet.chars()
.filter(|c| !c.is_whitespace())
.skip(refs_number)
.next()
{ // Do not suggest removal of borrow from type arguments.
return;
}
let mut trait_type = trait_ref.self_ty();

View File

@ -5,10 +5,7 @@ LL | fn assert_copy<T:Copy>() { }
| ----------- ---- required by this bound in `assert_copy`
...
LL | assert_copy::<&'static mut isize>();
| -^^^^^^^^^^^^^^^^^
| |
| the trait `std::marker::Copy` is not implemented for `&'static mut isize`
| help: consider removing 1 leading `&`-references
| ^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'static mut isize`
|
= help: the following implementations were found:
<isize as std::marker::Copy>
@ -20,10 +17,7 @@ LL | fn assert_copy<T:Copy>() { }
| ----------- ---- required by this bound in `assert_copy`
...
LL | assert_copy::<&'a mut isize>();
| -^^^^^^^^^^^^
| |
| the trait `std::marker::Copy` is not implemented for `&'a mut isize`
| help: consider removing 1 leading `&`-references
| ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut isize`
|
= help: the following implementations were found:
<isize as std::marker::Copy>