diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-09-20 15:02:36 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-09-22 11:33:13 -0700 |
| commit | 3ea0d1097945273d6f9091126e67899a2e7e8fb1 (patch) | |
| tree | e18f4530898bb2e75eeffc41edcda426292dcc22 | |
| parent | d201e278ba6f9e2f8d9046eb983116b839807c98 (diff) | |
| download | rust-3ea0d1097945273d6f9091126e67899a2e7e8fb1.tar.gz rust-3ea0d1097945273d6f9091126e67899a2e7e8fb1.zip | |
hack to avoid incorrect suggestion
| -rw-r--r-- | src/librustc/traits/error_reporting.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/kindck/kindck-copy.stderr | 10 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 03f8ac250e9..aff866fa76d 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -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(); diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr index fee9e2802a6..3ca9cf7e973 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -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> |
